-
Notifications
You must be signed in to change notification settings - Fork 1
/
client.lua
97 lines (89 loc) · 3.07 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
local Spheres = {}
local Spheres2 = {}
local Spheres_Names = {}
local Spheres3 = {}
local Spheres4 = {}
local Spheres5 = {}
local SpheresInitialized = false
local playerPed = PlayerPedId()
Citizen.CreateThread(function()
for i=1, #Config.Places, 1 do
if Config.Places[i].drawBlip then
local blip = AddBlipForCoord(Config.Places[i].vector)
SetBlipSprite(blip, Config.Places[i].blipSprite)
SetBlipColour(blip, Config.Places[i].blipColour)
SetBlipScale(blip, Config.Places[i].blipScale)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(Config.Places[i].blipName)
EndTextCommandSetBlipName(blip)
end
Spheres[i] = vector3(Config.Places[i].vector)
Spheres2[i] = (10*(Config.Places[i].sphere/10))
Spheres_Names[i] = Config.Places[i].Weapons
Spheres3[i] = Config.Places[i].rgba
Spheres4[i] = Config.Places[i].revive
Spheres5[i] = Config.Places[i].reviveEvent
end
SpheresInitialized = true
end)
local coords
Citizen.CreateThread(function()
while true do
Citizen.Wait(300)
coords = GetEntityCoords(playerPed)
end
end)
local Sph = {}
local Entered = {}
Citizen.CreateThread(function()
while not SpheresInitialized or coords == nil do
Citizen.Wait(100)
end
while true do
Citizen.Wait(500)
Sph = {}
for i=1, #Spheres do
if Vdist2(coords, Spheres[i]) < (Spheres2[i]*Spheres2[i]) then
Sph[#Sph+1] = i
end
if Vdist2(coords, Spheres[i]) <= (Spheres2[i]*Spheres2[i]) then
if Entered[i] ~= true then
Entered[i] = 'maybe'
end
else
if Entered[i] ~= nil and Entered[i] == true then
for k,v in ipairs(Spheres_Names[i]) do
RemoveWeaponFromPed(playerPed, GetHashKey(v))
end
end
Entered[i] = false
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
if #Sph > 0 then
for i=1, #Sph, 1 do
DrawSphere(Spheres[Sph[i]].x, Spheres[Sph[i]].y, Spheres[Sph[i]].z, Spheres2[Sph[i]], Spheres3[i][1], Spheres3[i][2], Spheres3[i][3], Spheres3[i][4])
end
for i=1, #Entered, 1 do
if Entered[i] == 'maybe' then
for k,v in ipairs(Spheres_Names[i]) do
GiveWeaponToPed(playerPed, GetHashKey(v), 200)
end
Entered[i] = true
end
if GetEntityHealth(playerPed) <= 0 then
if Spheres4[i] and Spheres5[i] then
TriggerEvent(Spheres5[i])
end
end
end
else
Citizen.Wait(500)
end
end
end)