Okay I got it to work. But now what I want to do is how would I set this menu to appear right after someone has join the server and they are on a team. I want it to appear only that one time. The rest of the time they have to say /shop to see it again.
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
new bool: gBoughtItem [ 32 ] [ 2 ]
public plugin_init()
{
register_plugin( "T SHOP", "1.0", "Dead Man" );
RegisterHam ( Ham_Spawn, "player", "FwdPlayerSpawn", 1 )
register_clcmd( "say /shop", "ShopT" );
}
public client_connect( id )
{
gBoughtItem[ id ][ 0 ] = false;
gBoughtItem[ id ][ 1 ] = false;
}
public FwdPlayerSpawn ( iPlayer, id )
{
if ( gBoughtItem [ iPlayer ] [ 0 ] )
set_user_health ( iPlayer, get_user_health ( iPlayer ) + 25 )
if ( gBoughtItem [ iPlayer ] [ 1 ] )
set_user_health ( iPlayer, get_user_health ( iPlayer ) + 50 )
gBoughtItem [ iPlayer ] [ 0 ] = false
gBoughtItem [ iPlayer ] [ 1 ] = false
}
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)
gBoughtItem[ id ][ 0 ] = true;
}
case 2:
{
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)
gBoughtItem[ id ][ 1 ] = true;
}
}
return PLUGIN_HANDLED;
}
__________________