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

[REQUEST] Custom MVP Anthem From CS:GO For 1.6


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anasafridi2
Junior Member
Join Date: Mar 2018
Old 08-16-2019 , 05:08   [REQUEST] Custom MVP Anthem From CS:GO For 1.6
Reply With Quote #1

Hi guys,
Maybe some of you have played csgo or have seen this thread: https://forums.alliedmods.net/showthread.php?p=2514835
Plugin like player choose sounds from list, and when round ends it plays best player chosen music.
But the best player must have ADMIN_LEVEL_G or music won't play for normal players if they kill most player / become mvp.
I just edited the code so it only show mvp for players who have the flag ADMIN_LEVEL_G
Thank you <3



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

new g_iKills[33],
    g_iHS[33],
    Float:g_fDmg[33]  

public plugin_init()  
{  
    register_plugin("Player of the Round", "1.0", "OciXCrom")  
    RegisterHam(Ham_TakeDamage, "player", "OnTakeDamage")  
    register_event("DeathMsg", "OnPlayerKilled", "a")  
    register_logevent("OnRoundEnd", 2, "1=Round_End")  
}  

public client_disconnect(id)  
{  
    g_iKills[id] = 0 
    g_iHS[id] = 0
    g_fDmg[id] = 0.0
}

public OnTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)  
{  
    if(is_user_connected(iAttacker) && iAttacker != iVictim && is_user_connected(iVictim))
    {
        if(cs_get_user_team(iAttacker) != cs_get_user_team(iVictim))  
            g_fDmg[iAttacker] += fDamage
        else
            g_fDmg[iAttacker] -= fDamage
    }
}

public OnPlayerKilled()
{  
    
    new iAttacker = read_data(1), iVictim = read_data(2)  
      
    if(get_user_flags(iAttacker) & ADMIN_LEVEL_G)
    {
    	
    if(is_user_connected(iAttacker) && iAttacker != iVictim && is_user_connected(iVictim))
    {
        if(cs_get_user_team(iAttacker) != cs_get_user_team(iVictim))
        {
            g_iKills[iAttacker]++
            
            if(read_data(3))
                g_iHS[iAttacker]++
        }
        else
        {
            g_iKills[iAttacker]--
            
            if(read_data(3))
                g_iHS[iAttacker]--
        }
    }
   }
}

public OnRoundEnd()
{
    new id = get_best_player()
    
    if(id == -1)
        return
        
    new szName[32]  
    get_user_name(id, szName, charsmax(szName)) 

    set_hudmessage(.holdtime = 5.0)
    show_hudmessage(0, "The best player of the round is %s with %i kills (%i HS | %.1f Damage)", szName, g_iKills[id], g_iHS[id], g_fDmg[id])
    
    //set_hudmessage(0, 255, 212, -1.0, 0.31, 0, 6.0, 12.0)
    //show_hudmessage(id, " The best player of the round is %s with %i kills ^n(%i HS | %.1f Damage)", szName, g_iKills[id], g_iHS[id], g_fDmg[id])
    
    arrayset(g_iKills, 0, sizeof(g_iKills))
    arrayset(g_iHS, 0, sizeof(g_iHS))
    
    for(new i; i < sizeof(g_fDmg); i++)
        g_fDmg[i] = 0.0
}

get_best_player()
{
    new iPlayers[32], iPnum, id
    get_players(iPlayers, iPnum)
    
    for(new i, iPlayer; i < iPnum; i++)
    {
        iPlayer = iPlayers[i]
        
        if(g_iKills[iPlayer] > g_iKills[id])
            id = iPlayer
        else if(g_iKills[iPlayer] == g_iKills[id])
        {
            if(g_fDmg[iPlayer] > g_fDmg[id])
                id = iPlayer
        }
    }
    
    return g_iKills[id] ? id : -1
}
anasafridi2 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 19:46.


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