SA-MP Forums Archive
Spree help - 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)
+--- Thread: Spree help (/showthread.php?tid=620492)



Spree help - Hunud - 30.10.2016

Hi

I was thinking about is possible make when i make example 10 spree it will show i nstats High spree ever: 10 ?

How to make this and is possible ? +rep if helped


Re: Spree help - Gazzy - 30.10.2016

Use a variable and add 1 to it every time a player kills another player. Display that variable in /stats. More information can be found in this link.

PHP код:
new PlayerKillCount[MAX_PLAYERS];
new 
HighestKillCount[MAX_PLAYERS];
 
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
killerid != INVALID_PLAYER_ID)
    {
        
PlayerKillCount[killerid] ++;
    }
    if(
PlayerKillCount[killerid] > HighestKillCount[killerid])
    {
        
HighestKillCount[killerid] = PlayerKillCount[killerid];
    }
    return 
1;

PHP код:
new string[256];
if(
PlayerKillCount[playerid] >= 10)
{
    
format(stringsizeof(string), "Current kill spree: %d"PlayerKillCount[playerid]);
    
format(stringsizeof(string), "Highest kill spree: %d"HighestKillCount[playerid]);

This is just a rough example of the system you describe but it can easily be modified. You would also need to utilise a saving system for individual players to save their highest kill count.


Re: Spree help - Hunud - 30.10.2016

Ok thanks for helping i will try +rep for you


Re: Spree help - Gazzy - 30.10.2016

Appreciated, feel free to PM me if you need any more help


Re: Spree help - AndySedeyn - 30.10.2016

Quote:
Originally Posted by Gazzy
Посмотреть сообщение
-
Don't forget to reset the current killing spree of playerid in OnPlayerDeath.


Re: Spree help - Konstantinos - 30.10.2016

The second if statement will cause run time error 4 if a player dies on their own. It should be inside the (killerid != INVALID_PLAYER_ID) check to prevent this.