Help with Engine on/off system?
#1

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:
Код:
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;
}
Reply


Messages In This Thread
Help with Engine on/off system? - by Jmarr - 21.08.2010, 20:22
Re: Help with Engine on/off system? - by Mike_Peterson - 21.08.2010, 20:28
Re: Help with Engine on/off system? - by Jmarr - 21.08.2010, 20:48
Re: Help with Engine on/off system? - by boelie - 21.08.2010, 21:01

Forum Jump:


Users browsing this thread: 1 Guest(s)