SA-MP Forums Archive
killing medals script - 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: killing medals script (/showthread.php?tid=251146)



killing medals script - Amine_Mejrhirrou - 25.04.2011

hi i'm searching a killing medal script or if can some one give me an idea about how to creat one
when i say killing medal is for example
1 kill = first kill
2 kills in a row = double kill
3 kills in a row = triple kill
4 kills in a row = kill tacular
4 kills in a row = killing spree
5 kills in a row = kill frenzy
6 kills in a row = kill atrocity
7 kills in a row = kill manjarow
8 kills in a row = killtastrophe
9 kills in a row = untouchable
10 kills in a row = killionaire
(halo medals lol )
hop that you understand what i mean


Re: killing medals script - Mean - 25.04.2011

Full filterscript, I just made it on my own .
I made it when you get 2 or more kills, you get spree counting, because it's stupid to put for 1 kill lol.

Just paste this into a new, blank filterscript, compile, and use.

pawn Код:
// Killing spree system by Mean
#include < a_samp >

new gPlayerKills[ MAX_PLAYERS ];

public OnPlayerConnect( playerid ) return gPlayerKills[ playerid ] = 0;

public OnPlayerDeath( playerid, killerid, reason )
{
    new string[ 70 ], name[ 24 ];
    GetPlayerName( killerid, name, 24 );
    gPlayerKills[ killerid ]++;
    gPlayerKills[ playerid ] = 0;
    if( gPlayerKills[ killerid ] == 2 ) format( string, sizeof string, "%s made a double kill! ", name );
    if( gPlayerKills[ killerid ] == 3 ) format( string, sizeof string, "%s made a triple kill! ", name );
    if( gPlayerKills[ killerid ] == 4 ) format( string, sizeof string, "%s is on a killing spree! ", name );
    if( gPlayerKills[ killerid ] == 5 ) format( string, sizeof string, "%s is a kill frenzy! ", name );
    if( gPlayerKills[ killerid ] == 6 ) format( string, sizeof string, "%s is a kill atrocity!", name );
    if( gPlayerKills[ killerid ] == 7 ) format( string, sizeof string, "%s is a kill manjarow!", name );
    if( gPlayerKills[ killerid ] == 8 ) format( string, sizeof string, "%s is a killtastrophe!", name );
    if( gPlayerKills[ killerid ] == 9 ) format( string, sizeof string, "%s is untouchable!", name );
    if( gPlayerKills[ killerid ] == 10 ) format( string, sizeof string, "%s is a killionaire!", name );
    if( gPlayerKills[ killerid ] > 10 ) format( string, sizeof string, "%s is still a killionaire! ( %d kills )", name, gPlayerKills[ killerid ] );
    // You can add more :D.
    return SendClientMessageToAll( 0xAAAAAA, string );
}

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( !strcmp( cmdtext, "/spree", true, 6 ) || !strcmp( cmdtext, "/streak", true, 7 ) )
    {
        new str[ 55 ];
        format( str, sizeof str, "You are currently on a killing spree of %d kills.", gPlayerKills[ playerid ] );
        return SendClientMessage( playerid, 0xAAAAAA, str );
    }
    return 0;
}
Easy .

EDIT: Note that it's untested, but it should work, I can't find anything wrong .


Re: killing medals script - Admigo - 25.04.2011

You can use a filterscript


Re: killing medals script - Mean - 25.04.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
You can use a filterscript
Actually, the script I posted is a filterscript o_O.


Re: killing medals script - Admigo - 25.04.2011

LOL sorry i diddnt know


Re : Re: killing medals script - Amine_Mejrhirrou - 26.04.2011

Quote:
Originally Posted by Mean
Посмотреть сообщение
Actually, the script I posted is a filterscript o_O.
i just mad one ... vrey very short one & simple tell me what you think about it pls
Код:
public OnPlayerSpawn(playerid)
{
      SetPVarInt(playerid, "kills", 0);
}
public OnPlayerDeath(playerid, killerid, reason)
{
        if(team[playerid] == 2)
	{
		SetPVarInt(killerid, "kills", GetPVarInt(killerid, "kills")+1);
		if (GetPVarInt(killerid, "kills") == 2) Audio_Play(killerid, 1, false, false, false);
		if (GetPVarInt(killerid, "kills") == 3) Audio_Play(killerid, 4, false, false, false);
		if (GetPVarInt(killerid, "kills") == 4) Audio_Play(killerid, 2, false, false, false);
		if (GetPVarInt(killerid, "kills") == 5) Audio_Play(killerid, 6, false, false, false);
		if (GetPVarInt(killerid, "kills") >= 6) Audio_Play(killerid, 7, false, false, false);
         }
}



Re: killing medals script - Lorenc_ - 26.04.2011

That should work


Re: killing medals script - Vince - 26.04.2011

Make use of the switch function, damn. I find it so ugly when people have scripts that are filled with useless if statements.


Re : Re: killing medals script - Amine_Mejrhirrou - 26.04.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
Make use of the switch function, damn. I find it so ugly when people have scripts that are filled with useless if statements.
what's the unless function in my script


Re: killing medals script - Mean - 26.04.2011

He means:
pawn Код:
switch( GetPVarInt( killerid, "kills" ) )
{
    case 2: // 2 kills
    {
        // Stuff here
    }
    case 3: // 3 kills
    {
        // stuff here
    }
    // ETC
}
Instead of
pawn Код:
if( GetPVarInt( killerid, "kills" ) == 2 )
{
    // Stuff here
}
if( GetPVarInt( killerid, "kills" ) == 3 )
{
    // Stuff here
}
// ETC
I prefer IFs, I use switch only in dialogs and stuff, since it's just abit faster.
Also, you forgot to put OnPlayerDeath
pawn Код:
SetPVarInt( playerid, "kills", 0 );
So if player dies, his spree gets restarted.

EDIT: Nevermind, you reset it in OnPlayerSpawn..