Skip to content

Commit e6cbe55

Browse files
committed
Update v3.7
1 parent 14e9ba2 commit e6cbe55

File tree

6 files changed

+163
-2
lines changed

6 files changed

+163
-2
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.1
1+
3.7

client.lua

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,116 @@ AddEventHandler('msk_enginetoggle:hotwire', function()
237237
end
238238
end)
239239

240+
if Config.NeonToggle then
241+
local neonoff = false
242+
243+
CreateThread(function()
244+
while true do
245+
Wait(10)
246+
local playerPed = PlayerPedId()
247+
local vehicle = GetVehiclePedIsIn(playerPed, false)
248+
local driver = GetPedInVehicleSeat(vehicle, -1)
249+
local neonon = IsVehicleNeonLightEnabled(vehicle, 1)
250+
251+
if IsPedInVehicle(playerPed, vehicle, true) and driver == playerPed then
252+
if IsControlPressed(1, Config.NeonToggleHolding) and IsControlJustPressed(1, Config.NeonToggleJustPressed) then
253+
if neonon then
254+
if neonoff == false then
255+
neonoff = true
256+
DisableVehicleNeonLights(vehicle, true)
257+
Config.Notification(nil, 'client', nil, Translation[Config.Locale]['neonlights_on'])
258+
Wait(2000)
259+
elseif neonoff == true then
260+
neonoff = false
261+
DisableVehicleNeonLights(vehicle, false)
262+
Config.Notification(nil, 'client', nil, Translation[Config.Locale]['neonlights_off'])
263+
Wait(2000)
264+
end
265+
else
266+
Config.Notification(nil, 'client', nil, Translation[Config.Locale]['neonlights_not_installed'])
267+
Wait(2000)
268+
end
269+
end
270+
else
271+
Wait(1000)
272+
end
273+
end
274+
end)
275+
end
276+
277+
if Config.SaveSteeringAngle then
278+
local pressed = 1 * 1000
279+
local steeringAngle
280+
281+
function PedDriving()
282+
local playerPed = PlayerPedId()
283+
284+
if IsPedSittingInAnyVehicle(playerPed) then
285+
local vehicle = GetVehiclePedIsIn(playerPed, false)
286+
287+
if GetPedInVehicleSeat(vehicle, -1) == playerPed then
288+
return true
289+
end
290+
end
291+
292+
return false
293+
end
294+
295+
CreateThread(function()
296+
while true do
297+
Wait(0)
298+
299+
if PedDriving() and IsControlJustPressed(1, Config.SaveAngleOnExit) then
300+
steeringAngle = GetVehicleSteeringAngle(vehicle)
301+
pressed = 500
302+
303+
while not IsControlJustReleased(1, Config.SaveAngleOnExit) do
304+
Wait(10)
305+
306+
if Config.PerformanceVersion then
307+
SetVehicleSteeringAngle(vehicle, steeringAngle)
308+
else
309+
TriggerServerEvent('msk_enginetoggle:async', NetworkGetNetworkIdFromEntity(vehicle), steeringAngle)
310+
end
311+
312+
break
313+
end
314+
end
315+
end
316+
end)
317+
318+
RegisterNetEvent("msk_enginetoggle:syncanglesave")
319+
AddEventHandler("msk_enginetoggle:syncanglesave", function(vehicleNetID, steeringAngle)
320+
local vehicle = NetworkGetEntityFromNetworkId(vehicleNetID)
321+
322+
if DoesEntityExist(vehicle) then
323+
SetVehicleSteeringAngle(vehicle, steeringAngle)
324+
end
325+
end)
326+
327+
CreateThread(function()
328+
if not Config.PerformanceVersion then
329+
local playerPed = PlayerPedId()
330+
local justDeleted
331+
332+
while true do
333+
Wait(500)
334+
335+
if IsPedInAnyVehicle(playerPed, false) then
336+
local vehicle = GetVehiclePedIsIn(playerPed, false)
337+
338+
if GetPedInVehicleSeat(vehicle, -1) == playerPed and not justDeleted and GetIsVehicleEngineRunning(vehicle) then
339+
TriggerServerEvent("msk_enginetoggle:angledelete", NetworkGetNetworkIdFromEntity(vehicle))
340+
justDeleted = true
341+
end
342+
else
343+
justDeleted = false
344+
end
345+
end
346+
end
347+
end)
348+
end
349+
240350
function table.contains(table, element)
241351
for _, value in pairs(table) do
242352
if value[1] == element then

