23.05.2012, 17:07
It's best to use a timer for that (SetTimerEx("Killplayer", 1000, 0, "i", playerid))
pawn Код:
new Killcount[MAX_PLAYERS];
pawn Код:
if(!strcmp("/kill", cmdtext, true))
{
Killcount[playerid] = 10; // 10 seconds
SetTimerEx("KillPlayer", 1000, 0, "i", playerid); //Check every second for Killcount.
new str[10]; format(str, 10, "%d...", Killcount[playerid]);
SendClientMessage(playerid, -1, str);
return 1;
}
pawn Код:
forward KillPlayer(playerid);
public KillPlayer(playerid)
{
switch(Killcount[playerid])
{
case 0: return SetPlayerHealth(playerid, 0.0);
default:
{
SetTimerEx("KillPlayer", 1000, 0, "i", playerid);
new str[10]; format(str, 10, "%d...", Killcount[playerid]);
Killcount[playerid] -= 1;
SendClientMessage(playerid, -1, str);
}
}
}