1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-12 03:59:16 +02:00
parent 453b281a4b
commit 46b895aff2
25 changed files with 716 additions and 0 deletions

View file

@ -0,0 +1,70 @@
function ModelRequest(modelHash)
if not IsModelInCdimage(modelHash) then return end
RequestModel(modelHash)
local loaded
for i=1, 100 do
if HasModelLoaded(modelHash) then
loaded = true
break
end
Wait(100)
end
return loaded
end
function CreateVeh(modelHash, ...)
if not ModelRequest(modelHash) then
print("Couldn't load model: " .. modelHash)
return
end
local veh = CreateVehicle(modelHash, ...)
SetModelAsNoLongerNeeded(modelHash)
return veh
end
function CreateNPC(modelHash, ...)
if not ModelRequest(modelHash) then
print("Couldn't load model: " .. modelHash)
return
end
local ped = CreatePed(26, modelHash, ...)
SetModelAsNoLongerNeeded(modelHash)
return ped
end
function CreateProp(modelHash, ...)
if not ModelRequest(modelHash) then
print("Couldn't load model: " .. modelHash)
return
end
local obj = CreateObject(modelHash, ...)
SetModelAsNoLongerNeeded(modelHash)
return obj
end
function PlayAnim(ped, dict, ...)
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do Wait(0) end
TaskPlayAnim(ped, dict, ...)
end
local interactTick = 0
local interactThread = false
local interactText = nil
function ShowInteractText(text)
interactTick = GetGameTimer()
lib.showTextUI(text)
if interactThread then return end
interactThread = true
CreateThread(function()
while interactThread do
if GetGameTimer() - interactTick > 20 then
interactThread = false
break
end
Citizen.Wait(150)
end
lib.hideTextUI()
end)
end

View file

@ -0,0 +1,10 @@
function v3(coords) return vec3(coords.x, coords.y, coords.z), coords.w end
function GetRandomInt(min, max, exclude)
for i=1, 1000 do
local int = math.random(min, max)
if exclude == nil or exclude ~= int then
return int
end
end
end