SA-MP Forums Archive
[HELP]Killstreak Timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Killstreak Timer (/showthread.php?tid=255723)



[HELP]Killstreak Timer - PCheriyan007 - 17.05.2011

Hi all, I am trying to make a double-kill/triple-kill/etc. system. I am wondering how to make it so that if a player kills another player it would start a timer and if a player gets a kill within the time (5 seconds) the timer will reset and it will add to the players 'killstreak'. If the killstreak is 2 it will say double-kill and if the streak is 3 it will say triple-kill and anything after that it will say rampage. Once the timer ends the killstreak is set back to '0'.


Re: [HELP]Killstreak Timer - Backwardsman97 - 17.05.2011

You'd be better off with using ticks than a timer. Just create two variables or use PVar's. One to keep up with their killstreak, and one to keep up with the ticks.


Re: [HELP]Killstreak Timer - PCheriyan007 - 17.05.2011

I'm not very familiar with how to use ticks. Could you give me an example?


Re: [HELP]Killstreak Timer - Backwardsman97 - 17.05.2011

Try this out.

http://pastebin.com/Ug7YMcSy

It uses no timers but the player's killstreak only gets updated when he kills someone. So, if he's on a killstreak of 3, for example, it won't get set to 0 until he kills someone. It's useful for displaying their current killstreak but not like constantly displaying it.


Re: [HELP]Killstreak Timer - PCheriyan007 - 18.05.2011

I'm wondering how I would make it so that if a player gets 2 kills for example it would send a message saying double kill and if 3 triple kill and anything above 3 it would say rampage.


Re: [HELP]Killstreak Timer - Backwardsman97 - 18.05.2011

In this block, just add in whatever killstreaks you want to send messages.

pawn Код:
if((tick - pTicks[killerid]) < 5000)//Gotta play with that number
{
    pKillStreak[killerid]++;
    pTicks[killerid] = tick;
        if(pKillStreak[killerid] == 2)
        {
             //Send message
        }
    return 1;
}