Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <fakemeta_util>
- native get_user_cash(id)
- native set_user_cash(id,amount)
- enum _: ItemData
- {
- g_iDisplay[30],
- g_iAmount,
- g_item[40]
- }
- new MenuPrefix[] = "\w[\rPrefix\w]", szChatPrefix[] = "^3[^1Prefix^3]^1";
- new const GrenadesInfo[][ItemData] =
- {
- {"Explosive Grenade", 1000, "weapon_hegrenade"},
- {"Flashbang", 2000, "weapon_flashbang"},
- {"Smoke Grenade", 3000, "weapon_smokegrenade"}
- }
- new const WeaponInfo[][ItemData] =
- {
- {"M4A1", 1000, "weapon_m4a1"},
- {"AK-47", 2000, "weapon_ak47"},
- {"Glock", 3000, "weapon_glock"}
- }
- new const HealthInfo[][ItemData] =
- {
- {"10 Health", 1000, "10"},
- {"20 Health", 2000, "20"},
- {"30 Health", 3000, "30"}
- }
- new const ArmorInfo[][ItemData] =
- {
- {"10 Armor", 1000, "10"},
- {"20 Armor", 2000, "20"},
- {"30 Armor", 3000, "30"}
- }
- public plugin_init()
- {
- register_plugin("Basic Shop", "1.0", "orayon")
- register_clcmd("say /shop", "cmdshopmenu")
- }
- public cmdshopmenu(id)
- {
- new String[50]
- formatex(String, charsmax(String), "%s \wShop Menu v1.0", MenuPrefix)
- new menu = menu_create(String, "shopmenu_handler")
- menu_additem(menu, "Grenades menu")
- menu_additem(menu, "Weapon menu")
- menu_additem(menu, "Health menu")
- menu_additem(menu, "Armor menu")
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
- menu_setprop(menu, MPROP_EXITNAME, "\rExit" )
- menu_display(id, menu)
- }
- public shopmenu_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menu)
- return;
- }
- switch (item)
- {
- case 0: GrenadesMenu(id)
- case 1: WeaponMenu(id)
- case 2: HealthMenu(id)
- case 3: ArmorMenu(id)
- }
- }
- public GrenadesMenu(id)
- {
- new Format[70]
- formatex(Format, charsmax(Format), "%s Grenades Menu", MenuPrefix)
- new menu = menu_create(Format, "grenade_handler")
- for (new i; i < sizeof(GrenadesInfo); i++)
- {
- formatex(Format, charsmax(Format), "%s - %i Cash", GrenadesInfo[i][g_iDisplay], GrenadesInfo[i][g_iAmount])
- menu_additem(menu, Format)
- }
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
- menu_setprop(menu, MPROP_EXITNAME, "\wBack" )
- menu_display(id, menu)
- }
- public grenade_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- cmdshopmenu(id)
- }
- if( get_user_cash( id ) < GrenadesInfo[ item ][ g_iAmount ] )
- return ColorPrint( id,"You are missing ^3%i ^1Cash To purchase the ^3%s^1.", GrenadesInfo[ item ][ g_iAmount ] - get_user_cash( id ), GrenadesInfo[ item ][ g_iDisplay ] );
- new szName[60];
- get_user_name(id, szName, charsmax(szName))
- ColorPrint(0, "%s have Bought %s", szName, GrenadesInfo[ item ][ g_iDisplay ])
- ColorPrint(id, "You have Bought %s",GrenadesInfo[ item ][ g_iDisplay ])
- fm_give_item(id,GrenadesInfo[ item ][g_item])
- set_user_cash(id, get_user_cash(id) - GrenadesInfo[ item ][g_iAmount])
- return 1;
- }
- public WeaponMenu(id)
- {
- new Format[70]
- formatex(Format, charsmax(Format), "%s Weapons Menu", MenuPrefix)
- new menu = menu_create(Format, "weapon_handler")
- for (new i; i < sizeof(WeaponInfo); i++)
- {
- formatex(Format, charsmax(Format), "%s - %i Cash", WeaponInfo[i][g_iDisplay], WeaponInfo[i][g_iAmount])
- menu_additem(menu, Format)
- }
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
- menu_setprop(menu, MPROP_EXITNAME, "\wBack" )
- menu_display(id, menu)
- }
- public weapon_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- cmdshopmenu(id)
- }
- if( get_user_cash( id ) < WeaponInfo[ item ][ g_iAmount ] )
- return ColorPrint( id,"You are missing ^3%i ^1Cash To purchase the ^3%s^1.", WeaponInfo[ item ][ g_iAmount ] - get_user_cash( id ), WeaponInfo[ item ][ g_iDisplay ] );
- new szName[60];
- get_user_name(id, szName, charsmax(szName))
- ColorPrint(id, "You have Bought %s",WeaponInfo[ item ][ g_iDisplay ])
- ColorPrint(0, "%s have Bought %s", szName, WeaponInfo[ item ][ g_iDisplay ])
- fm_give_item(id,WeaponInfo[ item ][g_item])
- set_user_cash(id, get_user_cash(id) - WeaponInfo[ item ][g_iAmount])
- return 1;
- }
- public HealthMenu(id)
- {
- new Format[70]
- formatex(Format, charsmax(Format), "%s Health Menu", MenuPrefix)
- new menu = menu_create(Format, "health_handler")
- for (new i; i < sizeof(HealthInfo); i++)
- {
- formatex(Format, charsmax(Format), "%s - %i Cash", HealthInfo[i][g_iDisplay], HealthInfo[i][g_iAmount])
- menu_additem(menu, Format)
- }
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
- menu_setprop(menu, MPROP_EXITNAME, "\wBack" )
- menu_display(id, menu)
- }
- public health_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- cmdshopmenu(id)
- }
- if( get_user_cash( id ) < HealthInfo[ item ][ g_iAmount ] )
- return ColorPrint( id,"You are missing ^3%i ^1Cash To purchase the ^3%s^1.", HealthInfo[ item ][ g_iAmount ] - get_user_cash( id ), HealthInfo[ item ][ g_iDisplay ] );
- new szName[60];
- get_user_name(id, szName, charsmax(szName))
- ColorPrint(id, "You have Bought %s",HealthInfo[ item ][ g_iDisplay ])
- ColorPrint(0, "%s have Bought %s", szName, HealthInfo[ item ][ g_iDisplay ])
- fm_set_user_health( id, get_user_health( id ) + HealthInfo[ item ][g_item]);
- set_user_cash(id, get_user_cash(id) - HealthInfo[ item ][g_iAmount])
- return 1;
- }
- public ArmorMenu(id)
- {
- new Format[70]
- formatex(Format, charsmax(Format), "%s Armor Menu", MenuPrefix)
- new menu = menu_create(Format, "armor_handler")
- for (new i; i < sizeof(ArmorInfo); i++)
- {
- formatex(Format, charsmax(Format), "%s - %i Cash", ArmorInfo[i][g_iDisplay], ArmorInfo[i][g_iAmount])
- menu_additem(menu, Format)
- }
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
- menu_setprop(menu, MPROP_EXITNAME, "\wBack" )
- menu_display(id, menu)
- }
- public armor_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- cmdshopmenu(id)
- }
- if( get_user_cash( id ) < ArmorInfo[ item ][ g_iAmount ] )
- return ColorPrint( id,"You are missing ^3%i ^1Cash To purchase the ^3%s^1.", ArmorInfo[ item ][ g_iAmount ] - get_user_cash( id ), ArmorInfo[ item ][ g_iDisplay ] );
- new szName[60];
- get_user_name(id, szName, charsmax(szName))
- ColorPrint(0, "%s have Bought %s", szName, ArmorInfo[ item ][ g_iDisplay ])
- ColorPrint(id, "You have Bought %s",ArmorInfo[ item ][ g_iDisplay ])
- fm_set_user_armor( id, get_user_armor( id ) + ArmorInfo[ item ][g_item]);
- set_user_cash(id, get_user_cash(id) - ArmorInfo[ item ][g_iAmount])
- return 1;
- }
- //STOCKS
- stock ColorPrint( const index, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "%s^1 ", szChatPrefix );
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- if ( index )
- Players[ 0 ] = index;
- else
- get_players( Players, PNum, "ch" );
- for ( new i; i < PNum; i++ )
- {
- if( is_user_connected( Players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
- write_byte( Players[ i ] );
- write_string( szMsg );
- message_end( );
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment