AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find highest number, and announce to players (https://forums.alliedmods.net/showthread.php?t=12712)

Cronck 04-22-2005 12:05

Find highest number, and announce to players
 
This script is supposed to find the highest number in iPlayerDamage[id][7]
7 is contains the total amount of damage the player has done the current round. id is the player id.

Whats wrong with it? And im sure there is a better way of making this... :?

Code:
public eventEndRound() {     new player[31]     new hits[3]     new damage[3] = (0,0,0)         for (new i = 0; i >= 32; i++) {         if ( iPlayerDamage[i][5] > damage[3] ) {             get_user_info(i, "name", player, 31)             damage[1] = iPlayerDamage[i]             hits[1] = iPlayerDamage[7]         }     }     set_hudmessage(0, 200, 200, 0.60, 0.35, 0, 0.1, 5.0, 0.3, 0.3, 4)     show_hudmessage(0,"Most damage was done^nby %s ^n %i dmg / %i hits", player, damage[1], hits[1])        return PLUGIN_CONTINUE }

XxAvalanchexX 04-22-2005 14:12

Code:
public eventEndRound() {     new bestPlayer, mostDamage;     new players[32], num, i;     get_players(players,num);     for(i=0;i<num;i++) {         new player = players[i];         if(iPlayerDamage[player][7] > mostDamage) {             bestPlayer = player;             mostDamage = iPlayerDamage[player][7];         }     }     // bestPlayer is the index of the player with the most damage     // mostDamage is the damage that he did }

Cronck 04-25-2005 04:59

Thank you!
I didn't notice ur reply before now...


All times are GMT -4. The time now is 10:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.