Raised This Month: $30 Target: $400
 7% 

Dispenser


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yagami
Member
Join Date: Jan 2021
Old 07-29-2022 , 08:26   Dispenser
Reply With Quote #1

How do I create a cvar where the vip player can place two dispensers?

PHP Code:
public xBuyDispenser(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_CONTINUE

    
if(!(pev(idpev_flags) & FL_ONGROUND))
    {
        
client_print_color(idprint_team_default"%s ^3Tente ficar em um chão ^1PLANO ^3para poder comprar um ^4Dispenser^3."PREFIX_CHAT)
        
client_cmd(id"spk %s"g_DispSndFail)

        return 
PLUGIN_HANDLED
    
}

    if(
g_DispPlayerCount[id] >= get_pcvar_num(g_Cvar[CVAR_LIMIT_PER_PLAYER]))
    {
        
client_print_color(idprint_team_default"%s ^3Você já atingiu o limite de ^4Dispenser ^3."PREFIX_CHAT)
        
client_cmd(id"spk %s"g_DispSndFail)

        return 
PLUGIN_HANDLED
    
}

    
/*if((xLimitGlobal[0] >= get_pcvar_num(g_Cvar[CVAR_LIMIT_GLOBAL]) && get_user_team(id) == 1) || (xLimitGlobal[1] >= get_pcvar_num(g_Cvar[CVAR_LIMIT_GLOBAL]) && get_user_team(id) == 2))
    {
        client_print_color(id, print_team_default, "%s ^3Sua equipe atingiu o limite de ^4Dispenser^3.", PREFIX_CHAT)
        client_cmd(id, "spk %s", g_DispSndFail)

        return PLUGIN_HANDLED
    }*/

    
static iMoneyiMoney cs_get_user_money(id)
    static 
iPriceDispiPriceDisp get_pcvar_num(g_Cvar[CVAR_LVL1_PRICE])

    if(
iMoney iPriceDisp)
    {
        
client_print_color(idprint_team_default"%s ^3Você não possui dinheiro suficiente! ^4$: %s^3."PREFIX_CHATxAddPoint(iPriceDisp))
        
client_cmd(id"spk %s"g_DispSndFail)

        return 
PLUGIN_HANDLED
    
}

    if(
g_PlayerMovingDisp[id])
    {
        
client_print_color(idprint_team_default"%s ^3Você já está com um ^4Dispenser ^3ativado, coloque-o para comprar mais."PREFIX_CHAT)
        
client_cmd(id"spk %s"g_DispSndFail)

        return 
PLUGIN_HANDLED
    
}
    else
    {
        if(
get_pcvar_num(g_Cvar[CVAR_INSTANT_PLANT]))
        {
            static 
Float:fOrigin[3]
            
get_origin_from_dist_player(id100.0fOrigin)

            if(
xCreateDispanser(fOriginid))
            {
                
client_print_color(idprint_team_default"%s ^4Dispenser ^3plantado!"PREFIX_CHAT)
                
cs_set_user_money(idiMoney iPriceDisp)
            }
            else
            {
                
client_cmd(id"spk %s"g_DispSndFail)
            }
        }
        else
        {
            
CreateDispMoveEffect(id)
            
cs_set_user_money(idiMoney iPriceDisp)
        }
    }

    return 
PLUGIN_HANDLED
}

public 
xDestroyDispenser(id)
{
    if(!
g_DispPlayerCount[id])
    {
        
client_print_color(idprint_team_default"%s ^3Você não possui nenhum ^4Dispenser ^3para ser destruído."PREFIX_CHAT)
        
client_cmd(id"spk %s"g_DispSndFail)

        return 
PLUGIN_HANDLED
    
}

    static 
entent FM_NULLENT

    
while((ent find_ent_by_class(entdispenser_classname)))
    {
        if(
pev(entDISPENSER_OWNER) != id
            continue

        if(
pev_valid(ent)) 
        {
            static 
iLevelxGiveMoney
            iLevel 
pev(entDISPENSER_LEVEL)

            
xGiveMoney 0

            
switch(iLevel)
            {
                case 
1: { xGiveMoney = (get_pcvar_num(g_Cvar[CVAR_LVL1_PRICE])) / 2; }
                case 
2: { xGiveMoney = (get_pcvar_num(g_Cvar[CVAR_LVL2_PRICE])) / 2; }
                case 
3: { xGiveMoney = (get_pcvar_num(g_Cvar[CVAR_LVL3_PRICE])) / 2; }
                case 
4: { xGiveMoney = (get_pcvar_num(g_Cvar[CVAR_LVL4_PRICE])) / 2; }
            }

            
g_DispPlayerCount[id] --
            
//xLimitTeamAtt(id)

            
cs_set_user_money(idcs_get_user_money(id) + xGiveMoney)
            
client_print_color(idprint_team_default"%s ^3Você obteve: ^4$: %s ^3de dinheiro por destruír seu ^4Dispenser ^3Lvl: ^4%d^3."PREFIX_CHAT,
            
xAddPoint(xGiveMoney), iLevel)
            
xRemoveEntFix(ent)
        }
    }

    return 
PLUGIN_HANDLED

yagami is offline
 


Thread Tools
Display Modes

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 16:00.


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