mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Implemented callbacks for ESX.Streaming (desc) closes #113
- ESX.Streaming.RequestClipSet - ESX.Streaming.RequestWeaponAsset - ESX.Streaming.RequestPtfxAsset - ESX.Streaming.RequestNamedPtfxAsset
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function ESX.Streaming.RequestModel(model)
|
||||
local modelHash = GetHashKey(model)
|
||||
function ESX.Streaming.RequestModel(modelHash, cb)
|
||||
modelHash = (type(modelHash) == 'number' and modelHash or GetHashKey(modelHash))
|
||||
|
||||
if not HasModelLoaded(modelHash) then
|
||||
RequestModel(modelHash)
|
||||
@@ -8,9 +8,13 @@ function ESX.Streaming.RequestModel(model)
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
end
|
||||
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
|
||||
function ESX.Streaming.RequestStreamedTextureDict(textureDict)
|
||||
function ESX.Streaming.RequestStreamedTextureDict(textureDict, cb)
|
||||
if not HasStreamedTextureDictLoaded(textureDict) then
|
||||
RequestStreamedTextureDict(textureDict)
|
||||
|
||||
@@ -18,9 +22,41 @@ function ESX.Streaming.RequestStreamedTextureDict(textureDict)
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
end
|
||||
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
|
||||
function ESX.Streaming.RequestAnimSet(animSet)
|
||||
function ESX.Streaming.RequestPtfxAsset(assetName, cb)
|
||||
if not HasPtfxAssetLoaded(assetName) then
|
||||
RequestPtfxAsset(assetName)
|
||||
|
||||
while not HasPtfxAssetLoaded(assetName) do
|
||||
Citizen.Wait(1)
|
||||
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(1)
|
||||
end
|
||||
end
|
||||
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
|
||||
function ESX.Streaming.RequestAnimSet(animSet, cb)
|
||||
if not HasAnimSetLoaded(animSet) then
|
||||
RequestAnimSet(animSet)
|
||||
|
||||
@@ -28,9 +64,13 @@ function ESX.Streaming.RequestAnimSet(animSet)
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
end
|
||||
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
|
||||
function ESX.Streaming.RequestAnimDict(animDict)
|
||||
function ESX.Streaming.RequestAnimDict(animDict, cb)
|
||||
if not HasAnimDictLoaded(animDict) then
|
||||
RequestAnimDict(animDict)
|
||||
|
||||
@@ -38,4 +78,36 @@ function ESX.Streaming.RequestAnimDict(animDict)
|
||||
Citizen.Wait(1)
|
||||
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(1)
|
||||
end
|
||||
end
|
||||
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
|
||||
function ESX.Streaming.RequestClipSet(clipSet, cb)
|
||||
if not HasClipSetLoaded(clipSet) then
|
||||
RequestClipSet(clipSet)
|
||||
|
||||
while not HasClipSetLoaded(clipSet) do
|
||||
Citizen.Wait(1)
|
||||
end
|
||||
end
|
||||
|
||||
if cb ~= nil then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user