Thanks everybody. One more question now. How would I set it so when they buy something they get it the next round and not the current round already started. I want all affects to happen on next round.
Also another question on the menu, what part of it do I need to remove so players don't get the ZERO key that lets them exit the menu. I want them to have to get something if they open it.
PHP Code:
public ShopT(id)
{
new menu = menu_create("\yWhat well you buy?", "submenu_handler")
menu_additem(menu, "\wExtra 25 HP for ($5000)", "1", 0);
menu_additem(menu, "\wExtra 50 HP for ($10000)", "2", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public submenu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if(cs_get_user_money( id ) < 5000)
{
client_print(id, print_chat, "You do not have enough money.")
return PLUGIN_CONTINUE
}
cs_set_user_money(id, cs_get_user_money(id) - 5000)
set_user_health(id, get_user_health(id) + 25)
}
case 2:
{
if(cs_get_user_money( id ) < 10000)
{
client_print(id, print_chat, "You do not have enough money.")
return PLUGIN_CONTINUE
}
cs_set_user_money(id, cs_get_user_money(id) - 10000)
set_user_health(id, get_user_health(id) + 50)
}
}
return PLUGIN_HANDLED;
}
__________________