Timer don't want to stop ;D -
Daslee - 28.08.2010
Hello, i creating kills system like in counter strike server... That Ultra Kill, Monster kill, rampage and more... So: im add at the script starting this:
Код:
forward kkrows(playerid);
new taimeris;
Then on player death:
Код:
taimeris = SetTimer("kkrows",100,true);
And to add that kills to 3 i have created, then:
Код:
public kkrows(playerid)
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(PlayerI[playerid][krows]==2)
{
new msg[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(msg,sizeof(msg),"%s has made double kill!", name);
SendClientMessageToAll(BLUE,msg);
KillTimer(taimeris);
}
if(PlayerI[playerid][krows]==3)
{
new msg[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(msg,sizeof(msg),"%s has made triple kill!", name);
KillTimer(taimeris);
}
}
return 1;
}
And i have cmd: /akrows it will adds me 1 krows(PlayerI[playerid][krows]) Then when i do this cmd 2 times, server will send this: %s has made double kill! But its flooding, and doesn't stop but i added: KillTimer(taimeris); And also after player kills other player timer will starts again. But why it's doesn't stop, after:
Код:
format(msg,sizeof(msg),"%s has made triple kill!", name);
Maybe taimer = SetTimer("kkrows",100,true) will need to be not after OnPlayerDeath??
Re: Timer don't want to stop ;D -
DRIFT_HUNTER - 28.08.2010
If you want timer execute just once than try to use
pawn Код:
taimeris = SetTimer("kkrows",100,0);
Oh and i think i must be OnPlayerSpawn not OnPlayerDeath
Re: Timer don't want to stop ;D -
Daslee - 28.08.2010
I used your code, but it still flooded for 1second, but i'll deleted:
Код:
for(new i=0; i < MAX_PLAYERS; i++)
{
And now it's write just 1 time
)
Re: Timer don't want to stop ;D -
pmk1 - 28.08.2010
but hey, you should use this on your onplayerdeath callback, it would only call when someone kills someone, and if he is on a row, then it would work.... get what i mean?
Re: Timer don't want to stop ;D -
Finn - 28.08.2010
Quote:
Originally Posted by pmk1
but hey, you should use this on your onplayerdeath callback, it would only call when someone kills someone, and if he is on a row, then it would work.... get what i mean?
|
+1
Why to use a timer for such thing as announcing killing sprees?