Raised This Month: $ Target: $400
 0% 

[HELP] Best Player of the Round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
extream87
Senior Member
Join Date: Aug 2011
Old 12-12-2013 , 09:16   [HELP] Best Player of the Round
Reply With Quote #1

What is wrong with this code?
When the round ends only appears: Best Player: nothing more

Code:
#include <amxmodx> #include <cstrike> #define PLUGIN "Best Player" #define VERSION "1.0" #define AUTHOR "pauSe" #define IsPlayer(%1)    (1 <= %1 <= gMaxPlayers) new gKills[33] new gMaxPlayers public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_logevent("RoundStart", 2, "1=Round_Start")     register_logevent("RoundEnd", 2, "1=Round_End")         register_event("DeathMsg", "FwdDeathMsgEvent", "a")         gMaxPlayers = get_maxplayers() } public client_connect(id)     gKills[id] = 0     public DeathMsg() {     new attacker = read_data(1)     new victim = read_data(2)         if(attacker != victim && cs_get_user_team(attacker) != cs_get_user_team(victim) && IsPlayer(attacker))         gKills[attacker]++ } public RoundStart()     arrayset(gKills, 0, 33) public RoundEnd() {     new name[34]     new bestplayer, bestscore         for(new i; i < sizeof(gKills); i++)     {         if(gKills[i] > bestscore)         {             bestplayer = i             bestscore = gKills[i]         }     }         get_user_name(bestplayer, name, 33)         set_hudmessage(255, 0, 0, -1.0, 0.01)     show_hudmessage(0, "Best Player: %s ^nKills: %i", name, bestscore) }
extream87 is offline
Old 12-12-2013, 09:19
MangekyouSharingan
This message has been deleted by YamiKaitou. Reason: Spam
Don_Collione
BANNED
Join Date: Dec 2012
Location: Stockholm
Old 12-15-2013 , 01:48   Re: [HELP] Best Player of the Round
Reply With Quote #3

PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <hamsandwich> 
#include <cstrike> 
 
#define PLUGIN    "Best Player" 
#define AUTHOR    "STK | kHRYSTER" 
#define VERSION    "1.0" 
 
new g_iKills[32], g_iDmg[32
 
public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""hamTakeDamage"
    
register_event("DeathMsg""EventDeathMsg""a"
    
register_logevent("RoundEnd"2"1=Round_End"

 
public 
client_disconnect(id

    
g_iDmg[id] = 0
    
g_iKills[id] = 0
}
public 
hamTakeDamage(victiminflictorattackerFloat:damageDamageBits

    if( 
<= attacker <= 32
    { 
        if(
cs_get_user_team(victim) != cs_get_user_team(attacker)) 
            
g_iDmg[attacker] += floatround(damage
        else 
            
g_iDmg[attacker] -= floatround(damage
    } 

 
public 
EventDeathMsg() 

    new 
killer read_data(1
    new 
victim read_data(2
 
    if(
killer != victim && killer && cs_get_user_team(killer) != cs_get_user_team(victim)) 
    { 
        
g_iKills[killer]++; 
    } 
    else 
        
g_iKills[killer]--; 

 
public 
RoundEnd() 

    new 
iBestPlayer get_best_player() 
    new 
szName[32
    
get_user_name(iBestPlayerszNamecharsmax(szName)) 
 
    
set_hudmessage(25500, -1.0, -1.0)
    
show_hudmessage(0"Best Player: %s Kills: %i"szNameg_iKills[iBestPlayer])
 
    for(new 
i31i++) 
    { 
        
g_iDmg[i] = 0
        
g_iKills[i] = 0
    } 

 
get_best_player() 

    new 
players[32], num
    
get_players(playersnum); 
    
SortCustom1D(playersnum"sort_bestplayer"
    return 
players[0

 
public 
sort_bestplayer(id1id2

    if(
g_iKills[id1] > g_iKills[id2]) 
        return -
1
    else if(
g_iKills[id1] < g_iKills[id2]) 
        return 
1
    else 
    { 
        if(
g_iDmg[id1] > g_iDmg[id2]) 
            return -
1
        else if(
g_iDmg[id1] < g_iDmg[id2]) 
            return 
1
        else 
            return 
0
    } 
    return 
0


Last edited by Don_Collione; 12-15-2013 at 01:49.
Don_Collione is offline
Reply



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 20:32.


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