Skip to content

Commit 1fe1585

Browse files
committed
Update v3.2
* Changed Translations * Added serverside engine sync (experimental)
1 parent 10a1fe7 commit 1fe1585

File tree

6 files changed

+49
-106
lines changed

6 files changed

+49
-106
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.4
1+
3.2

client.lua

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ AddEventHandler('EngineToggle:Engine', function()
5858
end
5959
Citizen.Wait(0)
6060

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+
6169
if Config.VehicleKeyChain then
6270
local isVehicleOrKeyOwner = exports["VehicleKeyChain"]:IsVehicleOrKeyOwner(veh)
6371

@@ -66,29 +74,29 @@ AddEventHandler('EngineToggle:Engine', function()
6674
vehicles[StateIndex][2] = not GetIsVehicleEngineRunning(veh)
6775
if vehicles[StateIndex][2] then
6876
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'])
7078
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')
7280
else
73-
TriggerEvent('esx:showNotification', _U('engine_start'))
81+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['engine_start'])
7482
end
7583
else
7684
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'])
7886
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')
8088
else
81-
TriggerEvent('esx:showNotification', _U('engine_stop'))
89+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['engine_stop'])
8290
end
8391
end
8492
end
8593
elseif IsPedInAnyVehicle(PlayerPedId(), false) and (not isVehicleOrKeyOwner) then
8694
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'])
8896
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')
9098
else
91-
TriggerEvent('esx:showNotification', _U('key_nokey'))
99+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['key_nokey'])
92100
end
93101
end
94102
else
@@ -97,19 +105,19 @@ AddEventHandler('EngineToggle:Engine', function()
97105
vehicles[StateIndex][2] = not GetIsVehicleEngineRunning(veh)
98106
if vehicles[StateIndex][2] then
99107
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'])
101109
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')
103111
else
104-
TriggerEvent('esx:showNotification', _U('engine_start'))
112+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['engine_start'])
105113
end
106114
else
107115
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'])
109117
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')
111119
else
112-
TriggerEvent('esx:showNotification', _U('engine_stop'))
120+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['engine_stop'])
113121
end
114122
end
115123
end
@@ -132,11 +140,11 @@ if Config.OnAtEnter then
132140
Citizen.Wait(0)
133141
vehicle[2] = true
134142
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'])
136144
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')
138146
else
139-
TriggerEvent('esx:showNotification', _U('engine_onatenter'))
147+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['engine_onatenter'])
140148
end
141149
end
142150
end
@@ -192,7 +200,7 @@ AddEventHandler('EngineToggle:hotwire', function()
192200

193201
Citizen.CreateThread(function()
194202
if Config.ProgessBar.enable then
195-
exports['pogressBar']:drawBar(animTime, _U('hotwiring'))
203+
exports['pogressBar']:drawBar(animTime, Translation[Config.Locale]['hotwiring'])
196204
end
197205
Citizen.Wait(animTime)
198206

@@ -203,23 +211,23 @@ AddEventHandler('EngineToggle:hotwire', function()
203211
ClearPedTasksImmediately(playerPed)
204212

205213
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'])
207215
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')
209217
else
210-
TriggerEvent('esx:showNotification', _U('vehicle_unlocked'))
218+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['vehicle_unlocked'])
211219
end
212220
else
213221
TriggerServerEvent('EngineToggle:delhotwire')
214222
FreezeEntityPosition(playerPed, false)
215223
ClearPedTasksImmediately(playerPed)
216224

217225
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'])
219227
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')
221229
else
222-
TriggerEvent('esx:showNotification', _U('hotwiring_failed'))
230+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['hotwiring_failed'])
223231
end
224232
end
225233

@@ -247,11 +255,11 @@ AddEventHandler('EngineToggle:hotwire', function()
247255
TriggerServerEvent('EngineToggle:addcarkeys', plate)
248256
else
249257
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'])
251259
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')
253261
else
254-
TriggerEvent('esx:showNotification', _U('hotwiring_notfoundkey'))
262+
TriggerEvent('esx:showNotification', Translation[Config.Locale]['hotwiring_notfoundkey'])
255263
end
256264
end
257265
else

fxmanifest.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
fx_version 'adamant'
22
games { 'gta5' }
33

4-
author 'Musiker15'
5-
description 'ESX Better Engine Toggle'
6-
version '3.1.4'
4+
author 'Musiker15 - MSK Scripts'
5+
description 'ESX EngineToggle'
6+
version '3.2'
7+
8+
lua54 'yes'
79

810
shared_script {
9-
'@es_extended/locale.lua',
10-
'locales/*.lua',
1111
'config.lua',
12+
'translation.lua'
1213
}
1314

1415
client_scripts {

locales/de.lua

Lines changed: 0 additions & 33 deletions
This file was deleted.

locales/en.lua

Lines changed: 0 additions & 33 deletions
This file was deleted.

server.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ AddEventHandler('EngineToggle:hasItem', function()
3131
TriggerClientEvent('EngineToggle:hotwire', source)
3232
else
3333
if Config.Notifications then
34-
TriggerClientEvent('notifications', source, "#FF0000", _U('header'), _U('hasno_lockpick'))
34+
TriggerClientEvent('notifications', source, "#FF0000", Translation[Config.Locale]['header'], Translation[Config.Locale]['hasno_lockpick'])
3535
elseif Config.OkokNotify then
36-
TriggerClientEvent('okokNotify:Alert', source, _U('header'), _U('hasno_lockpick'), 5000, 'info')
36+
TriggerClientEvent('okokNotify:Alert', source, Translation[Config.Locale]['header'], Translation[Config.Locale]['hasno_lockpick'], 5000, 'info')
3737
else
38-
TriggerEvent('esx:showNotification', source, _U('hasno_lockpick'))
38+
TriggerEvent('esx:showNotification', source, Translation[Config.Locale]['hasno_lockpick'])
3939
end
4040
end
4141
end)
@@ -45,11 +45,11 @@ AddEventHandler('EngineToggle:addcarkeys', function(plate)
4545
exports["VehicleKeyChain"]:AddTempKey(source, plate)
4646

4747
if Config.Notifications then
48-
TriggerEvent('notifications', source,"#FF0000", _U('header'), _U('hotwiring_foundkey'))
48+
TriggerEvent('notifications', source,"#FF0000", Translation[Config.Locale]['header'], Translation[Config.Locale]['hotwiring_foundkey'])
4949
elseif Config.OkokNotify then
50-
TriggerClientEvent('okokNotify:Alert', source, _U('header'), _U('hotwiring_foundkey'), 5000, 'info')
50+
TriggerClientEvent('okokNotify:Alert', source, Translation[Config.Locale]['header'], Translation[Config.Locale]['hotwiring_foundkey'], 5000, 'info')
5151
else
52-
TriggerEvent('esx:showNotification', source, _U('hotwiring_foundkey'))
52+
TriggerEvent('esx:showNotification', source, Translation[Config.Locale]['hotwiring_foundkey'])
5353
end
5454
end)
5555

0 commit comments

Comments
 (0)