25.11.2012, 08:43
Can someone make CMD /top10, it show top 10 killers simple:
1. Nickname [Kills]
2. Nicknamee [Kills]
1. Nickname [Kills]
2. Nicknamee [Kills]
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/top", true) == 0) {
new
string[ 128 ], First_Killer = -1, Second_Killer = -1, Third_Killer = -1, Fourth_Killer = -1, HighestKills = -9999;
foreach(Player, x )
if( PlayerInfo[ x ][ Kills ] >= HighestKills ) {
HighestKills = PlayerInfo[ x ][ Kills ];
First_Killer = x;
}
HighestKills = -9999;
for( new x = 0; x < MAX_PLAYERS; x ++ )
if( IsPlayerConnected( x ) && x != First_Killer )
if( PlayerInfo[ x ][ Kills ] >= HighestKills ) {
HighestKills = PlayerInfo[ x ][ Kills ];
Second_Killer = x;
}
HighestKills = -9999;
for( new x = 0; x < MAX_PLAYERS; x ++ )
if( IsPlayerConnected( x ) && x != First_Killer && x != Second_Killer )
if( PlayerInfo[ x ][ Kills ] >= HighestKills ) {
HighestKills = PlayerInfo[ x ][ Kills ];
Third_Killer = x;
}
HighestKills = -9999;
for( new x = 0; x < MAX_PLAYERS; x ++ )
if( IsPlayerConnected( x ) && x != First_Killer && x != Second_Killer && x != Third_Killer )
if( PlayerInfo[ x ][ Kills ] >= HighestKills ) {
HighestKills = PlayerInfo[ x ][ Kills ];
Fourth_Killer = x;
}
format( string, sizeof( string ), "Player %s (%d) - %d Kills", GetName(First_Killer ), First_Killer, PlayerInfo[ First_Killer ][ Kills ] );
SendClientMessage( playerid, -1, string );
if( Second_Killer != -1) {
format( string, sizeof( string ), "Player %s (%d) - %d Kills", GetName(Second_Killer ), Second_Killer, PlayerInfo[ Second_Killer ][ Kills ] );
SendClientMessage( playerid, -1, string );
}
if( Third_Killer != -1) {
format( string, sizeof( string ), "Player %s (%d) - %d Kills", GetName(Third_Killer ), Third_Killer, PlayerInfo[ Third_Killer ][ Kills ] );
SendClientMessage( playerid, -1, string );
}
if( Fourth_Killer != -1) {
format( string, sizeof( string ), "Player %s (%d) - %d Kills", GetName(Fourth_Killer ), Fourth_Killer, PlayerInfo[ Fourth_Killer ][ Kills ] );
SendClientMessage( playerid, -1, string );
}
return 1;
}
return 0;
}
GetName( playerid )
{
new Name[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, Name, sizeof( Name ) );
return Name;
}
#include <foreach>