Raised This Month: $ Target: $400
 0% 

Find highest number, and announce to players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cronck
Member
Join Date: Apr 2005
Old 04-22-2005 , 12:05   Find highest number, and announce to players
Reply With Quote #1

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 }
Cronck is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-22-2005 , 14:12  
Reply With Quote #2

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 }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Cronck
Member
Join Date: Apr 2005
Old 04-25-2005 , 04:59  
Reply With Quote #3

Thank you!
I didn't notice ur reply before now...
Cronck is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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