-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathclient.lua
76 lines (62 loc) · 1.92 KB
/
client.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
local spawnedPeds = {}
Citizen.CreateThread(function()
while true do
Citizen.Wait(500)
for k,v in pairs(Config.PedList) do
local playerCoords = GetEntityCoords(PlayerPedId())
local distance = #(playerCoords - v.coords.xyz)
if distance < Config.DistanceSpawn and not spawnedPeds[k] then
local spawnedPed = NearPed(v.model, v.coords, v.gender, v.animDict, v.animName, v.scenario)
spawnedPeds[k] = { spawnedPed = spawnedPed }
end
if distance >= Config.DistanceSpawn and spawnedPeds[k] then
if Config.FadeIn then
for i = 255, 0, -51 do
Citizen.Wait(50)
SetEntityAlpha(spawnedPeds[k].spawnedPed, i, false)
end
end
DeletePed(spawnedPeds[k].spawnedPed)
spawnedPeds[k] = nil
end
end
end
end)
function NearPed(model, coords, gender, animDict, animName, scenario)
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(50)
end
if Config.MinusOne then
spawnedPed = CreatePed(Config.GenderNumbers[gender], model, coords.x, coords.y, coords.z - 1.0, coords.w, false, true)
else
spawnedPed = CreatePed(Config.GenderNumbers[gender], model, coords.x, coords.y, coords.z, coords.w, false, true)
end
SetEntityAlpha(spawnedPed, 0, false)
if Config.Frozen then
FreezeEntityPosition(spawnedPed, true)
end
if Config.Invincible then
SetEntityInvincible(spawnedPed, true)
end
if Config.Stoic then
SetBlockingOfNonTemporaryEvents(spawnedPed, true)
end
if animDict and animName then
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(50)
end
TaskPlayAnim(spawnedPed, animDict, animName, 8.0, 0, -1, 1, 0, 0, 0)
end
if scenario then
TaskStartScenarioInPlace(spawnedPed, scenario, 0, true)
end
if Config.FadeIn then
for i = 0, 255, 51 do
Citizen.Wait(50)
SetEntityAlpha(spawnedPed, i, false)
end
end
return spawnedPed
end