Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
new const item_name[] = "Extra Armour"
#define tag "BIOHAZARD SHOP"
new g_itemid_buyhp
new price_hp
public plugin_init()
{
register_plugin("[ZP] Buy Health Points", "1.0", "T[h]E Dis[as]teR/Tote edit")
g_itemid_buyhp = bio_register_item(item_name, 200, "+50 AP",TEAM_HUMAN)
price_hp = register_cvar("bio_hp_price", "2000")
}
public bio_item_selected(id, itemid) {
if(is_user_alive(id) || itemid == g_itemid_buyhp) {
if(!is_user_zombie(id)) {
if(cs_get_user_money(id) >= get_pcvar_num(price_hp)) {
if(get_user_armor(id) <= 200) {
set_user_armor(id, min((get_user_armor(id) + 50), 200));
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(price_hp))
client_print_color(id, 0, "^4[%s]^3 You've successfully purchased + 50 ARMOR^4!", tag)
} else {
client_print_color(id, 0, "^4[%s]^3 Sorry, you already have 200 or less than 200 armor^4!", tag)
return PLUGIN_HANDLED;
}
} else {
client_print_color(id, 0, "^4[%s]^3 You don't have enough money to buy this item! You need: %d$", tag, get_pcvar_num(price_hp))
return PLUGIN_HANDLED;
}
} else {
client_print_color(id, 0, "^4[%s]^3 You need to be human in order to purchase this item!",tag)
return PLUGIN_HANDLED;
}
}
return PLUGIN_HANDLED;
}