AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   statistics: most damages (https://forums.alliedmods.net/showthread.php?t=144386)

Jacob 12-03-2010 04:36

statistics: most damages
 
how to get the name of the player who has made the most damages at the end of round.

Exolent[jNr] 12-03-2010 16:22

Re: statistics: most damages
 
Use a global player array that is a float.
Hook Ham_TakeDamage as post and get damage done from the victim's pev_dmg_take value, and add that value to the attacker's array value.
Hook round end and iterate through the array til you find the most damage, then display that player.
Also in the round end hook, reset the global array to 0.

Jacob 12-03-2010 20:39

Re: statistics: most damages
 
Quote:

Originally Posted by Exolent[jNr] (Post 1362280)
Use a global player array that is a float.
Hook Ham_TakeDamage as post and get damage done from the victim's pev_dmg_take value, and add that value to the attacker's array value.
Hook round end and iterate through the array til you find the most damage, then display that player.
Also in the round end hook, reset the global array to 0.

it's hard for me to understand very well.is it the same method as bellow?
PHP Code:

  new players[32], pnumstats[8],bodyhits[8]
  
get_playersplayers pnum
  new 
damage 0hits 0who 0
  
  
for(new 0pnum; ++i)
  {
   
get_user_rstatsplayers[i],statsbodyhits )
   if ( 
stats[6] > damage )
   {
    
who players[i]
    
hits stats[5]
    
damage stats[6]
   }  
  }
  if ( 
is_user_connected(who) )
  {
   new 
name[32]
   
get_user_namewhonamecharsmax(name))
   
format(msgcharsmax(msg) ,"Most damages in this round: %s^n%d Hits/%d Damades"name hits damage)
  } 


Exolent[jNr] 12-03-2010 22:17

Re: statistics: most damages
 
Yea that works too.


All times are GMT -4. The time now is 11:19.

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