Hi, this is Nesk, I'd like to share my engine turning on/off system. It means that player shouldn't re-enter the vehicle to turn on the engine.
Commands are:
!enoff - turn off the vehicle engine
!enon - turn on the engine
[pawn]public OnPlayerText(playerid, text[])
{
if(strcmp(text, "!enoff", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
KillVehicleEngine(vehicleid);
SendClientMessage(playerid, 0xFF0000AA, "The engine has been turned off.");
GameTextForPlayer(playerid, "~o~ OFF");
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not in a vehicle.");
return 1;
}
return 1;
}
else if(strcmp(text, "!enon", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(playerid);
PutPlayerInVehicle(playerid, vehicleid);
SendClientMessage(playerid, 0xFF0000AA, "The engine has been turned on.");
GameTextForPlayer(playerid, "~t~ ON");
return 0;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not in a vehicle.");
return 0;
}
return 1;
}
return 1;
}[/pawn]
Good luck on roads!