mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
moved ESX.Streaming to esx_lib
This commit is contained in:
@@ -1,2 +1,8 @@
|
|||||||
--[[ All client-side functions outsourced from the Core to the lib will be stored here for compatability, e.g:
|
--All client-side functions outsourced from the Core to the lib will be stored here for compatability, e.g:
|
||||||
--]]
|
|
||||||
|
ESX.Streaming.RequestModel = xLib.requestModel
|
||||||
|
ESX.Streaming.RequestStreamedTextureDict = xLib.requestStreamedTextureDict
|
||||||
|
ESX.Streaming.RequestNamedPtfxAsset = xLib.requestNamedPtfxAsset
|
||||||
|
ESX.Streaming.RequestAnimSet = xLib.requestAnimSet
|
||||||
|
ESX.Streaming.RequestAnimDict = xLib.requestAnimDict
|
||||||
|
ESX.Streaming.RequestWeaponAsset = xLib.requestWeaponAsset
|
||||||
|
|||||||
+17
-8
@@ -1,9 +1,7 @@
|
|||||||
ESX.Streaming = {}
|
|
||||||
|
|
||||||
---@param modelHash number | string
|
---@param modelHash number | string
|
||||||
---@param cb? function
|
---@param cb? function
|
||||||
---@return number | nil
|
---@return number | nil
|
||||||
function ESX.Streaming.RequestModel(modelHash, cb)
|
xLib.requestModel = function(modelHash, cb)
|
||||||
modelHash = type(modelHash) == "number" and modelHash or joaat(modelHash)
|
modelHash = type(modelHash) == "number" and modelHash or joaat(modelHash)
|
||||||
|
|
||||||
if not IsModelInCdimage(modelHash) then return end
|
if not IsModelInCdimage(modelHash) then return end
|
||||||
@@ -17,7 +15,7 @@ end
|
|||||||
---@param textureDict string
|
---@param textureDict string
|
||||||
---@param cb? function
|
---@param cb? function
|
||||||
---@return string | nil
|
---@return string | nil
|
||||||
function ESX.Streaming.RequestStreamedTextureDict(textureDict, cb)
|
xLib.requestStreamedTextureDict = function(textureDict, cb)
|
||||||
RequestStreamedTextureDict(textureDict, false)
|
RequestStreamedTextureDict(textureDict, false)
|
||||||
|
|
||||||
while not HasStreamedTextureDictLoaded(textureDict) do Wait(500) end
|
while not HasStreamedTextureDictLoaded(textureDict) do Wait(500) end
|
||||||
@@ -28,7 +26,7 @@ end
|
|||||||
---@param assetName string
|
---@param assetName string
|
||||||
---@param cb? function
|
---@param cb? function
|
||||||
---@return string | nil
|
---@return string | nil
|
||||||
function ESX.Streaming.RequestNamedPtfxAsset(assetName, cb)
|
xLib.requestNamedPtfxAsset = function(assetName, cb)
|
||||||
RequestNamedPtfxAsset(assetName)
|
RequestNamedPtfxAsset(assetName)
|
||||||
|
|
||||||
while not HasNamedPtfxAssetLoaded(assetName) do Wait(500) end
|
while not HasNamedPtfxAssetLoaded(assetName) do Wait(500) end
|
||||||
@@ -39,7 +37,7 @@ end
|
|||||||
---@param animSet string
|
---@param animSet string
|
||||||
---@param cb? function
|
---@param cb? function
|
||||||
---@return string | nil
|
---@return string | nil
|
||||||
function ESX.Streaming.RequestAnimSet(animSet, cb)
|
xLib.requestAnimSet = function(animSet, cb)
|
||||||
RequestAnimSet(animSet)
|
RequestAnimSet(animSet)
|
||||||
|
|
||||||
while not HasAnimSetLoaded(animSet) do Wait(500) end
|
while not HasAnimSetLoaded(animSet) do Wait(500) end
|
||||||
@@ -50,7 +48,7 @@ end
|
|||||||
---@param animDict string
|
---@param animDict string
|
||||||
---@param cb? function
|
---@param cb? function
|
||||||
---@return string | nil
|
---@return string | nil
|
||||||
function ESX.Streaming.RequestAnimDict(animDict, cb)
|
xLib.requestAnimDict = function(animDict, cb)
|
||||||
RequestAnimDict(animDict)
|
RequestAnimDict(animDict)
|
||||||
|
|
||||||
while not HasAnimDictLoaded(animDict) do Wait(500) end
|
while not HasAnimDictLoaded(animDict) do Wait(500) end
|
||||||
@@ -61,10 +59,21 @@ end
|
|||||||
---@param weaponHash number | string
|
---@param weaponHash number | string
|
||||||
---@param cb? function
|
---@param cb? function
|
||||||
---@return string | number | nil
|
---@return string | number | nil
|
||||||
function ESX.Streaming.RequestWeaponAsset(weaponHash, cb)
|
xLib.requestWeaponAsset = function(weaponHash, cb)
|
||||||
RequestWeaponAsset(weaponHash, 31, 0)
|
RequestWeaponAsset(weaponHash, 31, 0)
|
||||||
|
|
||||||
while not HasWeaponAssetLoaded(weaponHash) do Wait(500) end
|
while not HasWeaponAssetLoaded(weaponHash) do Wait(500) end
|
||||||
|
|
||||||
return cb and cb(weaponHash) or weaponHash
|
return cb and cb(weaponHash) or weaponHash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param bankName string
|
||||||
|
---@param cb? function
|
||||||
|
---@return string | nil
|
||||||
|
xLib.requestAudioBank = function(bankName, cb)
|
||||||
|
RequestAudioBank(bankName, false)
|
||||||
|
|
||||||
|
while not RequestScriptAudioBank(bankName, false) do Wait(500) end
|
||||||
|
|
||||||
|
return cb and cb(bankName) or bankName
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user