Duel System?
#1

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?
Reply
#2

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;

Reply
#3

I mean like only the Duel Kills and only the Duel Deaths.
Reply
#4

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)