@@ -58,6 +58,14 @@ AddEventHandler('EngineToggle:Engine', function()
58
58
end
59
59
Citizen .Wait (0 )
60
60
61
+ local netTime = 15
62
+ NetworkRequestControlOfEntity (veh )
63
+ while not NetworkHasControlOfEntity (veh ) and netTime > 0 do
64
+ NetworkRequestControlOfEntity (veh )
65
+ Citizen .Wait (1 )
66
+ netTime = netTime - 1
67
+ end
68
+
61
69
if Config .VehicleKeyChain then
62
70
local isVehicleOrKeyOwner = exports [" VehicleKeyChain" ]:IsVehicleOrKeyOwner (veh )
63
71
@@ -66,29 +74,29 @@ AddEventHandler('EngineToggle:Engine', function()
66
74
vehicles [StateIndex ][2 ] = not GetIsVehicleEngineRunning (veh )
67
75
if vehicles [StateIndex ][2 ] then
68
76
if Config .Notifications then
69
- TriggerEvent (' notifications' , " #00EE00" , _U ( ' notification_header' ), _U ( ' n_engine_start' ) )
77
+ TriggerEvent (' notifications' , " #00EE00" , Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' n_engine_start' ] )
70
78
elseif Config .OkokNotify then
71
- exports [' okokNotify' ]:Alert (_U ( ' notification_header' ), _U ( ' okok_engine_start' ) , 5000 , ' info' )
79
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' okok_engine_start' ] , 5000 , ' info' )
72
80
else
73
- TriggerEvent (' esx:showNotification' , _U ( ' engine_start' ) )
81
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' engine_start' ] )
74
82
end
75
83
else
76
84
if Config .Notifications then
77
- TriggerEvent (' notifications' , " #FF0000" , _U ( ' notification_header' ), _U ( ' n_engine_stop' ) )
85
+ TriggerEvent (' notifications' , " #FF0000" , Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' n_engine_stop' ] )
78
86
elseif Config .OkokNotify then
79
- exports [' okokNotify' ]:Alert (_U ( ' notification_header' ), _U ( ' okok_engine_stop' ) , 5000 , ' info' )
87
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' okok_engine_stop' ] , 5000 , ' info' )
80
88
else
81
- TriggerEvent (' esx:showNotification' , _U ( ' engine_stop' ) )
89
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' engine_stop' ] )
82
90
end
83
91
end
84
92
end
85
93
elseif IsPedInAnyVehicle (PlayerPedId (), false ) and (not isVehicleOrKeyOwner ) then
86
94
if Config .Notifications then
87
- TriggerEvent (' notifications' , " #FF0000" , _U ( ' notification_header' ), _U ( ' n_key_nokey' ) )
95
+ TriggerEvent (' notifications' , " #FF0000" , Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' n_key_nokey' ] )
88
96
elseif Config .OkokNotify then
89
- exports [' okokNotify' ]:Alert (_U ( ' notification_header' ), _U ( ' okok_key_nokey' ) , 5000 , ' error' )
97
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' okok_key_nokey' ] , 5000 , ' error' )
90
98
else
91
- TriggerEvent (' esx:showNotification' , _U ( ' key_nokey' ) )
99
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' key_nokey' ] )
92
100
end
93
101
end
94
102
else
@@ -97,19 +105,19 @@ AddEventHandler('EngineToggle:Engine', function()
97
105
vehicles [StateIndex ][2 ] = not GetIsVehicleEngineRunning (veh )
98
106
if vehicles [StateIndex ][2 ] then
99
107
if Config .Notifications then
100
- TriggerEvent (' notifications' , " #00EE00" , _U ( ' notification_header' ), _U ( ' n_engine_start' ) )
108
+ TriggerEvent (' notifications' , " #00EE00" , Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' n_engine_start' ] )
101
109
elseif Config .OkokNotify then
102
- exports [' okokNotify' ]:Alert (_U ( ' notification_header' ), _U ( ' okok_engine_start' ) , 5000 , ' info' )
110
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' okok_engine_start' ] , 5000 , ' info' )
103
111
else
104
- TriggerEvent (' esx:showNotification' , _U ( ' engine_start' ) )
112
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' engine_start' ] )
105
113
end
106
114
else
107
115
if Config .Notifications then
108
- TriggerEvent (' notifications' , " #FF0000" , _U ( ' notification_header' ), _U ( ' n_engine_stop' ) )
116
+ TriggerEvent (' notifications' , " #FF0000" , Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' n_engine_stop' ] )
109
117
elseif Config .OkokNotify then
110
- exports [' okokNotify' ]:Alert (_U ( ' notification_header' ), _U ( ' okok_engine_stop' ) , 5000 , ' info' )
118
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' okok_engine_stop' ] , 5000 , ' info' )
111
119
else
112
- TriggerEvent (' esx:showNotification' , _U ( ' engine_stop' ) )
120
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' engine_stop' ] )
113
121
end
114
122
end
115
123
end
@@ -132,11 +140,11 @@ if Config.OnAtEnter then
132
140
Citizen .Wait (0 )
133
141
vehicle [2 ] = true
134
142
if Config .Notifications then
135
- TriggerEvent (' notifications' , " #00EE00" , _U ( ' notification_header' ), _U ( ' n_engine_onatenter' ) )
143
+ TriggerEvent (' notifications' , " #00EE00" , Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' n_engine_onatenter' ] )
136
144
elseif Config .OkokNotify then
137
- exports [' okokNotify' ]:Alert (_U ( ' notification_header' ), _U ( ' okok_engine_onatenter' ) , 5000 , ' warning' )
145
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' notification_header' ], Translation [ Config . Locale ][ ' okok_engine_onatenter' ] , 5000 , ' warning' )
138
146
else
139
- TriggerEvent (' esx:showNotification' , _U ( ' engine_onatenter' ) )
147
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' engine_onatenter' ] )
140
148
end
141
149
end
142
150
end
@@ -192,7 +200,7 @@ AddEventHandler('EngineToggle:hotwire', function()
192
200
193
201
Citizen .CreateThread (function ()
194
202
if Config .ProgessBar .enable then
195
- exports [' pogressBar' ]:drawBar (animTime , _U ( ' hotwiring' ) )
203
+ exports [' pogressBar' ]:drawBar (animTime , Translation [ Config . Locale ][ ' hotwiring' ] )
196
204
end
197
205
Citizen .Wait (animTime )
198
206
@@ -203,23 +211,23 @@ AddEventHandler('EngineToggle:hotwire', function()
203
211
ClearPedTasksImmediately (playerPed )
204
212
205
213
if Config .Notifications then
206
- TriggerEvent (' notifications' , " #FF0000" , _U ( ' header' ), _U ( ' vehicle_unlocked' ) )
214
+ TriggerEvent (' notifications' , " #FF0000" , Translation [ Config . Locale ][ ' header' ], Translation [ Config . Locale ][ ' vehicle_unlocked' ] )
207
215
elseif Config .OkokNotify then
208
- exports [' okokNotify' ]:Alert (_U ( ' header' ), _U ( ' vehicle_unlocked' ) , 5000 , ' info' )
216
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' header' ], Translation [ Config . Locale ][ ' vehicle_unlocked' ] , 5000 , ' info' )
209
217
else
210
- TriggerEvent (' esx:showNotification' , _U ( ' vehicle_unlocked' ) )
218
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' vehicle_unlocked' ] )
211
219
end
212
220
else
213
221
TriggerServerEvent (' EngineToggle:delhotwire' )
214
222
FreezeEntityPosition (playerPed , false )
215
223
ClearPedTasksImmediately (playerPed )
216
224
217
225
if Config .Notifications then
218
- TriggerEvent (' notifications' , " #FF0000" , _U ( ' header' ), _U ( ' hotwiring_failed' ) )
226
+ TriggerEvent (' notifications' , " #FF0000" , Translation [ Config . Locale ][ ' header' ], Translation [ Config . Locale ][ ' hotwiring_failed' ] )
219
227
elseif Config .OkokNotify then
220
- exports [' okokNotify' ]:Alert (_U ( ' header' ), _U ( ' hotwiring_failed' ) , 5000 , ' info' )
228
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' header' ], Translation [ Config . Locale ][ ' hotwiring_failed' ] , 5000 , ' info' )
221
229
else
222
- TriggerEvent (' esx:showNotification' , _U ( ' hotwiring_failed' ) )
230
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' hotwiring_failed' ] )
223
231
end
224
232
end
225
233
@@ -247,11 +255,11 @@ AddEventHandler('EngineToggle:hotwire', function()
247
255
TriggerServerEvent (' EngineToggle:addcarkeys' , plate )
248
256
else
249
257
if Config .Notifications then
250
- TriggerEvent (' notifications' , " #FF0000" , _U ( ' header' ), _U ( ' hotwiring_notfoundkey' ) )
258
+ TriggerEvent (' notifications' , " #FF0000" , Translation [ Config . Locale ][ ' header' ], Translation [ Config . Locale ][ ' hotwiring_notfoundkey' ] )
251
259
elseif Config .OkokNotify then
252
- exports [' okokNotify' ]:Alert (_U ( ' header' ), _U ( ' hotwiring_notfoundkey' ) , 5000 , ' info' )
260
+ exports [' okokNotify' ]:Alert (Translation [ Config . Locale ][ ' header' ], Translation [ Config . Locale ][ ' hotwiring_notfoundkey' ] , 5000 , ' info' )
253
261
else
254
- TriggerEvent (' esx:showNotification' , _U ( ' hotwiring_notfoundkey' ) )
262
+ TriggerEvent (' esx:showNotification' , Translation [ Config . Locale ][ ' hotwiring_notfoundkey' ] )
255
263
end
256
264
end
257
265
else
0 commit comments