06.12.2010, 18:22
Hi all, i have create a simple DM Gamemode, and 1 Kill add in a Stats a Var_Kill...
How i can made Function "BestKiller" of match?
Thanks.
How i can made Function "BestKiller" of match?
Thanks.
Anyways, run a loop through all players, and find a player with highest kills according to your saving system. |
//----//Rank Stuff//----// enum pinfo { MinutesPlayed, HoursPlayed, Kills, Visits, Rank, SaveStats, } new PInfo[MAX_PLAYERS][pinfo];
//----//Requierments//----// enum rinfo { RName[64], RRequirement, RStartMoney, Float:RSpawnHealth, Float:RSpawnArmour, RSpawnWeapon, RSpawnAmmo, }; new RankInfo[MAX_RANKS][rinfo];
AddRank(rankID, const Name[], Requirement, Startmoney, Float:SpawnHealth, Float:SpawnArmour, SpawnWeapon, SpawnAmmo);
new Kills[MAX_PLAYERS], KillsOn;
if(strcmp("/startkillcount", cmdtext, true) == 0) { if(IsPlayerAdmin(playerid) == 0) return 0; KillsOn = 1; return 1; } if(strcmp("/endkillcount", cmdtext, true) == 0) { if(IsPlayerAdmin(playerid) == 0) return 0; KillsOf = 0; GetMaxKills(); return 1; }
if(KillsOn = 1) { Kills[playerid]++; }
[GetMaxKills() { new killerid; for(new a = 0; a < MAX_PLAYERS; a++) { for(new b = 0; b < MAX_PLAYERS; b++) { if(Kills[a] > Kills[b]) { killerid = a; } } } new string[128]; format(string, sizeof(string), "ID %d was the winner", killerid); SendClientMessageToAll(0xFFFFFFFF, string); }