SA-MP Forums Archive
Duel System? - 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: Duel System? (/showthread.php?tid=391139)



Duel System? - Shannkz - 09.11.2012

I got an duel system, but I kinda wanna make a /top command for it.
Like when you type /top it shows the best 3 duelers like 1.Shannkz (10 KILLS, 3 DEATHS)
2.Charizard (9 KILLS, 4 DEATHS)
3.Chuck (11 KILLS, 10 DEATHS)


Any ideea how to make it?


Re: Duel System? - Alex Magaсa - 09.11.2012

PHP код:
#include <sscanf2>
#include <zcmd>
#define DIALOG_TOP 1
OnPlayerCommand...
CMD:top(playerid,params[])
{
ShowPlayerDialog(playeridDIALOG_TOPDIALOG_STYLE_MSGBOX"Duel Top Members""User: %s Kills: %d Deaths: %d""Close""");
return 
1;




Re: Duel System? - Shannkz - 09.11.2012

I mean like only the Duel Kills and only the Duel Deaths.


Re: Duel System? - Konstantinos - 09.11.2012

pawn Код:
// Global Variables
new
    Duel_Kills[ MAX_PLAYERS ],
    Duel_Deaths[ MAX_PLAYERS ],
    Duel_Active
;

// On the duel system
Duel_Active = 1;


public OnPlayerConnect( playerid )
{
    Duel_Kills[ playerid ] = 0;
    Duel_Deaths[ playerid ] = 0;
    return 1;
}

public OnPlayerDisconnect( playerid, reason )
{
    Duel_Kills[ playerid ] = 0;
    Duel_Deaths[ playerid ] = 0;
    return 1;
}

public OnPlayerDeath( playerid, killerid, reason )
{
    if( Duel_Active == 1 )
    {
        Duel_Kills[ killerid ]++;
        Duel_Deaths[ playerid ]++;
    }
    return 1;
}

CMD:top( playerid, params[ ] )
{
    new
        x = 0,
        y = 0,
        kname[ MAX_PLAYER_NAME ],
        dname[ MAX_PLAYER_NAME ],
        msg[ 128 ]
    ;
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( Duel_Kills[ i ] > x )
        {
            x = Duel_Kills[ i ];
            GetPlayerName( i, kname, MAX_PLAYER_NAME );
        }
        if( Duel_Deaths[ i ] > y )
        {
            y = Duel_Deaths[ i ];
            GetPlayerName( i, dname, MAX_PLAYER_NAME );
        }
    }
    format( msg, 128, "Top Killer: %s with % kills! - Top Noob (Deaths): %s with %d deaths!", kname, x, dname, y );
    SendClientMessage( playerid, -1, msg );
    return 1;
}