16.09.2009, 00:09
hi... again... xD, im trying to make an engine on off command for vehicles and i'd like to know if theres a way to make some states (like ON OFF) to set to each vehicle.....
new bool:EngineRunning[MAX_VEHICLES];
new OldVehicle[MAX_PLAYERS];
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == 2)
{
new vehi = GetPlayerVehicleID(playerid);
OldVehicle[playerid] = vehi;
EngineRunning[vehi] = true;
}
if(newstate == 1 && oldstate == 2)
{
EngineRunning[OldVehicle[playerid]] = false;
}
return 1;
}
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if ( newstate == PLAYER_STATE_DRIVER ) TogglePlayerControllable( playerid, false );
return 1;
}
//wherever you want to start it, say a keypress or a command
TogglePlayerControllable( playerid, true );