Code:
//right now this is just basically a copy/paste job of one of the exapmles
//in the amxmodx documentation.
//i've been adding to it, but the stuff i'm adding is like mashing a square
//block into a circular hole, cuz i have NO idea what i'm doing anymore.
//I need to find an absolute newb guide, not have somebody fix all my
//problems for me as i come across them.
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
new PLUGIN[]="Extra Buy Menu"
new AUTHOR[]="SuperMechaCow"
new VERSION[]="0.1"
// Item Prices (In order of menu options)
new prices[4] = { 3750, 4650, 7125, 5000 }
// Menu keys (defined globally)
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_menucmd(register_menuid("Extra Buy Menu"), keys, "giveWeapon")
register_clcmd("extrabuymenu", "showExtraMenu")
}
public showExtraMenu(id)
{
new menu[192]
format(menu, 191, "\yExtra Buy Menu^n^n\w1. AK47\R%d^n2. M4A1\R%d^n3. AWP\R%d^n4. Respawn\R%d^n^n0. Exit Menu", prices[0], prices[1], prices[2], prices[3])
show_menu(id, keys, menu)
return PLUGIN_HANDLED
}
public giveWeapon(id, key)
{
// Check if user has enough cash
new moolah = cs_get_user_money(id)
if( moolah < prices[key] )
{
client_print(id, print_chat, "[AMXX] You do not have enough money");
return PLUGIN_HANDLED;
}
// Remove Cash
cs_set_user_money(id, moolah - prices[key], 1);
// Give correct item
switch( key )
{
case 0: give_item(id, "weapon_ak47"); // Menu Option 1
case 1: give_item(id, "weapon_m4a1"); // Menu Option 2
case 2: give_item(id, "weapon_awp"); // Menu Option 3
case 3: spawn(id);
}
return PLUGIN_HANDLED;
}