Raised This Month: $12 Target: $400
 3% 

Is this motd code fixable?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blood2k
Senior Member
Join Date: Mar 2014
Old 12-15-2016 , 18:36   Is this motd code fixable?
Reply With Quote #1

Code:
#include <amxmodx>  
#include <hamsandwich>  

#define PLUGIN "Map End Motd"  
#define VERSION "1.0"  
#define AUTHOR "author"  

enum _:W0W  
{  
    DAMAGE,  
    HITS  
}  

new gDamage[33][W0W]  

public plugin_init()  
{  
    register_plugin(PLUGIN, VERSION, AUTHOR)  
    RegisterHam(Ham_TakeDamage, "player", "fw_Damage", 1)  
     
    register_event("TextMsg", "eReset", "a", "2&#Game_w", "2&#Game_c")  
     
    register_message(SVC_INTERMISSION, "message_INTERMISSION")  
}  

public eReset()  
{  
    for(new i; i < 33; i++)  
    {  
        gDamage[i][DAMAGE] = 0  
        gDamage[i][HITS] = 0  
    }  
}  

public client_connect(id)  
{  
    gDamage[id][DAMAGE] = 0  
    gDamage[id][HITS] = 0  
}  

public message_INTERMISSION()  
{      
    new iPlayers[32], iNum, iPlayer  
    new iHighestDamage, iWinnerId  
    get_players(iPlayers, iNum, "ch")  
     
    for(new i; i < iNum; i++)  
    {  
        if( gDamage[( iPlayer = iPlayers[i] ) ][DAMAGE] > iHighestDamage)  
        {  
            iWinnerId = iPlayer  
            iHighestDamage = gDamage[iWinnerId][DAMAGE]  
        }  
    }  
     
    new szMotd[1024]  
    new szName[32]; get_user_name(iWinnerId, szName, 31)  
     
    BuildMotd(szMotd, charsmax(szMotd), szName, iHighestDamage, gDamage[iWinnerId][HITS])  
         
    for(new i; i < iNum; i ++)  
    {  
        show_motd(iPlayers[i], szMotd, "Best player damage")  
    }  
     
    message_begin(MSG_ALL, SVC_FINALE) 
    write_string("") 
    message_end() 
     
    //client_cmd(0, "+showscores") // Showscores 
     
    return PLUGIN_HANDLED // block 
}  

public fw_Damage(iVictim, iInflictor, iAttacker, Float:flDamage, iBits)  
{  
    gDamage[iAttacker][DAMAGE] += floatround(flDamage)  
    gDamage[iAttacker][HITS]++  
}  

stock BuildMotd(szMotd[], iLen, szName[], iDamage, iHits)  
{  
    new iLeft  
     
    iLeft = formatex(szMotd, iLen, "<body bgcolor=^"#000000^">\ 
    <p align=^"center^"><font size=5; color=#FFFF00>Player</font><br>\ 
    <font size=7; color=#0033CC>.: %s :.</font><br>", szName) 
     
    iLeft += formatex(szMotd[iLeft], iLen - iLeft, "<font color = #FFB00>Made the most damage in the map with a total of<br>\ 
    <font size = 5; color = #66FFFF>%d</font><font size = 5; color = #FFFF00> Damage</font><br>\ 
    And also made<br></font><font size = 5; color = #66FFFF>%d</font><font size = 5; color = #FFFF00> Hits</font>\ 
    </p>\ 
    </body>", iDamage, iHits)  
}

it's supposed to fetch the player with most damage in the map... but I don't think it's taking the right players. It seems to pick random ratio'd players.. not the ones that have been nading/awping and causing a whole lot more damage.

Any way to improve this to show more map stats?

Most Kills
Most Deaths
Best K Ratio


or even just the top player (kill wise)
blood2k 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 14:39.


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