06.04.2012, 08:07
Hello, the count function checks if players are near the guy who started the count if they are near the count starts, problem is if a guys is near me and i start to count it counts like this, 5 , 3, 1, GO. I tried alone and it worked good.
pawn Код:
public Count(playerid){
if(!IsCountActive){
KillTimer(CountTimer);
}else{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
foreach(Player, i){
if(IsPlayerInRangeOfPoint(i, 30, x, y, z)){
new string[4];
format(string,sizeof(string),"%i",CountAmmount);
GameTextForPlayer(i,string,1000,3);
CountAmmount--;
if(CountAmmount == -1) {
IsCountActive = 0, GameTextForPlayer(i,"~g~~h~Go!",1000,3);
}
}
}
}
return 1;
}
CMD:count(playerid,params[]){
static amount;
if(sscanf(params,"i",amount)) return SendClientMessage(playerid, 0xDDDDDDFF, "[{37B7D7}USAGE{DDDDDD}]: /count [amount]");
if(IsCountActive == 1) return SendClientMessage(playerid, 0xDDDDDDFF, "[{FF0000}ERROR{DDDDDD}]: The countdown is already activated!");
if(amount > 10 || amount <= 0) return SendClientMessage(playerid, 0xDDDDDDFF, "[{FF0000}ERROR{DDDDDD}]: The amount can't be greater than 10.");
CountTimer = SetTimerEx("Count", 1000, true, "i", playerid);
CountAmmount = amount;
IsCountActive = 1;
return 1;
}