2026-04-14 17:41:39 +02:00

94 lines
1.8 KiB
Lua

--- Desencrypted By PrejuicioX
-- Utility Functions for FiveM Script
function PlayAnim(animDict, animName, flag, pedId)
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(100)
end
local targetPed = pedId or PlayerPedId()
local animFlag = flag or 1
TaskPlayAnim(
targetPed,
animDict,
animName,
2.0, -- blendInSpeed
2.0, -- blendOutSpeed
5.0, -- duration
animFlag,
1, -- playbackRate
false, -- lockX
false, -- lockY
false -- lockZ
)
RemoveAnimDict(animDict)
end
function DoRequestModel(modelName)
local modelHash = GetHashKey(modelName)
RequestModel(modelHash)
local attempts = 0
while not HasModelLoaded(modelHash) and attempts < 100 do
Citizen.Wait(10)
attempts = attempts + 1
end
end
function DeleteNearestOfType(coords, modelHash, radius)
local searchRadius = radius or 2.0
local nearestObject = GetClosestObjectOfType(
coords.x,
coords.y,
coords.z,
searchRadius,
modelHash,
0, 0, 0
)
while nearestObject ~= 0 do
SetEntityAsMissionEntity(nearestObject, 1, 1)
DeleteEntity(nearestObject)
nearestObject = GetClosestObjectOfType(
coords.x,
coords.y,
coords.z,
searchRadius,
modelHash,
0, 0, 0
)
Citizen.Wait(10)
end
end
function Contains(table, value)
for _, tableValue in ipairs(table) do
if tableValue == value then
return true
end
end
return false
end
function Debug(...)
if Config.debug then
print(...)
end
end
function L(key)
if Locale and Locale[key] then
return Locale[key]
end
return key
end
--- Desencrypted By PrejuicioX