21.08.2010, 20:22
Hello,
I'm trying to make a code that starts and stops the engine with the same button (LShift), I have it working with no errors and the engine starts but then when hold s (brake) it ejects me out and says engine off, and if i stop the car it kicks me out and says engine off.
Heres the code:
I'm trying to make a code that starts and stops the engine with the same button (LShift), I have it working with no errors and the engine starts but then when hold s (brake) it ejects me out and says engine off, and if i stop the car it kicks me out and says engine off.
Heres the code:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { new vehicle = GetPlayerVehicleID(playerid); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if ((newkeys & KEY_JUMP) && !(oldkeys & KEY_JUMP)) { if(Vehicle[vehicle][Engine] == 0) { TogglePlayerControllable(playerid, true); Vehicle[vehicle][Engine] = 1; SendClientMessage(playerid, COLOR_GREEN, "[VEHICLE]:: Engine started."); } else { RemovePlayerFromVehicle(playerid); Vehicle[vehicle][Engine] = 0; SendClientMessage(playerid, COLOR_RED, "[VEHICLE]:: Engine off."); } } } return 1; }