Thread: [Solved] Need Awp Cvar Per Team Limit
View Single Post
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 08-24-2022 , 11:03   Re: Need Awp Cvar Per Team Limit
Reply With Quote #2

Credits: OciXCrom
PHP Code:
#include <amxmodx>
#include <cstrike>

#if !defined CSI_AWP
    #error "This plugin requires AMXX 1.9 or a newer version."
#endif

const MAX_AWPS_PER_TEAM 3

new g_iAWPCount[CsTeams]

public 
plugin_init()
{
    
register_plugin("Max AWPs Per Team""1.0""OciXCrom")
    
register_logevent("OnRoundStart"2"0=World triggered""1=Round_Start")
}

public 
OnRoundStart()
{
    
g_iAWPCount[CS_TEAM_CT] = 0
    g_iAWPCount
[CS_TEAM_T] = 0
}

public 
CS_OnBuy(idiItem)
{
    if(
iItem == CSI_AWP)
    {
        new 
CsTeams:iTeam cs_get_user_team(id)

        if(
g_iAWPCount[iTeam] == MAX_AWPS_PER_TEAM)
        {
            
client_print(idprint_center"Your team cannot purchase more than %i AWPs per round."MAX_AWPS_PER_TEAM)
            return 
PLUGIN_HANDLED
        
}

        
g_iAWPCount[iTeam]++
    }

    return 
PLUGIN_CONTINUE

It's not a proper plugin, like... it won't count if the alive players already have an awp from the last round so the amount of awps will never really be the amount you set it to because if the 2 or 3 awpers survive all together then the next round another 2 or 3 awps can be bought, and there's no cvar for setting it like you want mid-game... let me know if you want it updated.
__________________

Last edited by deprale; 08-24-2022 at 11:10.
deprale is offline