26.07.2012, 17:06
Hello.
When someone types /engine the engine doesn't actually start!
please help!
When someone types /engine the engine doesn't actually start!
please help!
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gEngine[playerid] == 0)
{
SCM(playerid, COLOR_PINK, "Car engine started.");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
gEngine[playerid] = 1;
engineOn[pveh] = 1;
format(string, sizeof(string), "%s starts the car's engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else if(gEngine[playerid] == 1)
{
SCM(playerid, COLOR_PINK, "Car engine stopped.");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(pveh, 0, lights, alarm, doors, bonnet, boot, objective);
gEngine[playerid] = 0;
engineOn[pveh] = 0;
format(string, sizeof(string), "%s stops the car's engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else
{
SCM(playerid, COLOR_CREAM, "You cannot start the engine as passenger.");
return 1;
}
}
else
{
SCM(playerid, COLOR_CREAM, "You are not in a vehicle.");
return 1;
}
}
}