انا عملت الكود دا لما تيجي تدوس على button اسمها Engine On / Off المحرك بتاع السيارة بيطفا و لما دوس كليك عليه تاني بشتغل المحرك بس الكود دا فيه غلط علشان خرب لوحة السيارة
addEvent( 'VehiclesSystem;off/onPersonalVehicle', true )
addEventHandler( 'VehiclesSystem;off/onPersonalVehicle', root,
function switchEngine ( playerSource )
local theVehicle = getPedOccupiedVehicle ( playerSource )
-- Check if the player is in any vehicle and if he is the driver
if theVehicle and getVehicleController ( theVehicle ) == playerSource then
local state = getVehicleEngineState ( theVehicle )
setVehicleEngineState ( theVehicle, not state )
end
end
end
)
الأصلي
function turnEngineOff ( theVehicle, leftSeat, jackerPlayer )
-- if it's the driver who got out, and he was not jacked,
if leftSeat == 0 and not jackerPlayer then
-- turn off the engine
setVehicleEngineState ( theVehicle, false )
end
end
-- add 'turnEngineOff' as a handler for "onPlayerExitVehicle"
addEventHandler ( "onPlayerVehicleExit", getRootElement ( ), turnEngineOff )