2009-04-12 08:04:00 +02:00
|
|
|
/**
|
|
|
|
* ====================
|
|
|
|
* Zombie:Reloaded
|
|
|
|
* File: menu_weapons.inc
|
|
|
|
* Author: Greyscale
|
|
|
|
* ====================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Weapons Menus
|
|
|
|
*/
|
|
|
|
enum WeaponsMenu
|
|
|
|
{
|
2009-04-13 20:33:13 +02:00
|
|
|
Weapon,
|
|
|
|
WeaponGroup,
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-04-15 09:42:12 +02:00
|
|
|
* Array to store the client's current weapon menu.
|
2009-04-12 08:04:00 +02:00
|
|
|
*/
|
2009-04-13 06:00:58 +02:00
|
|
|
new WeaponsMenu:curMenuWeapons[MAXPLAYERS + 1];
|
2009-04-12 08:04:00 +02:00
|
|
|
|
2009-04-13 23:55:02 +02:00
|
|
|
/**
|
2009-04-15 09:42:12 +02:00
|
|
|
* Array to store the client's current weapon group menu.
|
2009-04-13 23:55:02 +02:00
|
|
|
*/
|
|
|
|
new String:curMenuGroup[WEAPONS_MAX_LENGTH][MAXPLAYERS + 1];
|
|
|
|
|
2009-04-12 08:04:00 +02:00
|
|
|
/**
|
|
|
|
* Sends main weapon menu to client.
|
|
|
|
* @param client The client index.
|
|
|
|
*/
|
|
|
|
WeaponsMenuMain(client)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Create menu handle.
|
2009-04-12 08:04:00 +02:00
|
|
|
new Handle:menu_weapons_main = CreateMenu(WeaponsMenuMainHandle);
|
|
|
|
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
SetMenuTitle(menu_weapons_main, "%t\n ", "Weapons menu main title");
|
|
|
|
|
2009-04-13 20:33:13 +02:00
|
|
|
decl String:toggleweaponrestriction[64];
|
|
|
|
decl String:togglewgrouprestriction[64];
|
2009-04-12 08:04:00 +02:00
|
|
|
decl String:zmarket[64];
|
|
|
|
|
2009-04-13 20:33:13 +02:00
|
|
|
Format(toggleweaponrestriction, sizeof(toggleweaponrestriction), "%t", "Weapons menu main toggle weapon restrict");
|
|
|
|
Format(togglewgrouprestriction, sizeof(togglewgrouprestriction), "%t", "Weapons menu main toggle weapon group restrict");
|
2009-04-12 08:04:00 +02:00
|
|
|
Format(zmarket, sizeof(zmarket), "%t", "Weapons menu main market");
|
|
|
|
|
2009-04-13 20:33:13 +02:00
|
|
|
AddMenuItem(menu_weapons_main, "toggleweaponrestriction", toggleweaponrestriction);
|
2009-04-13 23:55:02 +02:00
|
|
|
AddMenuItem(menu_weapons_main, "togglewgrouprestriction", togglewgrouprestriction);
|
2009-04-30 07:36:57 +02:00
|
|
|
AddMenuItem(menu_weapons_main, "zmarket", zmarket, MenuGetItemDraw(g_bMarket));
|
2009-04-12 08:04:00 +02:00
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Create a "Back" button to the weapons main menu.
|
2009-04-12 08:04:00 +02:00
|
|
|
SetMenuExitBackButton(menu_weapons_main, true);
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Send menu.
|
2009-04-12 08:04:00 +02:00
|
|
|
DisplayMenu(menu_weapons_main, client, MENU_TIME_FOREVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when client selects option in the weapons main menu, and handles it.
|
|
|
|
* @param menu_weapons_main Handle of the menu being used.
|
|
|
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
|
|
|
* @param client The client index.
|
|
|
|
* @param slot The slot index selected (starting from 0).
|
|
|
|
*/
|
|
|
|
public WeaponsMenuMainHandle(Handle:menu_weapons_main, MenuAction:action, client, slot)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client selected an option.
|
2009-04-12 08:04:00 +02:00
|
|
|
if (action == MenuAction_Select)
|
|
|
|
{
|
|
|
|
switch(slot)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2009-04-13 20:33:13 +02:00
|
|
|
WeaponsMenuWeapons(client, Weapon);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
2009-04-13 20:33:13 +02:00
|
|
|
WeaponsMenuWeapons(client, WeaponGroup);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
2009-04-14 01:29:24 +02:00
|
|
|
WeaponsMenuMarket(client);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client closed the menu.
|
2009-04-12 08:04:00 +02:00
|
|
|
if (action == MenuAction_Cancel)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Back" button.
|
2009-04-12 08:04:00 +02:00
|
|
|
if (slot == MenuCancel_ExitBack)
|
|
|
|
{
|
|
|
|
ZRAdminMenu(client);
|
|
|
|
}
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Exit" button.
|
2009-04-12 08:04:00 +02:00
|
|
|
else if (action == MenuAction_End)
|
|
|
|
{
|
|
|
|
CloseHandle(menu_weapons_main);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends weapon list menu to client.
|
|
|
|
* @param client The client index.
|
|
|
|
*/
|
|
|
|
WeaponsMenuWeapons(client, WeaponsMenu:type)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Set the current action client is performing on a weapon. (see enum WeaponsMenu)
|
2009-04-12 08:04:00 +02:00
|
|
|
curMenuWeapons[client] = type;
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Create menu handle.
|
2009-04-12 08:04:00 +02:00
|
|
|
new Handle:menu_weapons_weapons = CreateMenu(WeaponsMenuWeaponsHandle);
|
|
|
|
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// If client wants to perform an action on a single weapon, show weapon list.
|
2009-04-13 22:00:37 +02:00
|
|
|
switch(curMenuWeapons[client])
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 22:00:37 +02:00
|
|
|
case Weapon:
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 22:00:37 +02:00
|
|
|
SetMenuTitle(menu_weapons_weapons, "%t\n ", "Weapons menu weapons weapon title");
|
2009-04-12 08:04:00 +02:00
|
|
|
|
2009-04-13 22:00:37 +02:00
|
|
|
decl String:weapon[WEAPONS_MAX_LENGTH];
|
|
|
|
decl String:display[WEAPONS_MAX_LENGTH + 1];
|
|
|
|
new Handle:arrayWeapons = INVALID_HANDLE;
|
|
|
|
new size = WeaponsCreateWeaponArray(arrayWeapons);
|
2009-04-12 08:04:00 +02:00
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// x = Array index.
|
2009-04-13 22:00:37 +02:00
|
|
|
for (new x = 0; x < size; x++)
|
2009-04-13 20:33:13 +02:00
|
|
|
{
|
2009-04-13 22:00:37 +02:00
|
|
|
GetArrayString(arrayWeapons, x, weapon, sizeof(weapon));
|
|
|
|
|
|
|
|
strcopy(display, sizeof(display), weapon);
|
|
|
|
|
|
|
|
if (RestrictIsWeaponRestricted(weapon))
|
|
|
|
{
|
|
|
|
Format(display, sizeof(display), "%s*", weapon);
|
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// If weapon restriction is blocked for the menu, disable option.
|
2009-04-14 01:29:24 +02:00
|
|
|
new bool:menu = WeaponsIsWeaponMenu(weapon);
|
|
|
|
|
2009-04-13 22:00:37 +02:00
|
|
|
if (menu)
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_weapons_weapons, weapon, display);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_weapons_weapons, weapon, display, ITEMDRAW_DISABLED);
|
|
|
|
}
|
2009-04-13 20:33:13 +02:00
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// If there are no weapons, add an "(Empty)" line.
|
2009-04-14 04:58:05 +02:00
|
|
|
if (size == 0)
|
|
|
|
{
|
|
|
|
decl String:empty[64];
|
|
|
|
Format(empty, sizeof(empty), "%t", "Menu empty");
|
|
|
|
|
|
|
|
AddMenuItem(menu_weapons_weapons, "empty", empty, ITEMDRAW_DISABLED);
|
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Kill the array handle.
|
2009-04-13 22:00:37 +02:00
|
|
|
CloseHandle(arrayWeapons);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// If client wants to perform an action on a weapon group, show custom group list.
|
2009-04-13 22:00:37 +02:00
|
|
|
case WeaponGroup:
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 22:00:37 +02:00
|
|
|
SetMenuTitle(menu_weapons_weapons, "%t\n ", "Weapons menu weapons group title");
|
2009-04-12 08:04:00 +02:00
|
|
|
|
2009-04-13 22:00:37 +02:00
|
|
|
decl String:weapongroup[WEAPONS_MAX_LENGTH];
|
2009-04-14 04:58:05 +02:00
|
|
|
decl String:display[WEAPONS_MAX_LENGTH + 2];
|
2009-04-13 22:00:37 +02:00
|
|
|
new Handle:arrayWeaponGroups = INVALID_HANDLE;
|
|
|
|
new size = RestrictCreateGroupArray(arrayWeaponGroups);
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// x = Array index.
|
2009-04-13 22:00:37 +02:00
|
|
|
for (new x = 0; x < size; x++)
|
2009-04-13 20:33:13 +02:00
|
|
|
{
|
2009-04-13 22:00:37 +02:00
|
|
|
GetArrayString(arrayWeaponGroups, x, weapongroup, sizeof(weapongroup));
|
|
|
|
|
|
|
|
strcopy(display, sizeof(display), weapongroup);
|
|
|
|
|
2009-04-13 23:55:02 +02:00
|
|
|
if (RestrictIsPartialRestricted(weapongroup))
|
2009-04-13 22:00:37 +02:00
|
|
|
{
|
|
|
|
Format(display, sizeof(display), "%s*", weapongroup);
|
|
|
|
}
|
2009-04-13 23:55:02 +02:00
|
|
|
else if (RestrictIsGroupRestricted(weapongroup))
|
|
|
|
{
|
|
|
|
Format(display, sizeof(display), "%s**", weapongroup);
|
|
|
|
}
|
2009-04-13 22:00:37 +02:00
|
|
|
|
|
|
|
AddMenuItem(menu_weapons_weapons, weapongroup, display);
|
2009-04-13 20:33:13 +02:00
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// If there are no weapons, add an "(Empty)" line.
|
2009-04-14 04:58:05 +02:00
|
|
|
if (size == 0)
|
|
|
|
{
|
|
|
|
decl String:empty[64];
|
|
|
|
Format(empty, sizeof(empty), "%t", "Menu empty");
|
|
|
|
|
|
|
|
AddMenuItem(menu_weapons_weapons, "empty", empty, ITEMDRAW_DISABLED);
|
|
|
|
}
|
|
|
|
|
2009-04-13 22:00:37 +02:00
|
|
|
// Kill the array handle
|
|
|
|
CloseHandle(arrayWeaponGroups);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
}
|
2009-04-13 23:55:02 +02:00
|
|
|
|
2009-04-12 08:04:00 +02:00
|
|
|
SetMenuExitBackButton(menu_weapons_weapons, true);
|
|
|
|
|
|
|
|
DisplayMenu(menu_weapons_weapons, client, MENU_TIME_FOREVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when client selects option in the weapons list menu, and handles it.
|
|
|
|
* @param menu_weapons_main Handle of the menu being used.
|
|
|
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
|
|
|
* @param client The client index.
|
|
|
|
* @param slot The slot index selected (starting from 0).
|
|
|
|
*/
|
|
|
|
public WeaponsMenuWeaponsHandle(Handle:menu_weapons_weapons, MenuAction:action, client, slot)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client selected an option.
|
2009-04-12 08:04:00 +02:00
|
|
|
if (action == MenuAction_Select)
|
|
|
|
{
|
|
|
|
decl String:weapon[WEAPONS_MAX_LENGTH];
|
|
|
|
GetMenuItem(menu_weapons_weapons, slot, weapon, sizeof(weapon));
|
|
|
|
|
2009-04-13 23:55:02 +02:00
|
|
|
switch(curMenuWeapons[client])
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client is restricting a single weapon.
|
2009-04-13 23:55:02 +02:00
|
|
|
case Weapon:
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
new WpnRestrictQuery:output;
|
|
|
|
|
|
|
|
if (!RestrictIsWeaponRestricted(weapon))
|
2009-04-13 20:33:13 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
output = RestrictRestrict(weapon);
|
|
|
|
RestrictPrintRestrictOutput(client, output, weapon, false);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
2009-04-13 23:55:02 +02:00
|
|
|
else
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
output = RestrictUnrestrict(weapon);
|
|
|
|
RestrictPrintUnrestrictOutput(client, output, weapon, false);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
2009-04-13 23:55:02 +02:00
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Resend menu.
|
2009-04-13 23:55:02 +02:00
|
|
|
WeaponsMenuWeapons(client, curMenuWeapons[client]);
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client is accessing a weapon group.
|
2009-04-13 23:55:02 +02:00
|
|
|
case WeaponGroup:
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Send weapon group menu.
|
2009-04-13 23:55:02 +02:00
|
|
|
WeaponsMenuWeaponGroup(client, weapon);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
}
|
2009-04-13 23:55:02 +02:00
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client closed the menu.
|
2009-04-13 23:55:02 +02:00
|
|
|
if (action == MenuAction_Cancel)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Back" button.
|
2009-04-13 23:55:02 +02:00
|
|
|
if (slot == MenuCancel_ExitBack)
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
WeaponsMenuMain(client);
|
|
|
|
}
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Exit" button.
|
2009-04-13 23:55:02 +02:00
|
|
|
else if (action == MenuAction_End)
|
|
|
|
{
|
|
|
|
CloseHandle(menu_weapons_weapons);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WeaponsMenuWeaponGroup(client, const String:weapongroup[])
|
|
|
|
{
|
|
|
|
strcopy(curMenuGroup[client], WEAPONS_MAX_LENGTH, weapongroup);
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Create menu handle.
|
2009-04-13 23:55:02 +02:00
|
|
|
new Handle:menu_weapons_groupweapon = CreateMenu(WeaponsMenuWeaponGroupHandle);
|
|
|
|
|
|
|
|
SetMenuTitle(menu_weapons_groupweapon, "%t\n ", "Weapons menu weapon group title", weapongroup);
|
|
|
|
|
|
|
|
decl String:restrictall[64];
|
|
|
|
decl String:unrestrictall[64];
|
|
|
|
|
|
|
|
Format(restrictall, sizeof(restrictall), "%t", "Weapons menu weapon group restrict all");
|
|
|
|
Format(unrestrictall, sizeof(unrestrictall), "%t", "Weapons menu weapon group unrestrict all");
|
|
|
|
|
|
|
|
if (RestrictIsGroupRestricted(weapongroup))
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_weapons_groupweapon, "restrictall", restrictall, ITEMDRAW_DISABLED);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_weapons_groupweapon, "restrictall", restrictall);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RestrictIsGroupUnrestricted(weapongroup))
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_weapons_groupweapon, "unrestrictall", unrestrictall, ITEMDRAW_DISABLED);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_weapons_groupweapon, "unrestrictall", unrestrictall);
|
|
|
|
}
|
|
|
|
|
|
|
|
decl String:groupweapon[WEAPONS_MAX_LENGTH];
|
|
|
|
decl String:display[WEAPONS_MAX_LENGTH + 1];
|
|
|
|
new Handle:arrayGroupWeapons = INVALID_HANDLE;
|
|
|
|
new size = RestrictCreateGroupWeaponsArray(arrayGroupWeapons, weapongroup);
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// x = Array index.
|
2009-04-13 23:55:02 +02:00
|
|
|
for (new x = 0; x < size; x++)
|
|
|
|
{
|
|
|
|
GetArrayString(arrayGroupWeapons, x, groupweapon, sizeof(groupweapon));
|
|
|
|
|
|
|
|
strcopy(display, sizeof(display), groupweapon);
|
|
|
|
|
|
|
|
if (RestrictIsWeaponRestricted(groupweapon))
|
|
|
|
{
|
|
|
|
Format(display, sizeof(display), "%s*", groupweapon);
|
|
|
|
}
|
|
|
|
|
|
|
|
AddMenuItem(menu_weapons_groupweapon, groupweapon, display);
|
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Kill the array handle.
|
2009-04-13 23:55:02 +02:00
|
|
|
CloseHandle(arrayGroupWeapons);
|
|
|
|
|
|
|
|
SetMenuExitBackButton(menu_weapons_groupweapon, true);
|
|
|
|
|
|
|
|
DisplayMenu(menu_weapons_groupweapon, client, MENU_TIME_FOREVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when client selects option in the weapon group menu, and handles it.
|
|
|
|
* @param menu_weapons_main Handle of the menu being used.
|
|
|
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
|
|
|
* @param client The client index.
|
|
|
|
* @param slot The slot index selected (starting from 0).
|
|
|
|
*/
|
|
|
|
public WeaponsMenuWeaponGroupHandle(Handle:menu_weapons_groupweapon, MenuAction:action, client, slot)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client selected an option.
|
2009-04-13 23:55:02 +02:00
|
|
|
if (action == MenuAction_Select)
|
|
|
|
{
|
|
|
|
switch(slot)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
new WpnRestrictQuery:output = RestrictRestrict(curMenuGroup[client]);
|
|
|
|
RestrictPrintRestrictOutput(client, output, curMenuGroup[client], false);
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
new WpnRestrictQuery:output = RestrictUnrestrict(curMenuGroup[client]);
|
|
|
|
RestrictPrintUnrestrictOutput(client, output, curMenuGroup[client], false);
|
|
|
|
}
|
2009-04-12 08:04:00 +02:00
|
|
|
|
2009-04-13 23:55:02 +02:00
|
|
|
default:
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
new WpnRestrictQuery:output;
|
|
|
|
|
|
|
|
decl String:groupweapon[WEAPONS_MAX_LENGTH];
|
|
|
|
GetMenuItem(menu_weapons_groupweapon, slot, groupweapon, sizeof(groupweapon));
|
|
|
|
|
|
|
|
if (!RestrictIsWeaponRestricted(groupweapon))
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
output = RestrictRestrict(groupweapon);
|
|
|
|
RestrictPrintRestrictOutput(client, output, groupweapon, false);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
2009-04-13 23:55:02 +02:00
|
|
|
else
|
2009-04-12 08:04:00 +02:00
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
output = RestrictUnrestrict(groupweapon);
|
|
|
|
RestrictPrintUnrestrictOutput(client, output, groupweapon, false);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Resend menu.
|
2009-04-13 23:55:02 +02:00
|
|
|
WeaponsMenuWeaponGroup(client, curMenuGroup[client]);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client closed the menu.
|
2009-04-12 08:04:00 +02:00
|
|
|
if (action == MenuAction_Cancel)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Back" button.
|
2009-04-12 08:04:00 +02:00
|
|
|
if (slot == MenuCancel_ExitBack)
|
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
WeaponsMenuWeapons(client, curMenuWeapons[client]);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Exit" button.
|
2009-04-12 08:04:00 +02:00
|
|
|
else if (action == MenuAction_End)
|
|
|
|
{
|
2009-04-13 23:55:02 +02:00
|
|
|
CloseHandle(menu_weapons_groupweapon);
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|
2009-04-14 01:29:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends market options menu to client.
|
|
|
|
* @param client The client index.
|
|
|
|
*/
|
|
|
|
WeaponsMenuMarket(client)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Create menu handle.
|
2009-04-14 01:29:24 +02:00
|
|
|
new Handle:menu_weapons_market = CreateMenu(WeaponsMenuMarketHandle);
|
|
|
|
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
SetMenuTitle(menu_weapons_market, "%t\n ", "Weapons menu market title");
|
|
|
|
|
|
|
|
decl String:togglebuyzone[64];
|
|
|
|
|
|
|
|
decl String:curSetting[8];
|
2009-05-01 07:09:18 +02:00
|
|
|
ConfigBoolToSetting(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]), curSetting, sizeof(curSetting));
|
2009-04-14 01:29:24 +02:00
|
|
|
|
|
|
|
Format(togglebuyzone, sizeof(togglebuyzone), "%t", "Weapons menu market toggle buyzone", curSetting);
|
|
|
|
|
|
|
|
AddMenuItem(menu_weapons_market, "togglebuyzone", togglebuyzone);
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Create a "Back" button to the weapons main menu.
|
2009-04-14 01:29:24 +02:00
|
|
|
SetMenuExitBackButton(menu_weapons_market, true);
|
|
|
|
|
|
|
|
// Send menu
|
|
|
|
DisplayMenu(menu_weapons_market, client, MENU_TIME_FOREVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when client selects option in the weapons main menu, and handles it.
|
|
|
|
* @param menu_weapons_main Handle of the menu being used.
|
|
|
|
* @param action The action done on the menu (see menus.inc, enum MenuAction).
|
|
|
|
* @param client The client index.
|
|
|
|
* @param slot The slot index selected (starting from 0).
|
|
|
|
*/
|
|
|
|
public WeaponsMenuMarketHandle(Handle:menu_weapons_market, MenuAction:action, client, slot)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client selected an option.
|
2009-04-14 01:29:24 +02:00
|
|
|
if (action == MenuAction_Select)
|
|
|
|
{
|
|
|
|
switch(slot)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2009-04-22 04:53:19 +02:00
|
|
|
if (GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]))
|
2009-04-14 01:29:24 +02:00
|
|
|
{
|
2009-04-22 04:53:19 +02:00
|
|
|
SetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE], false);
|
2009-04-14 01:29:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-22 04:53:19 +02:00
|
|
|
SetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE], true);
|
2009-04-14 01:29:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-15 09:42:12 +02:00
|
|
|
// Resend menu.
|
2009-04-14 01:29:24 +02:00
|
|
|
WeaponsMenuMarket(client);
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client closed the menu.
|
2009-04-14 01:29:24 +02:00
|
|
|
if (action == MenuAction_Cancel)
|
|
|
|
{
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Back" button.
|
2009-04-14 01:29:24 +02:00
|
|
|
if (slot == MenuCancel_ExitBack)
|
|
|
|
{
|
|
|
|
WeaponsMenuMain(client);
|
|
|
|
}
|
|
|
|
}
|
2009-04-15 09:42:12 +02:00
|
|
|
// Client hit "Exit" button.
|
2009-04-14 01:29:24 +02:00
|
|
|
else if (action == MenuAction_End)
|
|
|
|
{
|
|
|
|
CloseHandle(menu_weapons_market);
|
|
|
|
}
|
2009-04-12 08:04:00 +02:00
|
|
|
}
|