Robert_Easter Posted July 10, 2024 Posted July 10, 2024 So I created a vehicle engine system on my server side combined to a client side key bind. But the problem is that when a player enters the vehicle, the engine turns on automatically and it's annoying for RP gameplay. Can someone give me a client side method wich disables the automatic vehicle engine on ? Thank you
sssander Posted July 11, 2024 Posted July 11, 2024 (edited) Client-side: https://wiki.rage.mp/index.php?title=Vehicle::setEngineOn Server-side: https://wiki.rage.mp/index.php?title=Vehicle::engine Edited July 11, 2024 by sssander
Robert_Easter Posted July 16, 2024 Author Posted July 16, 2024 Tried this and the problem is that when the player enters the vehicle, he triggers the engine automatically on, and also when I turn off the engine with 2 key press(0x32) the player turns on the engine after it again ! please help dude My client side code : mp.keys.bind(0x32, true, function() { let player = mp.players.local; let vehicle = player.vehicle; if (vehicle) { let isEngineRunning = vehicle.getIsEngineRunning(); vehicle.setEngineOn(!isEngineRunning, false, true); mp.events.callRemote('serverToggleEngine', vehicle); } }); My Server side code: mp.events.add('serverToggleEngine', (player, vehicle) => { if (vehicle) { let currentEngineState = vehicle.engine; vehicle.engine = !currentEngineState; } });
Recommended Posts