24.04.2012, 06:34
I have created a cmd /motor and when the player types 1 time /motor the engine starts, and when the player types again to stop the vehicle now isn't working my script why ?
pawn Код:
if(strcmp("/motor",cmdtext,true,10) == 0)
{
if(IsPlayerConnected(playerid))
{
if(Motor[playerid] == 0)
{
GetPlayerNameEx(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s go startuva motorot.", sendername);
ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOUR_INFORMATION, "INFO:Go Startuvavte Motorot.");
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), ON, lights, alarm, doors, bonnet, boot, objective);
}
else if(Motor[playerid] == 1)
{
format(string, sizeof(string), "* %s go gasi motorot.", sendername);
ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOUR_INFORMATION, "INFO:Go Izgasivte Motorot.");
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), OFF, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}