09.11.2012, 18:12
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;
}