Пользователь
- Сообщения
- 47
- Реакции
- 1
Hello, basically i have this item shop, where people can buy things off, every item can be made like in zombie plague extra shop, its like an API. For example i have armor, people can buy 100 armor for theirselves, but i want the armor limitation to be set, for example 1 time per round.
Problem starts when i buy it off the extra item shop, first time is all good for the armor plugin, but when i buy the second time, the shop still removes my money(says i bought it), but the armor plugin says that i have reached my limit.
Can anyone help?
Here is the menu handler for the API shop:
Is there a missing forward at the end? So it works with my armor plugin?
Here is armor plugin example:
Problem starts when i buy it off the extra item shop, first time is all good for the armor plugin, but when i buy the second time, the shop still removes my money(says i bought it), but the armor plugin says that i have reached my limit.
Can anyone help?
Here is the menu handler for the API shop:
C++:
public menu1_handle_human(id, menu, item)
{
if(item == MENU_EXIT || is_user_zombie(id))
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
static data[6], szName[64], access, callback
static temp_integer1
menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
temp_integer1 = str_to_num(data)
static cost, wp_name[64], wp_desc[64]
cost = ArrayGetCell(Item_Cost, temp_integer1)
ArrayGetString(Item_Name, temp_integer1, wp_name, sizeof(wp_name))
ArrayGetString(Item_Desc, temp_integer1, wp_desc, sizeof(wp_desc))
if(cs_get_user_money(id) >= cost)
{
client_printc(id, "!g*!n You bought !t%s!n for !g%i$!n!", wp_name, cost)
cs_set_user_money(id, cs_get_user_money(id) - cost)
static g_dummy
ExecuteForward(g_selected_forward, g_dummy, id, temp_integer1)
} else {
client_printc(id, "!g*!n You don't have enough money for !t%s!n (price: !g%i$!n)", wp_name, cost)
}
// i guess soemthing is wrong here?
return PLUGIN_CONTINUE
}
Is there a missing forward at the end? So it works with my armor plugin?
Here is armor plugin example:
C++:
if (itemid == g_itemid_humanarmor)
{
if(is_user_zombie(player))
return PLUGIN_HANDLED
else if(pev(player, pev_armorvalue) >= g_armor_limit)
{
client_print_color(player, print_chat, "^4* ^1You already have maxed your armor!")
return PLUGIN_HANDLED
}
else if(g_ItemCount[player] >= 1)
{
client_print_color(player, print_chat, "^4* ^1You can buy armor only^3 1 ^1time in a round!")
return PLUGIN_HANDLED
}
else
{
g_ItemCount[player]++
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)
}
}