View Single Post
Author Message
mentalproblems
Junior Member
Join Date: Mar 2019
Old 11-06-2019 , 14:26   Best CT & T of the round. [BAD LOAD], help.
Reply With Quote #1

Can anyone tell me why is this not running. Appears "bad load" in amx_plugins.
Thanks.

Code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <reapi>

new Float:g_fDamagect[33], g_iBestCtIndexFloat:g_fDamagete[33], g_iBestTeIndex

new szNameCt[32], szNameTe[32]

public 
plugin_init() {
    
register_plugin("Best CT & T""1.0""blabla")
    
    
RegisterHam(Ham_TakeDamage"player""Fw_TakeDamage_Post"1)
    
register_logevent("RoundEnd"2"1=Round_End")
    
register_logevent("RoundStart"2"1=Round_Start")
    
    
register_clcmd("say /best""ShowBest")
}

public 
Fw_TakeDamage_Post(iVictimiInflictoriAttackerFloat:fDamagebitsDamageType)
{
    if (!
is_user_alive(iVictim) || !is_user_alive(iAttacker) || get_user_team(iVictim) != get_user_team(iAttacker))
        return 
HAM_IGNORED
    
    g_fDamagect
[iAttacker] += fDamage
    g_fDamagete
[iAttacker] += fDamage
    
return HAM_HANDLED
}

public 
RoundEnd()
{
    
Get_Best_CT()
    
Get_Best_T()
    
    
get_user_name(g_iBestCtIndexszNameCtcharsmax(g_iBestCtIndex))
    
get_user_name(g_iBestTeIndexszNameTecharsmax(g_iBestTeIndex))
    
    if (
g_iBestCtIndex == || g_fDamagect[g_iBestCtIndex] == 0.0)
        
client_print(0print_chat"[Best Player] No best Counter-Terrorist this round.")
    
    if (
g_iBestTeIndex == || g_fDamagete[g_iBestTeIndex] == 0.0)
        
client_print(0print_chat"[Best Player] No best Terrorist this round.")
    
    
set_hudmessage(02550, -1.00.2306.05.0)
    
show_hudmessage(0"Best Counter Terrorist was [ %s ] with [ %i ] damage^n^nBest Terrorist was [ %s ] with [ %i ] damage"szNameCtfloatround(g_fDamagect[g_iBestCtIndex]), szNameTefloatround(g_fDamagete[g_iBestTeIndex]))
}

public 
ShowBest(id)
{
    
Get_Best_CT()
    
Get_Best_T()
    
    
get_user_name(g_iBestCtIndexszNameCtcharsmax(szNameCt)) // defender name
    
get_user_name(g_iBestTeIndexszNameTecharsmax(szNameTe)) // infector name
    
    
set_hudmessage(02550, -1.00.2306.05.0)
    
show_hudmessage(id"Best Counter Terrorist is [ %s ] with [ %i ] damage^n^nBest Terrorist is [ %s ] with [ %i ] damage"szNameCtfloatround(g_fDamagect[g_iBestCtIndex]), szNameTefloatround(g_fDamagete[g_iBestTeIndex]))
}

public 
RoundStart() // new round
{
    
set_task(3.0"ResetDmg")
}

public 
ResetDmg() // reset Damage and Infects at new round start
{
    for (new 
1<= get_member_game(m_nMaxPlayers); i++)
    {
        
g_fDamagect[i] = 0.0 // Reset Damage
        
g_fDamagete[i] = 0.0 // Reset Infects
    
}
}

public 
Get_Best_CT()
{
    new 
Float:fTemp 0.0
    
    
for (new 1<= get_member_game(m_nMaxPlayers); i++)
    {
        if (!
is_user_connected(i))
            continue
        
        if (
g_fDamagect[i] > fTemp)
        {
            
fTemp g_fDamagect[i]
            
g_iBestCtIndex i
        
}
    }
}

public 
Get_Best_T()
{
    new 
Float:fTempp 0.0
    
    
for (new 1<= get_member_game(m_nMaxPlayers); i++)
    {
        if (!
is_user_connected(i))
            continue
        
        if (
g_fDamagete[i] > fTempp)
        {
            
fTempp g_fDamagete[i]
            
g_iBestTeIndex i
        
}
    }


Last edited by mentalproblems; 11-06-2019 at 14:31.
mentalproblems is offline