24.11.2012, 19:40
Whats the difference between SetTimer and SetTimerEx? And what does the format letter mean (which would I use)?
The reason I am asking is because I am having problems with the timer bellow, it starts fine, but I can't get it to stop. What should I do or fix:
The reason I am asking is because I am having problems with the timer bellow, it starts fine, but I can't get it to stop. What should I do or fix:
pawn Код:
new DetectorTimer[MAX_PLAYERS];
new DetectorOn[MAX_PLAYERS]=1;
if (strcmp("/detectoron", cmdtext, true, 11) == 0)
{
if(PlayerInfo[playerid][pDetector])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(DetectorTimer[playerid] != -1) KillTimer(DetectorTimer[playerid]);//
DetectorTimer[playerid] = SetTimerEx("RunDetector", 2000, true, "i", playerid);
SendClientMessage(playerid,-1,"Detector On");
DetectorOn[playerid]=1;
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "** You aren't in a vehicle!");
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "** You don't have a Radar Detector!");
return 1;
}
if (strcmp("/detectoroff", cmdtext, true, 12) == 0)
{
if(PlayerInfo[playerid][pDetector])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(DetectorOn[playerid]==0)return SendClientMessage(playerid,-1,"Detector Already OFF");
SendClientMessage(playerid,-1,"Detector OFF");
KillTimer(DetectorTimer[playerid]);
DetectorOn[playerid]=0;
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "** You aren't in a vehicle!");
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "** You don't have a Radar Detector!");
return 1;
}