SA-MP Forums Archive
[Tutorial] How to create a Killing Spree system. Best for TDM/DM servers. - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to create a Killing Spree system. Best for TDM/DM servers. (/showthread.php?tid=453182)



How to create a Killing Spree system. Best for TDM/DM servers. - ThePhenix - 24.07.2013

[CENTER]Killing Spree system


Hello.
I'm going to explain how to create a Killing Spree system for TDM/DM servers.
Let's start.

PHP Code:
#include <a_samp>
new Spree[MAX_PLAYERS];
#define COLOR_NAVY 0x10F441AA
#define COLOR_GREEN 0x33AA33AA
public OnPlayerDeath(playeridkilleridreason)
{
    
Spree[playerid] = 0;
    new 
string[100];
    if(
killerid != INVALID_PLAYER_ID)//to avoid a server crash
    
{
        
Spree[killerid]++;
        if(
Spree[killerid] == 10)//Checking for 10 kills
        
{
            
format(stringsizeof(string), "%s is on a killing spree of %d kills. Junior Killer!"Name(killerid), Spree[killerid]);
            
SendClientMessageToAll(COLOR_NAVYstring);
            
SendClientMessage(killeridCOLOR_GREEN"You are on a killing spree of 10 kills. +2 score");
            
GivePlayerScore(killerid2);
        }
        else if(
Spree[killerid] == 20)//For 20 kills
        
{
             
format(stringsizeof(string), "%s is on a killing spree of %d kills. Senior Killer!"Name(killerid), Spree[killerid]);
            
SendClientMessageToAll(COLOR_NAVYstring);
             
SendClientMessage(killeridCOLOR_GREEN"You are on a killing spree of 20 kills. +4 score");
             
GivePlayerScore(killerid4);
        }
        else if(
Spree[killerid] == 30)//30 kills
        
{
             
format(stringsizeof(string), "%s is on a killing spree of %d kills. Master Killer!"Name(killerid), Spree[killerid]);
             
SendClientMessageToAll(COLOR_NAVYstring);
               
SendClientMessage(killeridCOLOR_GREEN"You are on a killing spree of 30 kills. +6 score");
               
GivePlayerScore(killerid6);
        }
        else if(
Spree[killerid] == 40)//40 kills
        
{
             
format(stringsizeof(string), "%s is on a killing spree of %d kills. General Killer!"Name(killerid), Spree[killerid]);
            
SendClientMessageToAll(COLOR_NAVYstring);
            
SendClientMessage(killeridCOLOR_GREEN"You are on a killing spree of 40 kills. +8 score");
            
GivePlayerScore(killerid8);
        }
        else if(
Spree[killerid] == 50)//50 kills
        
{
             
format(stringsizeof(string), "%s is on a killing spree of %d kills. Insane Killer!"Name(killerid), Spree[killerid]);
            
SendClientMessageToAll(COLOR_NAVYstring);
            
SendClientMessage(killeridCOLOR_GREEN"You are on a killing spree of 50 kills. +10 score");
            
GivePlayerScore(killerid10);
        }
        else if(
Spree[killerid] == 60)//60 kills
        
{
             
format(stringsizeof(string), "%s is on a killing spree of %d kills. God Killer!"Name(killerid), Spree[killerid]);
            
SendClientMessageToAll(COLOR_NAVYstring);
            
SendClientMessage(killeridCOLOR_GREEN"You are on a killing spree of 60 kills. +12 score");
            
GivePlayerScore(killerid12);
        }
    }
    return 
1;
}
stock Name(playerid)
{
    new 
name[24];
    
GetPlayerName(playeridname24);
    return 
name;
}
stock GivePlayerScore(playeridscore)
{
    
SetPlayerScore(playeridGetPlayerScore(playerid)+score);
    return 
1;




Re: How to create a Killing Spree system. Best for TDM/DM servers. - kartik - 24.07.2013

nice thing !


Re: How to create a Killing Spree system. Best for TDM/DM servers. - qazwsx - 25.07.2013

Nice one bro


Re: How to create a Killing Spree system. Best for TDM/DM servers. - nrg700 - 30.07.2013

Nice I Like it


Re: How to create a Killing Spree system. Best for TDM/DM servers. - Calvingreen17 - 06.08.2013

Due to this, I made a nuke system thanks dude


Re: How to create a Killing Spree system. Best for TDM/DM servers. - Konstantinos - 06.08.2013

Good, but check whether the killerid is valid player or not. It can cause crashes:
pawn Code:
Spree[killerid]++;
Let's say, you die by falling. The killerid will be INVALID_PLAYER_ID (65535) and that's out of bounds.

The same goes for the rest if statements.


Re: How to create a Killing Spree system. Best for TDM/DM servers. - VenomMancer - 07.03.2014

Thnaks


Re: How to create a Killing Spree system. Best for TDM/DM servers. - CrazyFrenzy - 07.03.2014

There's an easy way to do so by using a modulo operator.
PHP Code:
if(Spree[killerid] % 10 == 0)
{
// Action