forked from thelindat/Posted-Speedlimit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cl_speed.lua
286 lines (282 loc) · 9.56 KB
/
cl_speed.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
playerLoaded = 0
speedlimit = 420
lowSpeedLimit = 50
medSpeedLimit = 70
highSpeedLimit = 90
currentSpeed = 0
limitFlash = true
pause = false
speedlimitValues = {["Joshua Rd"]=medSpeedLimit,
["East Joshua Road"]=medSpeedLimit,
["Marina Dr"]=lowSpeedLimit,
["Alhambra Dr"]=lowSpeedLimit,
["Niland Ave"]=medSpeedLimit,
["Zancudo Ave"]=medSpeedLimit,
["Armadillo Ave"]=medSpeedLimit,
["Algonquin Blvd"]=medSpeedLimit,
["Mountain View Dr"]=lowSpeedLimit,
["Cholla Springs Ave"]=medSpeedLimit,
["Panorama Dr"]=lowSpeedLimit,
["Lesbos Ln"]=lowSpeedLimit,
["Calafia Rd"]=lowSpeedLimit,
["North Calafia Way"]=lowSpeedLimit,
["Cassidy Trail"]=lowSpeedLimit,
["Seaview Rd"]=lowSpeedLimit,
["Grapeseed Main St"]=lowSpeedLimit,
["Grapeseed Ave"]=medSpeedLimit,
["Joad Ln"]=lowSpeedLimit,
["Union Rd"]=lowSpeedLimit,
["O'Neil Way"]=lowSpeedLimit,
["Senora Fwy"]=highSpeedLimit,
["Catfish View"]=lowSpeedLimit,
["Great Ocean Hwy"]=highSpeedLimit,
["Paleto Blvd"]=medSpeedLimit,
["Duluoz Ave"]=medSpeedLimit,
["Procopio Dr"]=lowSpeedLimit,
["Cascabel Ave"]=medSpeedLimit,
["Procopio Promenade"]=lowSpeedLimit,
["Pyrite Ave"]=medSpeedLimit,
["Fort Zancudo Approach Rd"]=lowSpeedLimit,
["Barbareno Rd"]=lowSpeedLimit,
["Ineseno Road"]=lowSpeedLimit,
["West Eclipse Blvd"]=medSpeedLimit,
["Playa Vista"]=lowSpeedLimit,
["Bay City Ave"]=medSpeedLimit,
["Del Perro Fwy"]=highSpeedLimit,
["Equality Way"]=lowSpeedLimit,
["Red Desert Ave"]=medSpeedLimit,
["Magellan Ave"]=medSpeedLimit,
["Sandcastle Way"]=lowSpeedLimit,
["Vespucci Blvd"]=medSpeedLimit,
["Prosperity St"]=lowSpeedLimit,
["San Andreas Ave"]=medSpeedLimit,
["North Rockford Dr"]=lowSpeedLimit,
["South Rockford Dr"]=lowSpeedLimit,
["Marathon Ave"]=medSpeedLimit,
["Boulevard Del Perro"]=lowSpeedLimit,
["Cougar Ave"]=medSpeedLimit,
["Liberty St"]=lowSpeedLimit,
["Bay City Incline"]=lowSpeedLimit,
["Conquistador St"]=lowSpeedLimit,
["Cortes St"]=lowSpeedLimit,
["Vitus St"]=lowSpeedLimit,
["Aguja St"]=lowSpeedLimit,
["Goma St"]=lowSpeedLimit,
["Melanoma St"]=lowSpeedLimit,
["Palomino Ave"]=medSpeedLimit,
["Invention Ct"]=lowSpeedLimit,
["Imagination Ct"]=lowSpeedLimit,
["Rub St"]=lowSpeedLimit,
["Tug St"]=lowSpeedLimit,
["Ginger St"]=lowSpeedLimit,
["Lindsay Circus"]=lowSpeedLimit,
["Calais Ave"]=medSpeedLimit,
["Adam's Apple Blvd"]=medSpeedLimit,
["Alta St"]=lowSpeedLimit,
["Integrity Way"]=lowSpeedLimit,
["Swiss St"]=lowSpeedLimit,
["Strawberry Ave"]=medSpeedLimit,
["Capital Blvd"]=medSpeedLimit,
["Crusade Rd"]=lowSpeedLimit,
["Innocence Blvd"]=medSpeedLimit,
["Davis Ave"]=medSpeedLimit,
["Little Bighorn Ave"]=medSpeedLimit,
["Roy Lowenstein Blvd"]=medSpeedLimit,
["Jamestown St"]=lowSpeedLimit,
["Carson Ave"]=medSpeedLimit,
["Grove St"]=lowSpeedLimit,
["Brouge Ave"]=medSpeedLimit,
["Covenant Ave"]=medSpeedLimit,
["Dutch London St"]=lowSpeedLimit,
["Signal St"]=lowSpeedLimit,
["Elysian Fields Fwy"]=highSpeedLimit,
["Plaice Pl"]=lowSpeedLimit,
["Chum St"]=lowSpeedLimit,
["Chupacabra St"]=lowSpeedLimit,
["Miriam Turner Overpass"]=highSpeedLimit,
["Autopia Pkwy"]=lowSpeedLimit,
["Exceptionalists Way"]=lowSpeedLimit,
["La Puerta Fwy"]=highSpeedLimit,
["New Empire Way"]=lowSpeedLimit,
["Runway1"]="--",
["Greenwich Pkwy"]=lowSpeedLimit,
["Kortz Dr"]=lowSpeedLimit,
["Banham Canyon Dr"]=lowSpeedLimit,
["Buen Vino Rd"]=lowSpeedLimit,
["Route 68"]=highSpeedLimit,
["Zancudo Grande Valley"]=lowSpeedLimit,
["Zancudo Barranca"]=lowSpeedLimit,
["Galileo Rd"]=lowSpeedLimit,
["Mt Vinewood Dr"]=lowSpeedLimit,
["Marlowe Dr"]=lowSpeedLimit,
["Milton Rd"]=lowSpeedLimit,
["Kimble Hill Dr"]=lowSpeedLimit,
["Normandy Dr"]=lowSpeedLimit,
["Hillcrest Ave"]=medSpeedLimit,
["Hillcrest Ridge Access Rd"]=lowSpeedLimit,
["North Sheldon Ave"]=medSpeedLimit,
["Lake Vinewood Dr"]=lowSpeedLimit,
["Lake Vinewood Est"]=lowSpeedLimit,
["Baytree Canyon Rd"]=lowSpeedLimit,
["Peaceful St"]=lowSpeedLimit,
["North Conker Ave"]=medSpeedLimit,
["Wild Oats Dr"]=lowSpeedLimit,
["Whispymound Dr"]=lowSpeedLimit,
["Didion Dr"]=lowSpeedLimit,
["Cox Way"]=lowSpeedLimit,
["Picture Perfect Drive"]=lowSpeedLimit,
["South Mo Milton Dr"]=lowSpeedLimit,
["Cockingend Dr"]=lowSpeedLimit,
["Mad Wayne Thunder Dr"]=lowSpeedLimit,
["Hangman Ave"]=medSpeedLimit,
["Dunstable Ln"]=lowSpeedLimit,
["Dunstable Dr"]=lowSpeedLimit,
["Greenwich Way"]=lowSpeedLimit,
["Greenwich Pl"]=lowSpeedLimit,
["Hardy Way"]=lowSpeedLimit,
["Richman St"]=lowSpeedLimit,
["Ace Jones Dr"]=lowSpeedLimit,
["Los Santos Freeway"]=highSpeedLimit,
["Senora Rd"]=lowSpeedLimit,
["Nowhere Rd"]=lowSpeedLimit,
["Smoke Tree Rd"]=lowSpeedLimit,
["Cholla Rd"]=lowSpeedLimit,
["Cat-Claw Ave"]=medSpeedLimit,
["Senora Way"]=lowSpeedLimit,
["Palomino Fwy"]=highSpeedLimit,
["Shank St"]=lowSpeedLimit,
["Macdonald St"]=lowSpeedLimit,
["Route 68 Approach"]=highSpeedLimit,
["Vinewood Park Dr"]=lowSpeedLimit,
["Vinewood Blvd"]=medSpeedLimit,
["Mirror Park Blvd"]=medSpeedLimit,
["Glory Way"]=lowSpeedLimit,
["Bridge St"]=lowSpeedLimit,
["West Mirror Drive"]=lowSpeedLimit,
["Nikola Ave"]=medSpeedLimit,
["East Mirror Dr"]=lowSpeedLimit,
["Nikola Pl"]=lowSpeedLimit,
["Mirror Pl"]=lowSpeedLimit,
["El Rancho Blvd"]=medSpeedLimit,
["Olympic Fwy"]=highSpeedLimit,
["Fudge Ln"]=lowSpeedLimit,
["Amarillo Vista"]=lowSpeedLimit,
["Labor Pl"]=medSpeedLimit,
["El Burro Blvd"]=medSpeedLimit,
["Sustancia Rd"]=lowSpeedLimit,
["South Shambles St"]=lowSpeedLimit,
["Hanger Way"]=lowSpeedLimit,
["Orchardville Ave"]=medSpeedLimit,
["Popular St"]=lowSpeedLimit,
["Buccaneer Way"]=lowSpeedLimit,
["Abattoir Ave"]=medSpeedLimit,
["Voodoo Place"]=lowSpeedLimit,
["Mutiny Rd"]=lowSpeedLimit,
["South Arsenal St"]=lowSpeedLimit,
["Forum Dr"]=lowSpeedLimit,
["Morningwood Blvd"]=medSpeedLimit,
["Dorset Dr"]=lowSpeedLimit,
["Caesars Place"]=lowSpeedLimit,
["Spanish Ave"]=medSpeedLimit,
["Portola Dr"]=lowSpeedLimit,
["Edwood Way"]=lowSpeedLimit,
["San Vitus Blvd"]=medSpeedLimit,
["Eclipse Blvd"]=medSpeedLimit,
["Gentry Lane"]=lowSpeedLimit,
["Las Lagunas Blvd"]=medSpeedLimit,
["Power St"]=lowSpeedLimit,
["Mt Haan Rd"]=lowSpeedLimit,
["Elgin Ave"]=medSpeedLimit,
["Hawick Ave"]=medSpeedLimit,
["Meteor St"]=lowSpeedLimit,
["Alta Pl"]=lowSpeedLimit,
["Occupation Ave"]=medSpeedLimit,
["Carcer Way"]=lowSpeedLimit,
["Eastbourne Way"]=lowSpeedLimit,
["Rockford Dr"]=lowSpeedLimit,
["Abe Milton Pkwy"]=lowSpeedLimit,
["Laguna Pl"]=lowSpeedLimit,
["Sinners Passage"]=lowSpeedLimit,
["Atlee St"]=lowSpeedLimit,
["Sinner St"]=lowSpeedLimit,
["Supply St"]=lowSpeedLimit,
["Amarillo Way"]=lowSpeedLimit,
["Tower Way"]=medSpeedLimit,
["Decker St"]=lowSpeedLimit,
["Tackle St"]=lowSpeedLimit,
["Low Power St"]=lowSpeedLimit,
["Clinton Ave"]=medSpeedLimit,
["Fenwell Pl"]=lowSpeedLimit,
["Utopia Gardens"]=lowSpeedLimit,
["Cavalry Blvd"]=medSpeedLimit,
["South Boulevard Del Perro"]=lowSpeedLimit,
["Americano Way"]=lowSpeedLimit,
["Sam Austin Dr"]=lowSpeedLimit,
["East Galileo Ave"]=medSpeedLimit,
["Galileo Park"]=lowSpeedLimit,
["West Galileo Ave"]=medSpeedLimit,
["Tongva Dr"]=lowSpeedLimit,
["Zancudo Rd"]=lowSpeedLimit,
["Movie Star Way"]=lowSpeedLimit,
["Heritage Way"]=lowSpeedLimit,
["Perth St"]=lowSpeedLimit,
["Chianski Passage"]=lowSpeedLimit,
["Lolita Ave"]=medSpeedLimit,
["Meringue Ln"]=lowSpeedLimit,
["Strangeways Dr"]=lowSpeedLimit,
["York St"]=lowSpeedLimit,
["Tangerine St"]=lowSpeedLimit,
["Fantastic Pl"]=lowSpeedLimit,
["Steele Way"]=lowSpeedLimit,
}
function getSpeed()
return speedlimit
end
function getStreet()
return street
end
Citizen.CreateThread(function()
while not playerLoaded do
Citizen.Wait(50)
if PlayerPedId() == -1 then playerLoaded = 1 end
end
while playerLoaded do
Citizen.Wait(500)
local playerloc = GetEntityCoords(GetPlayerPed(-1))
local streethash = GetStreetNameAtCoord(playerloc.x, playerloc.y, playerloc.z)
street = GetStreetNameFromHashKey(streethash)
if IsPedInAnyVehicle(GetPlayerPed(-1)) then
if IsPauseMenuActive() then
closeGui()
else
currentSpeed = GetEntitySpeed(GetPlayerPed(-1)) * 2.236936
speedlimit = speedlimitValues[street]
SpeedGui()
end
else
speedlimit = 0
closeGui()
Citizen.Wait(500)
end
end
end)
function SpeedGui()
SendNUIMessage(
{
action = "display",
type = speedlimit,
currentSpeed = currentSpeed,
lowSpeedLimit = lowSpeedLimit,
medSpeedLimit = medSpeedLimit,
highSpeedLimit = highSpeedLimit,
limitFlash = limitFlash
}
)
end
function closeGui()
SendNUIMessage(
{
action = "hide"
}
)
end