Raised This Month: $ Target: $400
 0% 

[Get player with most kills]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-20-2010 , 17:13   Re: [Get player with most kills]
Reply With Quote #9

Use a variable to store the current highest kill number and current highest player id. Check each players kills against it and if that player had a higher kill number update that variable with his kill# and id. After the loop you will be left with highest kill number and the players id.

Something like this, with the addition of team checks, should work for you. untested.
PHP Code:
MostKills()
{
    new 
iMostKills_id iMostKills_Num iMaxPlayers get_maxplayers();
    
    for ( new 
<= iMaxPlayers i++ )
    {
        if ( 
Kills] > iMostKills_Num )
        {
            
iMostKills_Num Kills];
            
iMostKills_id i;
        }
    }
    
    if ( 
iMostKills_id )
    {
        new 
szName33 ];
        
get_user_nameiMostKills_id szName charsmaxszName ) );
        
client_printprint_chat "* %s has most kills @ %d!" szName iMostKills_Num );
    }    

__________________

Last edited by Bugsy; 08-20-2010 at 23:59.
Bugsy is offline
 



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 21:58.


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