Within the dispenser was crianda a new function for vip can put 2 dispenser more how do I change their value?
Code:
enum _:g_MaxCvars
{
CVAR_VLVL1_PRICE,
CVAR_VLVL2_PRICE,
CVAR_VLVL3_PRICE,
CVAR_VLVL4_PRICE,
}
PHP Code:
public xBuyDispenser( id )
{
// is not alive, ignore
if ( !is_user_alive( id ) )
{
return PLUGIN_CONTINUE
}
// is not on the floor, ignore
if (!( pev(id, pev_flags) & FL_ONGROUND))
{
client_print_color(id, print_team_default, "%s ^3Tente ficar em um chao ^1PLANO ^3para poder comprar um ^4Dispenser^3.", PREFIX_CHAT)
client_cmd(id, "spk %s", g_DispSndFail)
return PLUGIN_HANDLED
}
// maximum dispenser limit
new const limit_per_player = get_pcvar_num(g_Cvar[CVAR_LIMIT_PER_PLAYER])
new const limit_per_vip = get_pcvar_num(g_Cvar[CVAR_LIMIT_PER_VIP])
// verifique se o 'id' é de um VIP
new const is_vip = g_IsVip[id]
// how many dispensers the player has
new const dispenser_count = g_DispPlayerCount[id]
// reached the maximum dispenser limit
new const reached_limit = (is_vip ? dispenser_count >= limit_per_vip : dispenser_count >= limit_per_player)
// can't buy more, ignore
if (reached_limit)
{
client_print_color(id, print_team_default, "%s ^3Voce ja atingiu o limite de ^4Dispenser ^3.", PREFIX_CHAT)
client_cmd(id, "spk %s", g_DispSndFail)
return PLUGIN_HANDLED
}
// daqui para baixo não mudei nada
static iMoney; iMoney = cs_get_user_money(id)
static iPriceDisp; iPriceDisp = get_pcvar_num(g_Cvar[CVAR_LVL1_PRICE])
if(iMoney < iPriceDisp)
{
client_print_color(id, print_team_default, "%s ^3Voce nao possui dinheiro suficiente! ^4$: %s^3.", PREFIX_CHAT, xAddPoint(iPriceDisp))
client_cmd(id, "spk %s", g_DispSndFail)
return PLUGIN_HANDLED
}
if(g_PlayerMovingDisp[id])
{
client_print_color(id, print_team_default, "%s ^3Voce ja esta 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(id, 100.0, fOrigin)
if(xCreateDispanser(fOrigin, id))
{
client_print_color(id, print_team_default, "%s ^4Dispenser ^3plantado!", PREFIX_CHAT)
cs_set_user_money(id, iMoney - iPriceDisp)
}
else
{
client_cmd(id, "spk %s", g_DispSndFail)
}
}
else
{
CreateDispMoveEffect(id)
cs_set_user_money(id, iMoney - iPriceDisp)
}
}
return PLUGIN_HANDLED
}
Besides I can't get the destroy function dispenser to work right
it is destroying both dispensers at the same time
PHP Code:
public xDestroyDispenser(id)
{
if(!g_DispPlayerCount[id])
{
client_print_color(id, print_team_default, "%s ^3Voce nao possui nenhum ^4Dispenser ^3para ser destruído.", PREFIX_CHAT)
client_cmd(id, "spk %s", g_DispSndFail)
return PLUGIN_HANDLED
}
static ent; ent = FM_NULLENT
while((ent = find_ent_by_class(ent, dispenser_classname)))
{
if(pev(ent, DISPENSER_OWNER) != id)
continue
if(pev_valid(ent))
{
static iLevel, xGiveMoney
iLevel = pev(ent, DISPENSER_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(id, cs_get_user_money(id) + xGiveMoney)
client_print_color(id, print_team_default, "%s ^3Voce obteve: ^4$: %s ^3de dinheiro por destruír seu ^4Dispenser ^3Lvl: ^4%d^3.", PREFIX_CHAT,
xAddPoint(xGiveMoney), iLevel)
xRemoveEntFix(ent)
}
}
return PLUGIN_HANDLED
}