2008-10-04 22:59:11 +02:00
|
|
|
/**
|
|
|
|
* ====================
|
|
|
|
* Zombie:Reloaded
|
|
|
|
* File: menu.sp
|
|
|
|
* Author: Greyscale
|
|
|
|
* ====================
|
|
|
|
*/
|
|
|
|
|
|
|
|
MainMenu(client)
|
|
|
|
{
|
|
|
|
new Handle:menu_main = CreateMenu(MainMenuHandle);
|
|
|
|
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
SetMenuTitle(menu_main, "%t\n ", "!zmenu title");
|
|
|
|
|
|
|
|
decl String:zmenu[128];
|
2009-03-29 22:04:47 +02:00
|
|
|
decl String:zadmin[128];
|
2008-10-04 22:59:11 +02:00
|
|
|
decl String:zclass[128];
|
|
|
|
decl String:zmarket[128];
|
|
|
|
decl String:zspawn[128];
|
|
|
|
decl String:ztele[128];
|
|
|
|
decl String:zhp[128];
|
|
|
|
|
|
|
|
Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu");
|
2009-03-29 22:04:47 +02:00
|
|
|
Format(zadmin, sizeof(zadmin), "%t", "!zmenu admin");
|
2009-04-14 23:16:31 +02:00
|
|
|
Format(zclass, sizeof(zclass), "%t", "!zmenu class", ITEMDRAW_DISABLED);
|
2008-10-04 22:59:11 +02:00
|
|
|
Format(zmarket, sizeof(zmarket), "%t", "!zmenu market");
|
|
|
|
Format(zspawn, sizeof(zspawn), "%t", "!zmenu spawn");
|
|
|
|
Format(ztele, sizeof(ztele), "%t", "!zmenu tele");
|
|
|
|
Format(zhp, sizeof(zhp), "%t (%d HP)", "!zmenu hp", GetClientHealth(client));
|
|
|
|
|
|
|
|
AddMenuItem(menu_main, "zmenu", zmenu, ITEMDRAW_DISABLED);
|
2009-03-29 22:04:47 +02:00
|
|
|
|
|
|
|
if (GetAdminFlag(GetUserAdmin(client), Admin_Generic))
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_main, "zadmin", zadmin);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_main, "zadmin", zadmin, ITEMDRAW_DISABLED);
|
|
|
|
}
|
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
AddMenuItem(menu_main, "zclass", zclass);
|
|
|
|
|
|
|
|
if (market)
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_main, "zmarket", zmarket);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddMenuItem(menu_main, "zmarket", zmarket, ITEMDRAW_DISABLED);
|
|
|
|
}
|
|
|
|
|
|
|
|
AddMenuItem(menu_main, "zspawn", zspawn);
|
|
|
|
AddMenuItem(menu_main, "ztele", ztele);
|
|
|
|
AddMenuItem(menu_main, "zhp", zhp);
|
|
|
|
|
|
|
|
DisplayMenu(menu_main, client, MENU_TIME_FOREVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot)
|
|
|
|
{
|
|
|
|
if (action == MenuAction_Select)
|
|
|
|
{
|
|
|
|
switch(slot)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
2009-03-29 22:04:47 +02:00
|
|
|
if (!ZRAdminMenu(client))
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
MainMenu(client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
2009-04-14 23:16:31 +02:00
|
|
|
/*if (!ZClass(client))
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
MainMenu(client);
|
2009-04-14 23:16:31 +02:00
|
|
|
}*/
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2009-03-29 22:04:47 +02:00
|
|
|
if (!ZMarket(client))
|
|
|
|
{
|
|
|
|
MainMenu(client);
|
|
|
|
}
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
{
|
2009-03-29 22:04:47 +02:00
|
|
|
ZSpawn(client);
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
case 5:
|
2009-03-29 22:04:47 +02:00
|
|
|
{
|
|
|
|
if (!ZTele(client))
|
|
|
|
{
|
|
|
|
MainMenu(client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 6:
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
ZHP(client);
|
|
|
|
MainMenu(client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (action == MenuAction_End)
|
|
|
|
{
|
|
|
|
CloseHandle(menu_main);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-14 23:16:31 +02:00
|
|
|
/**ClassMenu(client)
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
new Handle:menu_classes = CreateMenu(ClassMenuHandle);
|
|
|
|
|
|
|
|
decl String:menu_description[256];
|
|
|
|
decl String:display[288]; // 32 + 256
|
|
|
|
|
|
|
|
SetGlobalTransTarget(client);
|
|
|
|
|
|
|
|
SetMenuTitle(menu_classes, "%t\n ", "!zclass title");
|
|
|
|
|
|
|
|
for (new x = 0; x < classCount; x++)
|
|
|
|
{
|
|
|
|
GetClassName(x, display, sizeof(display));
|
|
|
|
GetClassMenuDescription(x, menu_description, sizeof(menu_description));
|
|
|
|
|
|
|
|
if (pNextClass[client] == -1)
|
|
|
|
{
|
|
|
|
if (x == pClass[client])
|
|
|
|
{
|
|
|
|
Format(display, sizeof(display), "%s (current)", display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (x == pNextClass[client])
|
|
|
|
{
|
|
|
|
Format(display, sizeof(display), "%s (current)", display);
|
|
|
|
}
|
|
|
|
|
|
|
|
Format(display, sizeof(display), "%s\n %s", display, menu_description);
|
|
|
|
|
|
|
|
AddMenuItem(menu_classes, "", display);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetMenuExitBackButton(menu_classes, true);
|
|
|
|
|
|
|
|
DisplayMenu(menu_classes, client, MENU_TIME_FOREVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ClassMenuHandle(Handle:menu_classes, MenuAction:action, client, slot)
|
|
|
|
{
|
|
|
|
if (action == MenuAction_Select)
|
|
|
|
{
|
|
|
|
if (IsPlayerHuman(client) || !IsPlayerAlive(client))
|
|
|
|
{
|
|
|
|
Call_StartForward(hOnZClassChanged);
|
|
|
|
Call_PushCell(client);
|
|
|
|
Call_PushCell(pClass[client]);
|
|
|
|
Call_PushCell(slot);
|
|
|
|
Call_Finish();
|
|
|
|
|
|
|
|
pClass[client] = slot;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pNextClass[client] = slot;
|
|
|
|
}
|
|
|
|
|
|
|
|
decl String:name[64];
|
|
|
|
GetClassName(slot, name, sizeof(name));
|
|
|
|
|
|
|
|
ZR_PrintToChat(client, "Class select", name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action == MenuAction_Cancel)
|
|
|
|
{
|
|
|
|
if (slot == MenuCancel_ExitBack)
|
|
|
|
{
|
|
|
|
MainMenu(client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (action == MenuAction_End)
|
|
|
|
{
|
|
|
|
CloseHandle(menu_classes);
|
|
|
|
}
|
2009-04-14 23:16:31 +02:00
|
|
|
}*/
|