config.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ Config.UseCommand = false -- Set true if you want to use a Command
1717
-- Vehicle Key System - set true then only the Owner of the Vehicle or someone with a Key can start the Engine
1818
Config.VehicleKeyChain = false -- https://kiminazes-script-gems.tebex.io/package/4524211
1919
----------------------------------------------------------------
20+
Config.SaveSteeringAngle = true
21+
Config.NeonToggle = false
22+
23+
Config.SaveAngleOnExit = 49 -- default: F - 49
24+
Config.PerformanceVersion = false -- true = no sync but more performance
25+
Config.RefreshTime = 5 -- in seconds // Refreshing SteeringAngle all 5 seconds
26+
27+
Config.NeonToggleHolding = 132 -- default: STRG - 132
28+
Config.NeonToggleJustPressed = 249 -- default: N - 249
29+
----------------------------------------------------------------
2030
-- With this feature you can set vehicles and plates for which you don't need a key to start the engine
2131
-- either exact plates or just a string that should be in the vehicles plate e.g. "ESX" will ignore te plate "ESX1234" too
2232
Config.Whitelist = {

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ games { 'gta5' }
44
author 'Musiker15 - MSK Scripts'
55
name 'msk_enginetoggle'
66
description 'EngineToggle for Vehicles'
7-
version '3.6.1'
7+
version '3.7'
88

99
lua54 'yes'
1010

server.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,39 @@ if Config.enableLockpick and Config.Framework:match('ESX') then
4848
end)
4949
end
5050

51+
if Config.SaveSteeringAngle then
52+
savedAngles = {}
53+
54+
RegisterServerEvent("msk_enginetoggle:async")
55+
AddEventHandler("msk_enginetoggle:async", function(vehicle, angle)
56+
savedAngles[vehicle] = angle
57+
TriggerClientEvent("msk_enginetoggle:syncanglesave", -1, vehicle, savedAngles[vehicle])
58+
end)
59+
60+
RegisterServerEvent("msk_enginetoggle:angledelete")
61+
AddEventHandler("msk_enginetoggle:angledelete", function(vehicle)
62+
savedAngles[vehicle] = nil
63+
end)
64+
65+
CreateThread(function()
66+
while true do
67+
Wait(Config.RefreshTime * 1000)
68+
69+
for i, data in pairs(savedAngles) do
70+
if savedAngles[i] ~= nil then
71+
local vehicle = NetworkGetEntityFromNetworkId(i)
72+
73+
if DoesEntityExist(vehicle) then
74+
TriggerClientEvent("msk_enginetoggle:syncanglesave", -1, i, savedAngles[i])
75+
else
76+
savedAngles[i] = nil
77+
end
78+
end
79+
end
80+
end
81+
end)
82+
end
83+
5184
---- Github Updater ----
5285
function GetCurrentVersion()
5386
return GetResourceMetadata( GetCurrentResourceName(), "version" )

translation.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Translation = {
1414
['hotwiring_foundkey'] = 'Fahrzeugschlüssel gefunden',
1515
['hotwiring_notfoundkey'] = 'Fahrzeugschlüssel nicht gefunden',
1616
['hotwire_searchkey'] = 'Drücke ~r~E~s~ um den Fahrzeugschlüssel zu suchen',
17+
18+
['neonlights_on'] = 'Du hast die Unterbodenbeleuchtung eingeschaltet',
19+
['neonlights_off'] = 'Du hast die Unterbodenbeleuchtung ausgeschaltet',
20+
['neonlights_not_installed'] = 'Du hast keine Unterbodenbeleuchtung',
1721
},
1822
['en'] = {
1923
['engine_start'] = 'The Engine ~g~started',
@@ -28,5 +32,9 @@ Translation = {
2832
['hotwiring_foundkey'] = 'Fahrzeugschlüssel gefunden',
2933
['hotwiring_notfoundkey'] = 'Fahrzeugschlüssel nicht gefunden',
3034
['hotwire_searchkey'] = 'Drücke ~r~E~s~ um den Fahrzeugschlüssel zu suchen',
35+
36+
['neonlights_on'] = 'You turned on the neon lights',
37+
['neonlights_off'] = 'You turned off the neon lights',
38+
['neonlights_not_installed'] = 'You do not have neon lights installed',
3139
},
3240
}

0 commit comments

Comments
 (0)