Hi everyone,
I have the following plugin for buying 100 armor, for ZP. It is also made to buy maximum 2 times.
When you buy armor, it says a message in chat, and after 2 times, says another message.
But even after second time, my 10 ammo goes away. I do not receive armor and I see the message that I can buy only 2 times, but how can I block to not use any ammo after second time?
Thanks
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <zp50_colorchat>
new const g_item_name[] = { "Anti-Infection Armor \r[100]" }
const g_item_cost = 10
new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" }
const g_armor_amount = 100
const g_armor_limit = 200
new g_ItemCount[33]
new g_itemid_armor
public plugin_precache()
{
precache_sound(g_sound_buyarmor)
}
public plugin_init()
{
register_plugin("[ZP] Extra: Anti-Infection Armor", "1.0", "MeRcyLeZZ")
g_itemid_armor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)
}
// Human buys our upgrade, give him some armor
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid_armor)
{
if(g_ItemCount[player] >= 2)
{
zp_colored_print(0, "You are allowed to buy armor only^4 2 times^1 per round! Max.^3 200ap^1.")
ZP_PLUGIN_HANDLED
}
else
zp_colored_print(0, "You successfully bought^4 100ap^1.")
{
set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit)))
engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
g_ItemCount[player] ++
}
}
}