-
Notifications
You must be signed in to change notification settings - Fork 18
/
client.lua
91 lines (79 loc) · 2.09 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
-- Variables
local directions = {
N = 360, 0,
NE = 315,
E = 270,
SE = 225,
S = 180,
SW = 135,
W = 90,
NW = 45,
}
local veh = 0;
Citizen.CreateThread(function()
while true do
local ped = GetPlayerPed(-1);
local veh = GetVehiclePedIsIn(ped, false);
local coords = GetEntityCoords(ped);
local zone = GetNameOfZone(coords.x, coords.y, coords.z);
local var1, var2 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
local hash1 = GetStreetNameFromHashKey(var1);
local hash2 = GetStreetNameFromHashKey(var2);
local heading = GetEntityHeading(PlayerPedId());
for k, v in pairs(directions) do
if (math.abs(heading - v) < 22.5) then
heading = k;
if (heading == 1) then
heading = 'N';
break;
end
break;
end
end
local street2;
if (hash2 == '') then
street2 = GetLabelText(zone);
else
street2 = hash2..', '..GetLabelText(zone);
end
local configColor;
if (config.color) then
configColor = 'rgb('..config.color.r..', '..config.color.g..', '..config.color.b..')'
else
configColor = 'rgb(240,200,80)'
end
if (config.position.x == nil or config.position.x == '') then config.position.x = 17.55 end
if (config.position.y == nil or config.position.y == '') then config.position.y = 3 end
if (config.vehicleCheck == false) then
SendNUIMessage({
type = 'open',
active = true,
color = configColor,
direction = heading,
posX = config.position.x,
posY = config.position.y,
street = hash1,
zone = street2
})
else
if (veh ~= 0) then
SendNUIMessage({
type = 'open',
active = true,
color = configColor,
direction = heading,
posX = config.position.x,
posY = config.position.y,
street = hash1,
zone = street2
})
else
SendNUIMessage({
type = 'open',
active = false
})
end
end
Citizen.Wait(500); -- 1s delay
end
end)