Files
esx_core-esx-framework/client/modules/streaming.lua
T
2021-05-03 20:04:39 +01:00

86 lines
1.6 KiB
Lua

function ESX.Streaming.RequestModel(modelHash, cb)
modelHash = (type(modelHash) == 'number' and modelHash or GetHashKey(modelHash))
if not HasModelLoaded(modelHash) and IsModelInCdimage(modelHash) then
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Citizen.Wait(4)
end
end
if cb ~= nil then
cb()
end
end
function ESX.Streaming.RequestStreamedTextureDict(textureDict, cb)
if not HasStreamedTextureDictLoaded(textureDict) then
RequestStreamedTextureDict(textureDict)
while not HasStreamedTextureDictLoaded(textureDict) do
Citizen.Wait(4)
end
end
if cb ~= nil then
cb()
end
end
function ESX.Streaming.RequestNamedPtfxAsset(assetName, cb)
if not HasNamedPtfxAssetLoaded(assetName) then
RequestNamedPtfxAsset(assetName)
while not HasNamedPtfxAssetLoaded(assetName) do
Citizen.Wait(4)
end
end
if cb ~= nil then
cb()
end
end
function ESX.Streaming.RequestAnimSet(animSet, cb)
if not HasAnimSetLoaded(animSet) then
RequestAnimSet(animSet)
while not HasAnimSetLoaded(animSet) do
Citizen.Wait(4)
end
end
if cb ~= nil then
cb()
end
end
function ESX.Streaming.RequestAnimDict(animDict, cb)
if not HasAnimDictLoaded(animDict) then
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(4)
end
end
if cb ~= nil then
cb()
end
end
function ESX.Streaming.RequestWeaponAsset(weaponHash, cb)
if not HasWeaponAssetLoaded(weaponHash) then
RequestWeaponAsset(weaponHash)
while not HasWeaponAssetLoaded(weaponHash) do
Citizen.Wait(4)
end
end
if cb ~= nil then
cb()
end
end