Advertisement
Guest User

Untitled

a guest
Feb 8th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.35 KB | None | 0 0
  1. /*
  2. * MyJailbreak - Menu Plugin.
  3. * by: shanapu
  4. * https://github.com/shanapu/MyJailbreak/
  5. *
  6. * This file is part of the MyJailbreak SourceMod Plugin.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it under
  9. * the terms of the GNU General Public License, version 3.0, as published by the
  10. * Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15. * details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21.  
  22. /******************************************************************************
  23. STARTUP
  24. ******************************************************************************/
  25.  
  26.  
  27. //Includes
  28. #include <sourcemod>
  29. #include <sdktools>
  30. #include <sdkhooks>
  31. #include <cstrike>
  32. #include <colors>
  33. #include <autoexecconfig>
  34. #include <warden>
  35. #include <smartjaildoors>
  36. #include <mystocks>
  37. #include <myjailbreak>
  38.  
  39.  
  40. //Compiler Options
  41. #pragma semicolon 1
  42. #pragma newdecls required
  43.  
  44.  
  45. //Booleans
  46. bool gp_bMyJailShop = false;
  47.  
  48.  
  49. //Integers
  50. int g_iCoolDown;
  51.  
  52.  
  53. //Console Variables
  54. ConVar gc_bPlugin;
  55. ConVar gc_bTerror;
  56. ConVar gc_bCTerror;
  57. ConVar gc_bWarden;
  58. ConVar gc_bDeputy;
  59. ConVar gc_bDays;
  60. ConVar gc_bClose;
  61. ConVar gc_bStart;
  62. ConVar gc_bWelcome;
  63. ConVar gc_bTeam;
  64. ConVar gc_sCustomCommandMenu;
  65. ConVar gc_sCustomCommandDays;
  66. ConVar gc_sCustomCommandSetDay;
  67. ConVar gc_sCustomCommandVoting;
  68. ConVar gc_iCooldownDay;
  69. ConVar gc_iCooldownStart;
  70. ConVar gc_sAdminFlag;
  71. ConVar gc_bSetW;
  72. ConVar gc_bSetA;
  73. ConVar gc_bVoting;
  74.  
  75.  
  76. //3rd party Convars
  77. ConVar g_bMath;
  78. ConVar g_bMathDeputy;
  79. ConVar g_bCheck;
  80. ConVar g_bFF;
  81. ConVar g_bZeus;
  82. ConVar g_bCowboy;
  83. ConVar g_bRules;
  84. ConVar g_bsetFF;
  85. ConVar g_bsetFFDeputy;
  86. ConVar g_bWar;
  87. ConVar g_bMute;
  88. ConVar g_bMuteDeputy;
  89. ConVar g_bSuicideBomber;
  90. ConVar g_bKnife;
  91. ConVar g_bFFA;
  92. ConVar g_bExtend;
  93. ConVar g_bExtendDeputy;
  94. ConVar g_bLaserDeputy;
  95. ConVar g_bPainterDeputy;
  96. ConVar g_bLaser;
  97. ConVar g_bPainter;
  98. ConVar g_bNoBlock;
  99. ConVar g_bNoBlockDeputy;
  100. ConVar g_bZombie;
  101. ConVar g_bNoScope;
  102. ConVar g_bHEbattle;
  103. ConVar g_bHide;
  104. ConVar g_bCatch;
  105. ConVar g_bTorch;
  106. ConVar g_bDrunk;
  107. ConVar g_bFreeday;
  108. ConVar g_bDuckHunt;
  109. ConVar g_bCountdown;
  110. ConVar g_bCountdownDeputy;
  111. ConVar g_bVote;
  112. ConVar g_bGuns;
  113. ConVar g_bGunsT;
  114. ConVar g_bGunsCT;
  115. ConVar g_bOpen;
  116. ConVar g_bOpenDeputy;
  117. ConVar g_bRandomDeputy;
  118. ConVar g_bRandom;
  119. ConVar g_bRequest;
  120. ConVar g_bWarden;
  121. ConVar g_bDeputy;
  122. ConVar g_bDeputySet;
  123. ConVar g_bDeputyBecome;
  124. ConVar g_bWardenCount;
  125. ConVar g_bWardenRebel;
  126. ConVar g_bWardenCountDeputy;
  127. ConVar g_bWardenRebelDeputy;
  128. ConVar g_bSparksDeputy;
  129. ConVar g_bPlayerFreedayDeputy;
  130. ConVar g_bSparks;
  131. ConVar g_bPlayerFreeday;
  132. ConVar g_bDealDamage;
  133. ConVar gc_sAdminFlagBulletSparks;
  134. ConVar gc_sAdminFlagLaser;
  135. ConVar gc_sAdminFlagPainter;
  136. ConVar gc_bOrders;
  137. ConVar gc_bOrdersDeputy;
  138.  
  139.  
  140. //Strings
  141. char g_sAdminFlagBulletSparks[32];
  142. char g_sAdminFlagLaser[32];
  143. char g_sAdminFlagPainter[32];
  144. char g_sAdminFlag[32];
  145.  
  146.  
  147. //Info
  148. public Plugin myinfo = {
  149. name = "MyJailbreak - Menus",
  150. author = "shanapu, Franc1sco",
  151. description = "Jailbreak Menu",
  152. version = MYJB_VERSION,
  153. url = MYJB_URL_LINK
  154. };
  155.  
  156.  
  157. //Start
  158. public void OnPluginStart()
  159. {
  160. // Translation
  161. LoadTranslations("MyJailbreak.Warden.phrases");
  162. LoadTranslations("MyJailbreak.Menu.phrases");
  163.  
  164.  
  165. //Client Commands
  166. RegConsoleCmd("sm_menu", Command_OpenMenu, "opens the menu depends on players team/rank");
  167. RegConsoleCmd("buyammo1", Command_OpenMenu, "opens the menu depends on players team/rank");
  168. RegConsoleCmd("sm_eventdays", Command_VoteEventDays, "open a vote EventDays menu for player");
  169. RegConsoleCmd("sm_setday", Command_SetEventDay, "open a Set EventDays menu for Warden/Admin");
  170. RegConsoleCmd("sm_voteday", Command_VotingMenu, "Allows warden & admin to opens event day voting");
  171.  
  172.  
  173. //AutoExecConfig
  174. AutoExecConfig_SetFile("Menu", "MyJailbreak");
  175. AutoExecConfig_SetCreateFile(true);
  176.  
  177. AutoExecConfig_CreateConVar("sm_menu_version", MYJB_VERSION, "The version of the SourceMod plugin MyJailbreak - Menu", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
  178. gc_bPlugin = AutoExecConfig_CreateConVar("sm_menu_enable", "1", "0 - disabled, 1 - enable jailbrek menu", _, true, 0.0, true, 1.0);
  179. gc_sCustomCommandMenu = AutoExecConfig_CreateConVar("sm_menu_cmds_menu", "panel, menus, m", "Set your custom chat command for open menu(!menu (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");
  180. gc_sCustomCommandDays = AutoExecConfig_CreateConVar("sm_menu_cmds_days", "days, day, ed", "Set your custom chat command for open menu(!eventdays (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");
  181. gc_sCustomCommandSetDay = AutoExecConfig_CreateConVar("sm_menu_cmds_setday", "sd, setdays", "Set your custom chat command for open menu(!menu (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");
  182. gc_sCustomCommandVoting = AutoExecConfig_CreateConVar("sm_menu_cmds_voting", "vd, votedays", "Set your custom chat command for open menu(!menu (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");
  183. gc_bCTerror = AutoExecConfig_CreateConVar("sm_menu_ct", "1", "0 - disabled, 1 - enable ct jailbreak menu", _, true, 0.0, true, 1.0);
  184. gc_bTerror = AutoExecConfig_CreateConVar("sm_menu_t", "1", "0 - disabled, 1 - enable t jailbreak menu", _, true, 0.0, true, 1.0);
  185. gc_bWarden = AutoExecConfig_CreateConVar("sm_menu_warden", "1", "0 - disabled, 1 - enable warden jailbreak menu", _, true, 0.0, true, 1.0);
  186. gc_bDeputy = AutoExecConfig_CreateConVar("sm_menu_deputy", "1", "0 - disabled, 1 - enable deputy jailbreak menu", _, true, 0.0, true, 1.0);
  187. gc_bDays = AutoExecConfig_CreateConVar("sm_menu_days", "1", "0 - disabled, 1 - enable vote/set eventdays menu", _, true, 0.0, true, 1.0);
  188. gc_bClose = AutoExecConfig_CreateConVar("sm_menu_close", "0", "0 - disabled, 1 - enable close menu after action", _, true, 0.0, true, 1.0);
  189. gc_bStart = AutoExecConfig_CreateConVar("sm_menu_start", "1", "0 - disabled, 1 - enable open menu on every roundstart", _, true, 0.0, true, 1.0);
  190. gc_bTeam = AutoExecConfig_CreateConVar("sm_menu_team", "1", "0 - disabled, 1 - enable join team on menu", _, true, 0.0, true, 1.0);
  191. gc_bWelcome = AutoExecConfig_CreateConVar("sm_menu_welcome", "1", "Show welcome message to newly connected users.", _, true, 0.0, true, 1.0);
  192. gc_bVoting = AutoExecConfig_CreateConVar("sm_menu_voteday", "1", "0 - disabled, 1 - enable voteing for a eventday", _, true, 0.0, true, 1.0);
  193. gc_sAdminFlag = AutoExecConfig_CreateConVar("sm_menu_flag", "g", "Set flag for admin/vip to start a voting & get admin menu");
  194. gc_bSetW = AutoExecConfig_CreateConVar("sm_menu_voteday_warden", "1", "0 - disabled, 1 - allow warden to start a voting", _, true, 0.0, true, 1.0);
  195. gc_bSetA = AutoExecConfig_CreateConVar("sm_menu_voteday_admin", "1", "0 - disabled, 1 - allow admin/vip to start a voting", _, true, 0.0, true, 1.0);
  196. gc_iCooldownDay = AutoExecConfig_CreateConVar("sm_menu_voteday_cooldown_day", "3", "Rounds cooldown after a voting until voting can be start again", _, true, 0.0);
  197. gc_iCooldownStart = AutoExecConfig_CreateConVar("sm_menu_voteday_cooldown_start", "3", "Rounds until voting can be start after mapchange.", _, true, 0.0);
  198.  
  199. AutoExecConfig_ExecuteFile();
  200. AutoExecConfig_CleanFile();
  201.  
  202.  
  203. //Hooks
  204. HookEvent("player_spawn", Event_OnPlayerSpawn);
  205. HookEvent("round_start", Event_RoundStart);
  206. HookConVarChange(gc_sAdminFlag, OnSettingChanged);
  207.  
  208.  
  209. //Find
  210. gc_sAdminFlag.GetString(g_sAdminFlag , sizeof(g_sAdminFlag));
  211. }
  212.  
  213.  
  214. //ConVarChange for Strings
  215. public int OnSettingChanged(Handle convar, const char[] oldValue, const char[] newValue)
  216. {
  217. if (convar == gc_sAdminFlag)
  218. {
  219. strcopy(g_sAdminFlag, sizeof(g_sAdminFlag), newValue);
  220. }
  221. }
  222.  
  223.  
  224. // Check for optional Plugins
  225. public void OnAllPluginsLoaded()
  226. {
  227. gp_bMyJailShop = LibraryExists("myjailshop");
  228. }
  229.  
  230.  
  231. public void OnLibraryRemoved(const char[] name)
  232. {
  233. if (StrEqual(name, "myjailshop"))
  234. gp_bMyJailShop = false;
  235. }
  236.  
  237.  
  238. public void OnLibraryAdded(const char[] name)
  239. {
  240. if (StrEqual(name, "myjailshop"))
  241. gp_bMyJailShop = true;
  242. }
  243.  
  244.  
  245. //FindConVar
  246. public void OnConfigsExecuted()
  247. {
  248. g_bWarden = FindConVar("sm_warden_enable");
  249. g_bDeputy = FindConVar("sm_warden_deputy_enable");
  250. g_bDeputySet = FindConVar("sm_warden_deputy_set");
  251. g_bDeputyBecome = FindConVar("sm_warden_deputy_become");
  252. g_bWardenCountDeputy = FindConVar("sm_warden_counter_deputy");
  253. g_bWardenRebelDeputy = FindConVar("sm_warden_mark_rebel_deputy");
  254. g_bWardenCount = FindConVar("sm_warden_counter");
  255. g_bWardenRebel = FindConVar("sm_warden_mark_rebel");
  256. g_bRules = FindConVar("sm_hosties_rules_enable");
  257. g_bCheck = FindConVar("sm_hosties_checkplayers_enable");
  258. g_bMathDeputy = FindConVar("sm_warden_math_deputy");
  259. g_bNoBlockDeputy = FindConVar("sm_warden_noblock_deputy");
  260. g_bExtendDeputy = FindConVar("sm_warden_extend_deputy");
  261. g_bMath = FindConVar("sm_warden_math");
  262. g_bNoBlock = FindConVar("sm_warden_noblock");
  263. g_bExtend = FindConVar("sm_warden_extend");
  264. g_bWar = FindConVar("sm_war_enable");
  265. g_bZeus = FindConVar("sm_zeus_enable");
  266. g_bFFA = FindConVar("sm_ffa_enable");
  267. g_bMute = FindConVar("sm_warden_mute");
  268. g_bMuteDeputy = FindConVar("sm_warden_mute_deputy");
  269. g_bTorch = FindConVar("sm_torch_enable");
  270. g_bPainter = FindConVar("sm_warden_painter");
  271. g_bLaser = FindConVar("sm_warden_laser");
  272. g_bSparks = FindConVar("sm_warden_bulletsparks");
  273. g_bPainterDeputy = FindConVar("sm_warden_painter_deputy");
  274. g_bLaserDeputy = FindConVar("sm_warden_laser_deputy");
  275. g_bSparksDeputy = FindConVar("sm_warden_bulletsparks_deputy");
  276. g_bZombie = FindConVar("sm_zombie_enable");
  277. g_bDrunk = FindConVar("sm_drunk_enable");
  278. g_bCowboy = FindConVar("sm_cowboy_enable");
  279. g_bNoScope = FindConVar("sm_noscope_enable");
  280. g_bHide = FindConVar("sm_hide_enable");
  281. g_bKnife = FindConVar("sm_knifefight_enable");
  282. g_bSuicideBomber = FindConVar("sm_suicidebomber_enable");
  283. g_bCatch = FindConVar("sm_catch_enable");
  284. g_bHEbattle = FindConVar("sm_hebattle_enable");
  285. g_bFreeday = FindConVar("sm_freeday_enable");
  286. g_bDuckHunt = FindConVar("sm_duckhunt_enable");
  287. g_bCountdown = FindConVar("sm_warden_countdown");
  288. g_bCountdownDeputy = FindConVar("sm_warden_countdown_deputy");
  289. g_bVote = FindConVar("sm_warden_vote");
  290. g_bGunsCT = FindConVar("sm_weapons_ct");
  291. g_bGunsT = FindConVar("sm_weapons_t");
  292. g_bGuns = FindConVar("sm_weapons_enable");
  293. g_bFF = FindConVar("mp_teammates_are_enemies");
  294. g_bRequest = FindConVar("sm_request_enable");
  295. g_bDealDamage = FindConVar("sm_dealdamage_enable");
  296. g_bOpen = FindConVar("sm_warden_open_enable");
  297. g_bsetFF = FindConVar("sm_warden_ff");
  298. g_bRandom = FindConVar("sm_warden_random");
  299. g_bPlayerFreeday = FindConVar("sm_warden_freeday_enable");
  300. g_bOpenDeputy = FindConVar("sm_warden_open_deputy");
  301. g_bsetFFDeputy = FindConVar("sm_warden_ff_deputy");
  302. g_bRandomDeputy = FindConVar("sm_warden_random_deputy");
  303. g_bPlayerFreedayDeputy = FindConVar("sm_freekill_freeday_victim_deputy");
  304. gc_sAdminFlagBulletSparks = FindConVar("sm_warden_bulletsparks_flag");
  305. gc_sAdminFlagLaser = FindConVar("sm_warden_laser_flag");
  306. gc_sAdminFlagPainter = FindConVar("sm_warden_painter_flag");
  307. gc_bOrders = FindConVar("sm_warden_orders");
  308. gc_bOrdersDeputy = FindConVar("sm_warden_orders_deputy");
  309.  
  310. gc_sAdminFlagLaser.GetString(g_sAdminFlagLaser, sizeof(g_sAdminFlagLaser));
  311. gc_sAdminFlagPainter.GetString(g_sAdminFlagPainter, sizeof(g_sAdminFlagPainter));
  312. gc_sAdminFlagBulletSparks.GetString(g_sAdminFlagBulletSparks, sizeof(g_sAdminFlagBulletSparks));
  313.  
  314.  
  315. //Set custom Commands
  316. int iCount = 0;
  317. char sCommands[128], sCommandsL[12][32], sCommand[32];
  318.  
  319. //Menu
  320. gc_sCustomCommandMenu.GetString(sCommands, sizeof(sCommands));
  321. ReplaceString(sCommands, sizeof(sCommands), " ", "");
  322. iCount = ExplodeString(sCommands, ",", sCommandsL, sizeof(sCommandsL), sizeof(sCommandsL[]));
  323.  
  324. for (int i = 0; i < iCount; i++)
  325. {
  326. Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]);
  327. if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist
  328. RegConsoleCmd(sCommand, Command_OpenMenu, "opens the menu depends on players team/rank");
  329. }
  330.  
  331. //Days Menu
  332. gc_sCustomCommandDays.GetString(sCommands, sizeof(sCommands));
  333. ReplaceString(sCommands, sizeof(sCommands), " ", "");
  334. iCount = ExplodeString(sCommands, ",", sCommandsL, sizeof(sCommandsL), sizeof(sCommandsL[]));
  335.  
  336. for (int i = 0; i < iCount; i++)
  337. {
  338. Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]);
  339. if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist
  340. RegConsoleCmd(sCommand, Command_VoteEventDays, "open a vote EventDays menu for player");
  341. }
  342.  
  343. //Set Day
  344. gc_sCustomCommandSetDay.GetString(sCommands, sizeof(sCommands));
  345. ReplaceString(sCommands, sizeof(sCommands), " ", "");
  346. iCount = ExplodeString(sCommands, ",", sCommandsL, sizeof(sCommandsL), sizeof(sCommandsL[]));
  347.  
  348. for (int i = 0; i < iCount; i++)
  349. {
  350. Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]);
  351. if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist
  352. RegConsoleCmd(sCommand, Command_SetEventDay, "open a Set EventDays menu for Warden/Admin");
  353. }
  354.  
  355. //Voting
  356. gc_sCustomCommandVoting.GetString(sCommands, sizeof(sCommands));
  357. ReplaceString(sCommands, sizeof(sCommands), " ", "");
  358. iCount = ExplodeString(sCommands, ",", sCommandsL, sizeof(sCommandsL), sizeof(sCommandsL[]));
  359.  
  360. for (int i = 0; i < iCount; i++)
  361. {
  362. Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]);
  363. if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist
  364. RegConsoleCmd(sCommand, Command_VotingMenu, "Allows warden & admin to opens event day voting");
  365. }
  366. }
  367.  
  368.  
  369. /******************************************************************************
  370. COMMANDS
  371. ******************************************************************************/
  372.  
  373.  
  374.  
  375.  
  376. /******************************************************************************
  377. EVENTS
  378. ******************************************************************************/
  379.  
  380.  
  381. //Open Menu on Spawn
  382. public void Event_OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  383. {
  384. int client = GetClientOfUserId(event.GetInt("userid"));
  385.  
  386. if (gc_bStart.BoolValue)
  387. {
  388. Command_OpenMenu(client, 0);
  389. }
  390. }
  391.  
  392.  
  393. public void Event_RoundStart(Event event, char[] name, bool dontBroadcast)
  394. {
  395. char EventDay[64];
  396. MyJailbreak_GetEventDayName(EventDay);
  397. if (!StrEqual(EventDay, "none", false))
  398. {
  399. g_iCoolDown = gc_iCooldownDay.IntValue + 1;
  400. }
  401. else if (g_iCoolDown > 0) g_iCoolDown--;
  402. }
  403.  
  404.  
  405. /******************************************************************************
  406. FORWARDS LISTEN
  407. ******************************************************************************/
  408.  
  409.  
  410. //Welcome/Info Message
  411. public void OnClientPutInServer(int client)
  412. {
  413. if (gc_bWelcome.BoolValue)
  414. {
  415. CreateTimer(35.0, Timer_WelcomeMessage, client);
  416. }
  417. }
  418.  
  419.  
  420. public void OnMapStart()
  421. {
  422. g_iCoolDown = gc_iCooldownStart.IntValue +1;
  423. }
  424.  
  425.  
  426. /******************************************************************************
  427. MENUS
  428. ******************************************************************************/
  429.  
  430. //Main Menu
  431.  
  432. public Action Command_OpenMenu(int client, int args)
  433. {
  434. if (gc_bPlugin.BoolValue)
  435. {
  436. if (IsValidClient(client, false, true))
  437. {
  438. char menuinfo[255];
  439.  
  440. Format(menuinfo, sizeof(menuinfo), "%T", "menu_info_title", client);
  441.  
  442. Menu mainmenu = new Menu(JBMenuHandler);
  443. mainmenu.SetTitle(menuinfo);
  444. if (warden_iswarden(client))
  445. {
  446. if (gc_bWarden.BoolValue) // HERE STARTS THE WARDEN MENU
  447. {
  448. /* Warden PLACEHOLDER
  449. Format(menuinfo, sizeof(menuinfo), "%T", "menu_PLACEHOLDER", client);
  450. mainmenu.AddItem("PLACEHOLDER", menuinfo);
  451. */
  452. if (g_bGuns != null)
  453. {
  454. if (g_bGuns.BoolValue)
  455. {
  456. if (g_bGunsCT.BoolValue)
  457. {
  458. Format(menuinfo, sizeof(menuinfo), "%T", "menu_guns", client);
  459. mainmenu.AddItem("guns", menuinfo);
  460. }
  461. }
  462. }
  463. if (g_bOpen != null)
  464. {
  465. if (g_bOpen.BoolValue && SJD_IsCurrentMapConfigured())
  466. {
  467. Format(menuinfo, sizeof(menuinfo), "%T", "menu_opencell", client);
  468. mainmenu.AddItem("cellopen", menuinfo);
  469. Format(menuinfo, sizeof(menuinfo), "%T", "menu_closecell", client);
  470. mainmenu.AddItem("cellclose", menuinfo);
  471. }
  472. }
  473. if (g_bDeputy != null && g_bDeputySet != null)
  474. {
  475. if (g_bDeputy.BoolValue && g_bDeputySet.BoolValue && !warden_deputy_exist() && (GetAliveTeamCount(CS_TEAM_CT) > 1))
  476. {
  477. Format(menuinfo, sizeof(menuinfo), "%T", "menu_deputyset", client);
  478. mainmenu.AddItem("setdeputy", menuinfo);
  479. }
  480. }
  481. if (gc_bOrders != null)
  482. {
  483. if (gc_bOrders.BoolValue)
  484. {
  485. Format(menuinfo, sizeof(menuinfo), "%T", "menu_orders", client);
  486. mainmenu.AddItem("orders", menuinfo);
  487. }
  488. }
  489. if (g_bCountdown != null)
  490. {
  491. if (g_bCountdown.BoolValue)
  492. {
  493. Format(menuinfo, sizeof(menuinfo), "%T", "menu_countdown", client);
  494. mainmenu.AddItem("countdown", menuinfo);
  495. }
  496. }
  497. if (g_bWardenCount != null)
  498. {
  499. if (g_bWardenCount.BoolValue)
  500. {
  501. Format(menuinfo, sizeof(menuinfo), "%T", "menu_count", client);
  502. mainmenu.AddItem("count", menuinfo);
  503. }
  504. }
  505. if (g_bPlayerFreeday != null)
  506. {
  507. if (g_bPlayerFreeday.BoolValue)
  508. {
  509. Format(menuinfo, sizeof(menuinfo), "%T", "menu_playerfreeday", client);
  510. mainmenu.AddItem("playerfreeday", menuinfo);
  511. }
  512. }
  513. if (g_bWardenRebel != null)
  514. {
  515. if (g_bWardenRebel.BoolValue)
  516. {
  517. Format(menuinfo, sizeof(menuinfo), "%T", "menu_rebel", client);
  518. mainmenu.AddItem("rebel", menuinfo);
  519. }
  520. }
  521. if (g_bMath != null)
  522. {
  523. if (g_bMath.BoolValue)
  524. {
  525. Format(menuinfo, sizeof(menuinfo), "%T", "menu_math", client);
  526. mainmenu.AddItem("math", menuinfo);
  527. }
  528. }
  529. if (gc_bVoting.BoolValue)
  530. {
  531. Format(menuinfo, sizeof(menuinfo), "%T", "menu_voteday", client);
  532. mainmenu.AddItem("voteday", menuinfo);
  533. }
  534. if (gc_bDays.BoolValue)
  535. {
  536. Format(menuinfo, sizeof(menuinfo), "%T", "menu_seteventdays", client);
  537. mainmenu.AddItem("setdays", menuinfo);
  538. }
  539. if (g_bSparks != null)
  540. {
  541. if (g_bSparks.BoolValue && CheckVipFlag(client, g_sAdminFlagBulletSparks))
  542. {
  543. Format(menuinfo, sizeof(menuinfo), "%T", "menu_sparks", client);
  544. mainmenu.AddItem("sparks", menuinfo);
  545. }
  546. }
  547. if (g_bPainter != null)
  548. {
  549. if (g_bPainter.BoolValue && CheckVipFlag(client, g_sAdminFlagPainter))
  550. {
  551. Format(menuinfo, sizeof(menuinfo), "%T", "menu_painter", client);
  552. mainmenu.AddItem("painter", menuinfo);
  553. }
  554. }
  555. if (g_bLaser != null)
  556. {
  557. if (g_bLaser.BoolValue && CheckVipFlag(client, g_sAdminFlagLaser))
  558. {
  559. Format(menuinfo, sizeof(menuinfo), "%T", "menu_laser", client);
  560. mainmenu.AddItem("laser", menuinfo);
  561. }
  562. }
  563. if (g_bExtend != null)
  564. {
  565. if (g_bExtend.BoolValue)
  566. {
  567. Format(menuinfo, sizeof(menuinfo), "%T", "menu_extend", client);
  568. mainmenu.AddItem("extend", menuinfo);
  569. }
  570. }
  571. if (g_bMute != null)
  572. {
  573. if (g_bMute.BoolValue)
  574. {
  575. Format(menuinfo, sizeof(menuinfo), "%T", "menu_mute", client);
  576. mainmenu.AddItem("mute", menuinfo);
  577. }
  578. }
  579. if (g_bCheck != null)
  580. {
  581. if (g_bCheck.BoolValue)
  582. {
  583. Format(menuinfo, sizeof(menuinfo), "%T", "menu_check", client);
  584. mainmenu.AddItem("check", menuinfo);
  585. }
  586. }
  587. if (g_bsetFF != null)
  588. {
  589. if (g_bsetFF.BoolValue)
  590. {
  591. if (!g_bFF.BoolValue)
  592. {
  593. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffon", client);
  594. mainmenu.AddItem("setff", menuinfo);
  595. }
  596. else
  597. {
  598. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffoff", client);
  599. mainmenu.AddItem("setff", menuinfo);
  600. }
  601. }
  602. }
  603. if (g_bNoBlock != null)
  604. {
  605. if (g_bNoBlock.BoolValue)
  606. {
  607. Format(menuinfo, sizeof(menuinfo), "%T", "menu_noblock", client);
  608. mainmenu.AddItem("noblock", menuinfo);
  609. }
  610. }
  611. if (g_bRandom != null)
  612. {
  613. if (g_bRandom.BoolValue)
  614. {
  615. Format(menuinfo, sizeof(menuinfo), "%T", "menu_randomdead", client);
  616. mainmenu.AddItem("kill", menuinfo);
  617. }
  618. }
  619. if (g_bDeputy != null && g_bDeputySet != null)
  620. {
  621. if (g_bDeputy.BoolValue && g_bDeputySet.BoolValue && warden_deputy_exist())
  622. {
  623. Format(menuinfo, sizeof(menuinfo), "%T", "menu_removedeputy", client);
  624. mainmenu.AddItem("undeputy", menuinfo);
  625. }
  626. }
  627. Format(menuinfo, sizeof(menuinfo), "%T", "menu_unwarden", client);
  628. mainmenu.AddItem("unwarden", menuinfo);
  629. }// HERE END THE WARDEN MENU
  630. }
  631. else if (warden_deputy_isdeputy(client))
  632. {
  633. if (gc_bDeputy.BoolValue) // HERE STARTS THE DEPUTY MENU
  634. {
  635. /* Deputy PLACEHOLDER
  636. Format(menuinfo, sizeof(menuinfo), "%T", "menu_PLACEHOLDER", client);
  637. mainmenu.AddItem("PLACEHOLDER", menuinfo);
  638. */
  639. if (g_bGuns != null)
  640. {
  641. if (g_bGuns.BoolValue)
  642. {
  643. if (g_bGunsCT.BoolValue)
  644. {
  645. Format(menuinfo, sizeof(menuinfo), "%T", "menu_guns", client);
  646. mainmenu.AddItem("guns", menuinfo);
  647. }
  648. }
  649. }
  650. if (g_bOpen != null)
  651. {
  652. if (g_bOpen.BoolValue && g_bOpenDeputy.BoolValue && SJD_IsCurrentMapConfigured())
  653. {
  654. Format(menuinfo, sizeof(menuinfo), "%T", "menu_opencell", client);
  655. mainmenu.AddItem("cellopen", menuinfo);
  656. Format(menuinfo, sizeof(menuinfo), "%T", "menu_closecell", client);
  657. mainmenu.AddItem("cellclose", menuinfo);
  658. }
  659. }
  660. if (gc_bOrdersDeputy != null)
  661. {
  662. if (gc_bOrdersDeputy.BoolValue)
  663. {
  664. Format(menuinfo, sizeof(menuinfo), "%T", "menu_orders", client);
  665. mainmenu.AddItem("orders", menuinfo);
  666. }
  667. }
  668. if (g_bCountdown != null)
  669. {
  670. if (g_bCountdown.BoolValue && g_bCountdownDeputy.BoolValue)
  671. {
  672. Format(menuinfo, sizeof(menuinfo), "%T", "menu_countdown", client);
  673. mainmenu.AddItem("countdown", menuinfo);
  674. }
  675. }
  676. if (g_bWardenCount != null)
  677. {
  678. if (g_bWardenCount.BoolValue && g_bWardenCountDeputy.BoolValue)
  679. {
  680. Format(menuinfo, sizeof(menuinfo), "%T", "menu_count", client);
  681. mainmenu.AddItem("count", menuinfo);
  682. }
  683. }
  684. if (g_bPlayerFreeday != null)
  685. {
  686. if (g_bPlayerFreeday.BoolValue && g_bPlayerFreedayDeputy.BoolValue)
  687. {
  688. Format(menuinfo, sizeof(menuinfo), "%T", "menu_playerfreeday", client);
  689. mainmenu.AddItem("playerfreeday", menuinfo);
  690. }
  691. }
  692. if (g_bWardenRebel != null)
  693. {
  694. if (g_bWardenRebel.BoolValue && g_bWardenRebelDeputy.BoolValue)
  695. {
  696. Format(menuinfo, sizeof(menuinfo), "%T", "menu_rebel", client);
  697. mainmenu.AddItem("rebel", menuinfo);
  698. }
  699. }
  700. if (g_bMath != null)
  701. {
  702. if (g_bMath.BoolValue && g_bMathDeputy.BoolValue)
  703. {
  704. Format(menuinfo, sizeof(menuinfo), "%T", "menu_math", client);
  705. mainmenu.AddItem("math", menuinfo);
  706. }
  707. }
  708. if (g_bSparks != null)
  709. {
  710. if (g_bSparks.BoolValue && g_bSparksDeputy.BoolValue && CheckVipFlag(client, g_sAdminFlagBulletSparks))
  711. {
  712. Format(menuinfo, sizeof(menuinfo), "%T", "menu_sparks", client);
  713. mainmenu.AddItem("sparks", menuinfo);
  714. }
  715. }
  716. if (g_bPainter != null)
  717. {
  718. if (g_bPainter.BoolValue && g_bPainterDeputy.BoolValue && CheckVipFlag(client, g_sAdminFlagPainter))
  719. {
  720. Format(menuinfo, sizeof(menuinfo), "%T", "menu_painter", client);
  721. mainmenu.AddItem("painter", menuinfo);
  722. }
  723. }
  724. if (g_bLaser != null)
  725. {
  726. if (g_bLaser.BoolValue && g_bLaserDeputy.BoolValue && CheckVipFlag(client, g_sAdminFlagLaser))
  727. {
  728. Format(menuinfo, sizeof(menuinfo), "%T", "menu_laser", client);
  729. mainmenu.AddItem("laser", menuinfo);
  730. }
  731. }
  732. if (g_bExtend != null)
  733. {
  734. if (g_bExtend.BoolValue && g_bExtendDeputy.BoolValue)
  735. {
  736. Format(menuinfo, sizeof(menuinfo), "%T", "menu_extend", client);
  737. mainmenu.AddItem("extend", menuinfo);
  738. }
  739. }
  740. if (g_bMute != null)
  741. {
  742. if (g_bMute.BoolValue && g_bMuteDeputy.BoolValue)
  743. {
  744. Format(menuinfo, sizeof(menuinfo), "%T", "menu_mute", client);
  745. mainmenu.AddItem("mute", menuinfo);
  746. }
  747. }
  748. if (g_bCheck != null)
  749. {
  750. if (g_bCheck.BoolValue)
  751. {
  752. Format(menuinfo, sizeof(menuinfo), "%T", "menu_check", client);
  753. mainmenu.AddItem("check", menuinfo);
  754. }
  755. }
  756. if (g_bsetFF != null)
  757. {
  758. if (g_bsetFF.BoolValue && g_bsetFFDeputy.BoolValue)
  759. {
  760. if (!g_bFF.BoolValue)
  761. {
  762. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffon", client);
  763. mainmenu.AddItem("setff", menuinfo);
  764. }
  765. else
  766. {
  767. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffoff", client);
  768. mainmenu.AddItem("setff", menuinfo);
  769. }
  770. }
  771. }
  772. if (g_bNoBlock != null)
  773. {
  774. if (g_bNoBlock.BoolValue && g_bNoBlockDeputy.BoolValue)
  775. {
  776. Format(menuinfo, sizeof(menuinfo), "%T", "menu_noblock", client);
  777. mainmenu.AddItem("noblock", menuinfo);
  778. }
  779. }
  780. if (g_bRandom != null)
  781. {
  782. if (g_bRandom.BoolValue && g_bRandomDeputy.BoolValue)
  783. {
  784. Format(menuinfo, sizeof(menuinfo), "%T", "menu_randomdead", client);
  785. mainmenu.AddItem("kill", menuinfo);
  786. }
  787. }
  788. Format(menuinfo, sizeof(menuinfo), "%T", "menu_undeputy", client);
  789. mainmenu.AddItem("undeputy", menuinfo);
  790. }// HERE END THE WARDEN MENU
  791. }
  792. else if (GetClientTeam(client) == CS_TEAM_CT) // HERE STARTS THE CT MENU
  793. {
  794. if (gc_bCTerror.BoolValue)
  795. {
  796. /* CT PLACEHOLDER
  797. Format(menuinfo, sizeof(menuinfo), "%T", "menu_PLACEHOLDER", client);
  798. mainmenu.AddItem("PLACEHOLDER", menuinfo);
  799. */
  800. if (g_bGuns != null)
  801. {
  802. if (g_bGuns.BoolValue)
  803. {
  804. if (g_bGunsCT.BoolValue)
  805. {
  806. Format(menuinfo, sizeof(menuinfo), "%T", "menu_guns", client);
  807. mainmenu.AddItem("guns", menuinfo);
  808. }
  809. }
  810. }
  811. if (g_bWarden != null)
  812. {
  813. if (!warden_exist() && IsPlayerAlive(client))
  814. {
  815. if (g_bWarden.BoolValue)
  816. {
  817. Format(menuinfo, sizeof(menuinfo), "%T", "menu_getwarden", client);
  818. mainmenu.AddItem("getwarden", menuinfo);
  819. }
  820.  
  821. }
  822. if (g_bRequest != null)
  823. {
  824. if (g_bRequest.BoolValue)
  825. {
  826. Format(menuinfo, sizeof(menuinfo), "%T", "menu_request", client);
  827. mainmenu.AddItem("request", menuinfo);
  828. }
  829. }
  830. if (g_bDeputy != null && g_bDeputyBecome != null)
  831. {
  832. if (warden_exist() && g_bDeputy.BoolValue && g_bDeputyBecome.BoolValue && !warden_deputy_exist())
  833. {
  834. Format(menuinfo, sizeof(menuinfo), "%T", "menu_deputybecome", client);
  835. mainmenu.AddItem("becomedeputy", menuinfo);
  836. }
  837. }
  838. }
  839.  
  840. char EventDay[64];
  841. MyJailbreak_GetEventDayName(EventDay);
  842.  
  843. if (StrEqual(EventDay, "none", false)) //is an other event running or set?
  844. {
  845. if (gc_bDays.BoolValue)
  846. {
  847. Format(menuinfo, sizeof(menuinfo), "%T", "menu_voteeventdays", client);
  848. mainmenu.AddItem("votedays", menuinfo);
  849. }
  850. }
  851.  
  852. if (g_bCheck != null)
  853. {
  854. if (g_bCheck.BoolValue && IsPlayerAlive(client))
  855. {
  856. Format(menuinfo, sizeof(menuinfo), "%T", "menu_check", client);
  857. mainmenu.AddItem("check", menuinfo);
  858. }
  859. }
  860. if (gc_bTeam.BoolValue)
  861. {
  862. Format(menuinfo, sizeof(menuinfo), "%T", "menu_joint", client);
  863. mainmenu.AddItem("ChangeTeam", menuinfo);
  864. }
  865. }// HERE END THE CT MENU
  866. }
  867. else if (GetClientTeam(client) == CS_TEAM_T) // HERE STARTS THE T MENU
  868. {
  869. if (gc_bTerror.BoolValue)
  870. {
  871. /* TERROR PLACEHOLDER
  872. Format(menuinfo, sizeof(menuinfo), "%T", "menu_PLACEHOLDER", client);
  873. mainmenu.AddItem("PLACEHOLDER", menuinfo);
  874. */
  875. if (gp_bMyJailShop)
  876. {
  877. Format(menuinfo, sizeof(menuinfo), "%T", "menu_jailshop", client);
  878. mainmenu.AddItem("jailshop", menuinfo);
  879. }
  880. if (g_bGuns != null)
  881. {
  882. if (g_bGuns.BoolValue)
  883. {
  884. if (g_bGunsT.BoolValue)
  885. {
  886. Format(menuinfo, sizeof(menuinfo), "%T", "menu_guns", client);
  887. mainmenu.AddItem("guns", menuinfo);
  888. }
  889. }
  890. }
  891. if (g_bRequest != null)
  892. {
  893. if (g_bRequest.BoolValue)
  894. {
  895. Format(menuinfo, sizeof(menuinfo), "%T", "menu_request", client);
  896. mainmenu.AddItem("request", menuinfo);
  897. }
  898. }
  899. if (g_bWarden != null)
  900. {
  901. if (warden_exist())
  902. {
  903. if (g_bWarden.BoolValue)
  904. {
  905. if (g_bVote.BoolValue)
  906. {
  907. Format(menuinfo, sizeof(menuinfo), "%T", "menu_votewarden", client);
  908. mainmenu.AddItem("votewarden", menuinfo);
  909. }
  910. }
  911. }
  912. }
  913.  
  914. char EventDay[64];
  915. MyJailbreak_GetEventDayName(EventDay);
  916.  
  917. if (StrEqual(EventDay, "none", false)) //is an other event running or set?
  918. {
  919. if (gc_bDays.BoolValue)
  920. {
  921. Format(menuinfo, sizeof(menuinfo), "%T", "menu_voteeventdays", client);
  922. mainmenu.AddItem("votedays", menuinfo);
  923. }
  924. }
  925. if (gc_bTeam.BoolValue)
  926. {
  927. if (GetCommandFlags("sm_guard") != INVALID_FCVAR_FLAGS)
  928. {
  929. Format(menuinfo, sizeof(menuinfo), "%T", "menu_guardct", client);
  930. mainmenu.AddItem("guard", menuinfo);
  931. }
  932. else
  933. {
  934. Format(menuinfo, sizeof(menuinfo), "%T", "menu_joinct", client);
  935. mainmenu.AddItem("ChangeTeamCT", menuinfo);
  936. }
  937. }
  938. }
  939. }
  940. /* PLAYER PLACEHOLDER
  941. Format(menuinfo, sizeof(menuinfo), "%T", "menu_PLACEHOLDER", client);
  942. mainmenu.AddItem("PLACEHOLDER", menuinfo);
  943. */
  944.  
  945. if (g_bRules != null)
  946. {
  947. if (g_bRules.BoolValue)
  948. {
  949. Format(menuinfo, sizeof(menuinfo), "%T", "menu_rules", client);
  950. mainmenu.AddItem("rules", menuinfo);
  951. }
  952. }
  953. if (CheckVipFlag(client, g_sAdminFlag))
  954. {
  955. /* ADMIN PLACEHOLDER
  956. Format(menuinfo, sizeof(menuinfo), "%T", "menu_PLACEHOLDER", client);
  957. mainmenu.AddItem("PLACEHOLDER", menuinfo);
  958. */
  959.  
  960. char EventDay[64];
  961. MyJailbreak_GetEventDayName(EventDay);
  962.  
  963. if (StrEqual(EventDay, "none", false)) //is an other event running or set?
  964. {
  965. if (!warden_iswarden(client))
  966. {
  967. if (gc_bVoting.BoolValue)
  968. {
  969. Format(menuinfo, sizeof(menuinfo), "%T", "menu_voteday", client);
  970. mainmenu.AddItem("voteday", menuinfo);
  971. }
  972. if (gc_bDays.BoolValue)
  973. {
  974. Format(menuinfo, sizeof(menuinfo), "%T", "menu_seteventdays", client);
  975. mainmenu.AddItem("setdays", menuinfo);
  976. }
  977. }
  978. }
  979. if (g_bWarden != null)
  980. {
  981. if (g_bWarden.BoolValue)
  982. {
  983. if (warden_exist())
  984. {
  985. Format(menuinfo, sizeof(menuinfo), "%T", "menu_removewarden", client);
  986. mainmenu.AddItem("removewarden", menuinfo);
  987. }
  988. Format(menuinfo, sizeof(menuinfo), "%T", "menu_setwarden", client);
  989. mainmenu.AddItem("setwarden", menuinfo);
  990. }
  991. }
  992. Format(menuinfo, sizeof(menuinfo), "%T", "menu_admin", client);
  993. mainmenu.AddItem("admin", menuinfo);
  994. }
  995. mainmenu.ExitButton = true;
  996. mainmenu.Display(client, MENU_TIME_FOREVER);
  997. }
  998. }
  999. return Plugin_Handled;
  1000. }
  1001.  
  1002. //Main Handle
  1003.  
  1004. public int JBMenuHandler(Menu mainmenu, MenuAction action, int client, int selection)
  1005. {
  1006. if (action == MenuAction_Select)
  1007. {
  1008. char info[32];
  1009. mainmenu.GetItem(selection, info, sizeof(info));
  1010.  
  1011. if (strcmp(info, "ChangeTeam") == 0)
  1012. {
  1013. ChangeTeam(client, 0);
  1014. }
  1015. /* Command PLACEHOLDER
  1016. else if (strcmp(info, "PLACEHOLDER") == 0)
  1017. {
  1018. FakeClientCommand(client, "sm_YOURCOMMAND");
  1019. }
  1020. */
  1021. else if (strcmp(info, "request") == 0)
  1022. {
  1023. FakeClientCommand(client, "sm_request");
  1024. }
  1025. else if (strcmp(info, "lastR") == 0)
  1026. {
  1027. FakeClientCommand(client, "sm_lr");
  1028. }
  1029. else if (strcmp(info, "setwarden") == 0)
  1030. {
  1031. FakeClientCommand(client, "sm_sw");
  1032. }
  1033. else if (strcmp(info, "rules") == 0)
  1034. {
  1035. FakeClientCommand(client, "sm_rules");
  1036. }
  1037. else if (strcmp(info, "jailshop") == 0)
  1038. {
  1039. FakeClientCommand(client, "sm_jailshop");
  1040. }
  1041. else if (strcmp(info, "guns") == 0)
  1042. {
  1043. FakeClientCommand(client, "sm_weapon");
  1044. }
  1045. else if (strcmp(info, "playerfreeday") == 0)
  1046. {
  1047. FakeClientCommand(client, "sm_givefreeday");
  1048. }
  1049. else if (strcmp(info, "votedays") == 0)
  1050. {
  1051. FakeClientCommand(client, "sm_eventdays");
  1052. }
  1053. else if (strcmp(info, "voteday") == 0)
  1054. {
  1055. FakeClientCommand(client, "sm_voteday");
  1056. }
  1057. else if (strcmp(info, "setdays") == 0)
  1058. {
  1059. FakeClientCommand(client, "sm_setday");
  1060. }
  1061. else if (strcmp(info, "orders") == 0)
  1062. {
  1063. FakeClientCommand(client, "sm_order");
  1064. }
  1065. else if (strcmp(info, "setdeputy") == 0)
  1066. {
  1067. FakeClientCommand(client, "sm_deputy");
  1068. }
  1069. else if (strcmp(info, "count") == 0)
  1070. {
  1071. FakeClientCommand(client, "sm_count");
  1072. }
  1073. else if (strcmp(info, "laser") == 0)
  1074. {
  1075. FakeClientCommand(client, "sm_laser");
  1076. }
  1077. else if (strcmp(info, "painter") == 0)
  1078. {
  1079. FakeClientCommand(client, "sm_painter");
  1080. }
  1081. else if (strcmp(info, "extend") == 0)
  1082. {
  1083. FakeClientCommand(client, "sm_extend");
  1084. }
  1085. else if (strcmp(info, "admin") == 0)
  1086. {
  1087. FakeClientCommand(client, "sm_admin");
  1088. }
  1089. else if (strcmp(info, "countdown") == 0)
  1090. {
  1091. FakeClientCommand(client, "sm_cdmenu");
  1092. }
  1093. else if (strcmp(info, "mute") == 0)
  1094. {
  1095. FakeClientCommand(client, "sm_wmute");
  1096. }
  1097. else if (strcmp(info, "rebel") == 0)
  1098. {
  1099. FakeClientCommand(client, "sm_markrebel");
  1100. }
  1101. else if (strcmp(info, "kill") == 0)
  1102. {
  1103. FakeClientCommand(client, "sm_killrandom");
  1104. }
  1105. else if (strcmp(info, "check") == 0)
  1106. {
  1107. FakeClientCommand(client, "sm_checkplayers");
  1108. }
  1109. else if (strcmp(info, "guard") == 0)
  1110. {
  1111. FakeClientCommand(client, "sm_guard");
  1112. }
  1113. else if (strcmp(info, "getwarden") == 0)
  1114. {
  1115. FakeClientCommand(client, "sm_warden");
  1116. Command_OpenMenu(client, 0);
  1117. }
  1118. else if (strcmp(info, "unwarden") == 0)
  1119. {
  1120. FakeClientCommand(client, "sm_unwarden");
  1121. Command_OpenMenu(client, 0);
  1122. }
  1123. else if (strcmp(info, "undeputy") == 0)
  1124. {
  1125. FakeClientCommand(client, "sm_undeputy");
  1126. Command_OpenMenu(client, 0);
  1127. }
  1128. else if (strcmp(info, "removewarden") == 0)
  1129. {
  1130. FakeClientCommand(client, "sm_removewarden");
  1131. if (!gc_bClose.BoolValue)
  1132. {
  1133. Command_OpenMenu(client, 0);
  1134. }
  1135. }
  1136. else if (strcmp(info, "sparks") == 0)
  1137. {
  1138. FakeClientCommand(client, "sm_sparks");
  1139. if (!gc_bClose.BoolValue)
  1140. {
  1141. Command_OpenMenu(client, 0);
  1142. }
  1143. }
  1144. else if (strcmp(info, "becomedeputy") == 0)
  1145. {
  1146. FakeClientCommand(client, "sm_deputy");
  1147. if (!gc_bClose.BoolValue)
  1148. {
  1149. Command_OpenMenu(client, 0);
  1150. }
  1151. }
  1152. else if (strcmp(info, "setff") == 0)
  1153. {
  1154. FakeClientCommand(client, "sm_setff");
  1155. if (!gc_bClose.BoolValue)
  1156. {
  1157. Command_OpenMenu(client, 0);
  1158. }
  1159. }
  1160. else if (strcmp(info, "math") == 0)
  1161. {
  1162. FakeClientCommand(client, "sm_math");
  1163. if (!gc_bClose.BoolValue)
  1164. {
  1165. Command_OpenMenu(client, 0);
  1166. }
  1167. }
  1168. else if (strcmp(info, "cellclose") == 0)
  1169. {
  1170. FakeClientCommand(client, "sm_close");
  1171. if (!gc_bClose.BoolValue)
  1172. {
  1173. Command_OpenMenu(client, 0);
  1174. }
  1175. }
  1176. else if (strcmp(info, "cellopen") == 0)
  1177. {
  1178. FakeClientCommand(client, "sm_open");
  1179. if (!gc_bClose.BoolValue)
  1180. {
  1181. Command_OpenMenu(client, 0);
  1182. }
  1183. }
  1184. else if (strcmp(info, "noblock") == 0)
  1185. {
  1186. FakeClientCommand(client, "sm_noblock");
  1187. if (!gc_bClose.BoolValue)
  1188. {
  1189. Command_OpenMenu(client, 0);
  1190. }
  1191. }
  1192. else if (strcmp(info, "votewarden") == 0)
  1193. {
  1194. FakeClientCommand(client, "sm_vetowarden");
  1195. if (!gc_bClose.BoolValue)
  1196. {
  1197. Command_OpenMenu(client, 0);
  1198. }
  1199. }
  1200. else if (action == MenuAction_End)
  1201. {
  1202. delete mainmenu;
  1203. }
  1204. }
  1205. }
  1206.  
  1207. //Event Day Voting Menu
  1208.  
  1209. public Action Command_VoteEventDays(int client, int args)
  1210. {
  1211. if (gc_bDays.BoolValue)
  1212. {
  1213. Menu daysmenu = new Menu(VoteEventMenuHandler);
  1214.  
  1215. char menuinfo[255];
  1216.  
  1217. Format(menuinfo, sizeof(menuinfo), "%T", "menu_event_Titlevote", client);
  1218. daysmenu.SetTitle(menuinfo);
  1219.  
  1220. if (g_bWar != null)
  1221. {
  1222. if (g_bWar.BoolValue)
  1223. {
  1224. Format(menuinfo, sizeof(menuinfo), "%T", "menu_war", client);
  1225. daysmenu.AddItem("votewar", menuinfo);
  1226. }
  1227. }
  1228. if (g_bFFA != null)
  1229. {
  1230. if (g_bFFA.BoolValue)
  1231. {
  1232. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffa", client);
  1233. daysmenu.AddItem("voteffa", menuinfo);
  1234. }
  1235. }
  1236. if (g_bZombie != null)
  1237. {
  1238. if (g_bZombie.BoolValue)
  1239. {
  1240. Format(menuinfo, sizeof(menuinfo), "%T", "menu_zombie", client);
  1241. daysmenu.AddItem("votezombie", menuinfo);
  1242. }
  1243. }
  1244. if (g_bHide != null)
  1245. {
  1246. if (g_bHide.BoolValue)
  1247. {
  1248. Format(menuinfo, sizeof(menuinfo), "%T", "menu_hide", client);
  1249. daysmenu.AddItem("votehide", menuinfo);
  1250. }
  1251. }
  1252. if (g_bCatch != null)
  1253. {
  1254. if (g_bCatch.BoolValue)
  1255. {
  1256. Format(menuinfo, sizeof(menuinfo), "%T", "menu_catch", client);
  1257. daysmenu.AddItem("votecatch", menuinfo);
  1258. }
  1259. }
  1260. if (g_bSuicideBomber != null)
  1261. {
  1262. if (g_bSuicideBomber.BoolValue)
  1263. {
  1264. Format(menuinfo, sizeof(menuinfo), "%T", "menu_suicidebomber", client);
  1265. daysmenu.AddItem("voteSuicideBomber", menuinfo);
  1266. }
  1267. }
  1268. if (g_bHEbattle != null)
  1269. {
  1270. if (g_bHEbattle.BoolValue)
  1271. {
  1272. Format(menuinfo, sizeof(menuinfo), "%T", "menu_hebattle", client);
  1273. daysmenu.AddItem("votehebattle", menuinfo);
  1274. }
  1275. }
  1276. if (g_bNoScope != null)
  1277. {
  1278. if (g_bNoScope.BoolValue)
  1279. {
  1280. Format(menuinfo, sizeof(menuinfo), "%T", "menu_noscope", client);
  1281. daysmenu.AddItem("votenoscope", menuinfo);
  1282. }
  1283. }
  1284. if (g_bDuckHunt != null)
  1285. {
  1286. if (g_bDuckHunt.BoolValue)
  1287. {
  1288. Format(menuinfo, sizeof(menuinfo), "%T", "menu_duckhunt", client);
  1289. daysmenu.AddItem("voteduckhunt", menuinfo);
  1290. }
  1291. }
  1292. if (g_bZeus != null)
  1293. {
  1294. if (g_bZeus.BoolValue)
  1295. {
  1296. Format(menuinfo, sizeof(menuinfo), "%T", "menu_zeus", client);
  1297. daysmenu.AddItem("votezeus", menuinfo);
  1298. }
  1299. }
  1300. if (g_bDealDamage != null)
  1301. {
  1302. if (g_bDealDamage.BoolValue)
  1303. {
  1304. Format(menuinfo, sizeof(menuinfo), "%T", "menu_dealdamge", client);
  1305. daysmenu.AddItem("votedeal", menuinfo);
  1306. }
  1307. }
  1308. if (g_bDrunk != null)
  1309. {
  1310. if (g_bDrunk.BoolValue)
  1311. {
  1312. Format(menuinfo, sizeof(menuinfo), "%T", "menu_drunk", client);
  1313. daysmenu.AddItem("votedrunk", menuinfo);
  1314. }
  1315. }
  1316. if (g_bKnife != null)
  1317. {
  1318. if (g_bKnife.BoolValue)
  1319. {
  1320. Format(menuinfo, sizeof(menuinfo), "%T", "menu_knifefight", client);
  1321. daysmenu.AddItem("voteknife", menuinfo);
  1322. }
  1323. }
  1324. if (g_bTorch != null)
  1325. {
  1326. if (g_bTorch.BoolValue)
  1327. {
  1328. Format(menuinfo, sizeof(menuinfo), "%T", "menu_torch", client);
  1329. daysmenu.AddItem("votetorch", menuinfo);
  1330. }
  1331. }
  1332. if (g_bCowboy != null)
  1333. {
  1334. if (g_bCowboy.BoolValue)
  1335. {
  1336. Format(menuinfo, sizeof(menuinfo), "%T", "menu_cowboy", client);
  1337. daysmenu.AddItem("votecowboy", menuinfo);
  1338. }
  1339. }
  1340. if (g_bFreeday != null)
  1341. {
  1342. if (g_bFreeday.BoolValue)
  1343. {
  1344. Format(menuinfo, sizeof(menuinfo), "%T", "menu_Freeday", client);
  1345. daysmenu.AddItem("voteFreeday", menuinfo);
  1346. }
  1347. }
  1348. daysmenu.ExitButton = true;
  1349. daysmenu.ExitBackButton = true;
  1350. daysmenu.Display(client, MENU_TIME_FOREVER);
  1351. }
  1352. return Plugin_Handled;
  1353. }
  1354.  
  1355. //Event Day Voting Handler
  1356.  
  1357. public int VoteEventMenuHandler(Menu daysmenu, MenuAction action, int client, int selection)
  1358. {
  1359. if (action == MenuAction_Select)
  1360. {
  1361. char info[32];
  1362.  
  1363. daysmenu.GetItem(selection, info, sizeof(info));
  1364.  
  1365. if (strcmp(info, "votewar") == 0)
  1366. {
  1367. FakeClientCommand(client, "sm_war");
  1368. if (!gc_bClose.BoolValue)
  1369. {
  1370. Command_OpenMenu(client, 0);
  1371. }
  1372. }
  1373. else if (strcmp(info, "voteffa") == 0)
  1374. {
  1375. FakeClientCommand(client, "sm_ffa");
  1376. if (!gc_bClose.BoolValue)
  1377. {
  1378. Command_OpenMenu(client, 0);
  1379. }
  1380. }
  1381. else if (strcmp(info, "votezombie") == 0)
  1382. {
  1383. FakeClientCommand(client, "sm_zombie");
  1384. if (!gc_bClose.BoolValue)
  1385. {
  1386. Command_OpenMenu(client, 0);
  1387. }
  1388. }
  1389. else if (strcmp(info, "votezeus") == 0 )
  1390. {
  1391. FakeClientCommand(client, "sm_zeus");
  1392. if (!gc_bClose.BoolValue)
  1393. {
  1394. Command_OpenMenu(client, 0);
  1395. }
  1396. }
  1397. else if (strcmp(info, "votecatch") == 0 )
  1398. {
  1399. FakeClientCommand(client, "sm_catch");
  1400. if (!gc_bClose.BoolValue)
  1401. {
  1402. Command_OpenMenu(client, 0);
  1403. }
  1404. }
  1405. else if (strcmp(info, "votedrunk") == 0 )
  1406. {
  1407. FakeClientCommand(client, "sm_drunk");
  1408. if (!gc_bClose.BoolValue)
  1409. {
  1410. Command_OpenMenu(client, 0);
  1411. }
  1412. }
  1413. else if (strcmp(info, "votecowboy") == 0 )
  1414. {
  1415. FakeClientCommand(client, "sm_cowboy");
  1416. if (!gc_bClose.BoolValue)
  1417. {
  1418. Command_OpenMenu(client, 0);
  1419. }
  1420. }
  1421. else if (strcmp(info, "voteSuicideBomber") == 0 )
  1422. {
  1423. FakeClientCommand(client, "sm_suicidebomber");
  1424. if (!gc_bClose.BoolValue)
  1425. {
  1426. Command_OpenMenu(client, 0);
  1427. }
  1428. }
  1429. else if (strcmp(info, "votenoscope") == 0 )
  1430. {
  1431. FakeClientCommand(client, "sm_noscope");
  1432. if (!gc_bClose.BoolValue)
  1433. {
  1434. Command_OpenMenu(client, 0);
  1435. }
  1436. }
  1437. else if (strcmp(info, "votetorch") == 0 )
  1438. {
  1439. FakeClientCommand(client, "sm_torch");
  1440. if (!gc_bClose.BoolValue)
  1441. {
  1442. Command_OpenMenu(client, 0);
  1443. }
  1444. }
  1445. else if (strcmp(info, "votedeal") == 0 )
  1446. {
  1447. FakeClientCommand(client, "sm_dealdamage");
  1448. if (!gc_bClose.BoolValue)
  1449. {
  1450. Command_OpenMenu(client, 0);
  1451. }
  1452. }
  1453. else if (strcmp(info, "votehebattle") == 0 )
  1454. {
  1455. FakeClientCommand(client, "sm_hebattle");
  1456. if (!gc_bClose.BoolValue)
  1457. {
  1458. Command_OpenMenu(client, 0);
  1459. }
  1460. }
  1461. else if (strcmp(info, "voteduckhunt") == 0 )
  1462. {
  1463. FakeClientCommand(client, "sm_duckhunt");
  1464. if (!gc_bClose.BoolValue)
  1465. {
  1466. Command_OpenMenu(client, 0);
  1467. }
  1468. }
  1469. else if (strcmp(info, "votehide") == 0 )
  1470. {
  1471. FakeClientCommand(client, "sm_hide");
  1472. if (!gc_bClose.BoolValue)
  1473. {
  1474. Command_OpenMenu(client, 0);
  1475. }
  1476. }
  1477. else if (strcmp(info, "voteknife") == 0 )
  1478. {
  1479. FakeClientCommand(client, "sm_knifefight");
  1480. if (!gc_bClose.BoolValue)
  1481. {
  1482. Command_OpenMenu(client, 0);
  1483. }
  1484. }
  1485. else if (strcmp(info, "voteFreeday") == 0 )
  1486. {
  1487. FakeClientCommand(client, "sm_Freeday");
  1488. if (!gc_bClose.BoolValue)
  1489. {
  1490. Command_OpenMenu(client, 0);
  1491. }
  1492. }
  1493. }
  1494. else if (action == MenuAction_Cancel)
  1495. {
  1496. if (selection == MenuCancel_ExitBack)
  1497. {
  1498. Command_OpenMenu(client, 0);
  1499. }
  1500. }
  1501. else if (action == MenuAction_End)
  1502. {
  1503. delete daysmenu;
  1504. }
  1505. }
  1506.  
  1507. // Event Days Set Menu
  1508.  
  1509. public Action Command_SetEventDay(int client, int args)
  1510. {
  1511. if (gc_bDays.BoolValue && (warden_iswarden(client) || CheckVipFlag(client, g_sAdminFlag)))
  1512. {
  1513. Menu daysmenu = new Menu(SetEventMenuHandler);
  1514.  
  1515. char menuinfo[255];
  1516.  
  1517. Format(menuinfo, sizeof(menuinfo), "%T", "menu_event_Titlestart", client);
  1518. daysmenu.SetTitle(menuinfo);
  1519.  
  1520. if (g_bWar != null)
  1521. {
  1522. if (g_bWar.BoolValue)
  1523. {
  1524. Format(menuinfo, sizeof(menuinfo), "%T", "menu_war", client);
  1525. daysmenu.AddItem("setwar", menuinfo);
  1526. }
  1527. }
  1528. if (g_bFFA != null)
  1529. {
  1530. if (g_bFFA.BoolValue)
  1531. {
  1532. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffa", client);
  1533. daysmenu.AddItem("setffa", menuinfo);
  1534. }
  1535. }
  1536. if (g_bZombie != null)
  1537. {
  1538. if (g_bZombie.BoolValue)
  1539. {
  1540. Format(menuinfo, sizeof(menuinfo), "%T", "menu_zombie", client);
  1541. daysmenu.AddItem("setzombie", menuinfo);
  1542. }
  1543. }
  1544. if (g_bHide != null)
  1545. {
  1546. if (g_bHide.BoolValue)
  1547. {
  1548. Format(menuinfo, sizeof(menuinfo), "%T", "menu_hide", client);
  1549. daysmenu.AddItem("sethide", menuinfo);
  1550. }
  1551. }
  1552. if (g_bCatch != null)
  1553. {
  1554. if (g_bCatch.BoolValue)
  1555. {
  1556. Format(menuinfo, sizeof(menuinfo), "%T", "menu_catch", client);
  1557. daysmenu.AddItem("setcatch", menuinfo);
  1558. }
  1559. }
  1560. if (g_bSuicideBomber != null)
  1561. {
  1562. if (g_bSuicideBomber.BoolValue)
  1563. {
  1564. Format(menuinfo, sizeof(menuinfo), "%T", "menu_suicidebomber", client);
  1565. daysmenu.AddItem("setSuicideBomber", menuinfo);
  1566. }
  1567. }
  1568. if (g_bHEbattle != null)
  1569. {
  1570. if (g_bHEbattle.BoolValue)
  1571. {
  1572. Format(menuinfo, sizeof(menuinfo), "%T", "menu_hebattle", client);
  1573. daysmenu.AddItem("sethebattle", menuinfo);
  1574. }
  1575. }
  1576. if (g_bNoScope != null)
  1577. {
  1578. if (g_bNoScope.BoolValue)
  1579. {
  1580. Format(menuinfo, sizeof(menuinfo), "%T", "menu_noscope", client);
  1581. daysmenu.AddItem("setnoscope", menuinfo);
  1582. }
  1583. }
  1584. if (g_bDuckHunt != null)
  1585. {
  1586. if (g_bDuckHunt.BoolValue)
  1587. {
  1588. Format(menuinfo, sizeof(menuinfo), "%T", "menu_duckhunt", client);
  1589. daysmenu.AddItem("setduckhunt", menuinfo);
  1590. }
  1591. }
  1592. if (g_bDealDamage != null)
  1593. {
  1594. if (g_bDealDamage.BoolValue)
  1595. {
  1596. Format(menuinfo, sizeof(menuinfo), "%T", "menu_dealdamge", client);
  1597. daysmenu.AddItem("setdeal", menuinfo);
  1598. }
  1599. }
  1600. if (g_bZeus != null)
  1601. {
  1602. if (g_bZeus.BoolValue)
  1603. {
  1604. Format(menuinfo, sizeof(menuinfo), "%T", "menu_zeus", client);
  1605. daysmenu.AddItem("setzeus", menuinfo);
  1606. }
  1607. }
  1608. if (g_bDrunk != null)
  1609. {
  1610. if (g_bDrunk.BoolValue)
  1611. {
  1612. Format(menuinfo, sizeof(menuinfo), "%T", "menu_drunk", client);
  1613. daysmenu.AddItem("setdrunk", menuinfo);
  1614. }
  1615. }
  1616. if (g_bKnife != null)
  1617. {
  1618. if (g_bKnife.BoolValue)
  1619. {
  1620. Format(menuinfo, sizeof(menuinfo), "%T", "menu_knifefight", client);
  1621. daysmenu.AddItem("setknife", menuinfo);
  1622. }
  1623. }
  1624. if (g_bTorch != null)
  1625. {
  1626. if (g_bTorch.BoolValue)
  1627. {
  1628. Format(menuinfo, sizeof(menuinfo), "%T", "menu_torch", client);
  1629. daysmenu.AddItem("settorch", menuinfo);
  1630. }
  1631. }
  1632. if (g_bCowboy != null)
  1633. {
  1634. if (g_bCowboy.BoolValue)
  1635. {
  1636. Format(menuinfo, sizeof(menuinfo), "%T", "menu_cowboy", client);
  1637. daysmenu.AddItem("setcowboy", menuinfo);
  1638. }
  1639. }
  1640. if (g_bFreeday != null)
  1641. {
  1642. if (g_bFreeday.BoolValue)
  1643. {
  1644. Format(menuinfo, sizeof(menuinfo), "%T", "menu_Freeday", client);
  1645. daysmenu.AddItem("setFreeday", menuinfo);
  1646. }
  1647. }
  1648. daysmenu.ExitButton = true;
  1649. daysmenu.ExitBackButton = true;
  1650. daysmenu.Display(client, MENU_TIME_FOREVER);
  1651. }
  1652. return Plugin_Handled;
  1653. }
  1654.  
  1655. // Event Days Set Handler
  1656.  
  1657. public int SetEventMenuHandler(Menu daysmenu, MenuAction action, int client, int selection)
  1658. {
  1659. if (action == MenuAction_Select)
  1660. {
  1661. char info[32];
  1662.  
  1663. daysmenu.GetItem(selection, info, sizeof(info));
  1664.  
  1665. if (strcmp(info, "setwar") == 0)
  1666. {
  1667. FakeClientCommand(client, "sm_setwar");
  1668. if (!gc_bClose.BoolValue)
  1669. {
  1670. Command_OpenMenu(client, 0);
  1671. }
  1672. }
  1673. else if (strcmp(info, "setffa") == 0)
  1674. {
  1675. FakeClientCommand(client, "sm_setffa");
  1676. if (!gc_bClose.BoolValue)
  1677. {
  1678. Command_OpenMenu(client, 0);
  1679. }
  1680. }
  1681. else if (strcmp(info, "setzombie") == 0)
  1682. {
  1683. FakeClientCommand(client, "sm_setzombie");
  1684. if (!gc_bClose.BoolValue)
  1685. {
  1686. Command_OpenMenu(client, 0);
  1687. }
  1688. }
  1689. else if (strcmp(info, "settorch") == 0 )
  1690. {
  1691. FakeClientCommand(client, "sm_settorch");
  1692. if (!gc_bClose.BoolValue)
  1693. {
  1694. Command_OpenMenu(client, 0);
  1695. }
  1696. }
  1697. else if (strcmp(info, "setcowboy") == 0 )
  1698. {
  1699. FakeClientCommand(client, "sm_setcowboy");
  1700. if (!gc_bClose.BoolValue)
  1701. {
  1702. Command_OpenMenu(client, 0);
  1703. }
  1704. }
  1705. else if (strcmp(info, "setzeus") == 0 )
  1706. {
  1707. FakeClientCommand(client, "sm_setzeus");
  1708. if (!gc_bClose.BoolValue)
  1709. {
  1710. Command_OpenMenu(client, 0);
  1711. }
  1712. }
  1713. else if (strcmp(info, "setdeal") == 0 )
  1714. {
  1715. FakeClientCommand(client, "sm_setdealdamage");
  1716. if (!gc_bClose.BoolValue)
  1717. {
  1718. Command_OpenMenu(client, 0);
  1719. }
  1720. }
  1721. else if (strcmp(info, "setcatch") == 0 )
  1722. {
  1723. FakeClientCommand(client, "sm_setcatch");
  1724. if (!gc_bClose.BoolValue)
  1725. {
  1726. Command_OpenMenu(client, 0);
  1727. }
  1728. }
  1729. else if (strcmp(info, "setdrunk") == 0 )
  1730. {
  1731. FakeClientCommand(client, "sm_setdrunk");
  1732. if (!gc_bClose.BoolValue)
  1733. {
  1734. Command_OpenMenu(client, 0);
  1735. }
  1736. }
  1737. else if (strcmp(info, "setSuicideBomber") == 0 )
  1738. {
  1739. FakeClientCommand(client, "sm_setsuicidebomber");
  1740. if (!gc_bClose.BoolValue)
  1741. {
  1742. Command_OpenMenu(client, 0);
  1743. }
  1744. }
  1745. else if (strcmp(info, "setnoscope") == 0 )
  1746. {
  1747. FakeClientCommand(client, "sm_setnoscope");
  1748. if (!gc_bClose.BoolValue)
  1749. {
  1750. Command_OpenMenu(client, 0);
  1751. }
  1752. }
  1753. else if (strcmp(info, "sethebattle") == 0 )
  1754. {
  1755. FakeClientCommand(client, "sm_sethebattle");
  1756. if (!gc_bClose.BoolValue)
  1757. {
  1758. Command_OpenMenu(client, 0);
  1759. }
  1760. }
  1761. else if (strcmp(info, "setduckhunt") == 0 )
  1762. {
  1763. FakeClientCommand(client, "sm_setduckhunt");
  1764. if (!gc_bClose.BoolValue)
  1765. {
  1766. Command_OpenMenu(client, 0);
  1767. }
  1768. }
  1769. else if (strcmp(info, "sethide") == 0 )
  1770. {
  1771. FakeClientCommand(client, "sm_sethide");
  1772. if (!gc_bClose.BoolValue)
  1773. {
  1774. Command_OpenMenu(client, 0);
  1775. }
  1776. }
  1777. else if (strcmp(info, "setknife") == 0 )
  1778. {
  1779. FakeClientCommand(client, "sm_setknifefight");
  1780. if (!gc_bClose.BoolValue)
  1781. {
  1782. Command_OpenMenu(client, 0);
  1783. }
  1784. }
  1785. else if (strcmp(info, "setFreeday") == 0 )
  1786. {
  1787. FakeClientCommand(client, "sm_setfreeday");
  1788. if (!gc_bClose.BoolValue)
  1789. {
  1790. Command_OpenMenu(client, 0);
  1791. }
  1792. }
  1793. }
  1794. else if (action == MenuAction_Cancel)
  1795. {
  1796. if (selection == MenuCancel_ExitBack)
  1797. {
  1798. Command_OpenMenu(client, 0);
  1799. }
  1800. }
  1801. else if (action == MenuAction_End)
  1802. {
  1803. delete daysmenu;
  1804. }
  1805. }
  1806.  
  1807. //Switch Team Menu
  1808.  
  1809. public Action ChangeTeam(int client, int args)
  1810. {
  1811. char info[255];
  1812. Menu menu1 = CreateMenu(changemenu);
  1813. Format(info, sizeof(info), "%T", "warden_sure", client);
  1814. menu1.SetTitle(info);
  1815. Format(info, sizeof(info), "%T", "warden_no", client);
  1816. menu1.AddItem("1", info);
  1817. Format(info, sizeof(info), "%T", "warden_yes", client);
  1818. menu1.AddItem("0", info);
  1819. menu1.ExitBackButton = true;
  1820. menu1.ExitButton = true;
  1821. menu1.Display(client, MENU_TIME_FOREVER);
  1822. }
  1823.  
  1824. //Switch Team Handler
  1825.  
  1826. public int changemenu(Menu menu, MenuAction action, int client, int selection)
  1827. {
  1828. if (action == MenuAction_Select)
  1829. {
  1830. char Item[11];
  1831. menu.GetItem(selection, Item, sizeof(Item));
  1832. int choice = StringToInt(Item);
  1833. if (choice == 1)
  1834. {
  1835. Command_OpenMenu(client, 0);
  1836. }
  1837. else if (choice == 0)
  1838. {
  1839. if (GetClientTeam(client) == CS_TEAM_T)
  1840. {
  1841. ClientCommand(client, "jointeam %i", CS_TEAM_CT);
  1842. }
  1843. if (GetClientTeam(client) == CS_TEAM_CT)
  1844. {
  1845. ClientCommand(client, "jointeam %i", CS_TEAM_T);
  1846. }
  1847. }
  1848. }
  1849. else if (action == MenuAction_Cancel)
  1850. {
  1851. if (selection == MenuCancel_ExitBack)
  1852. {
  1853. FakeClientCommand(client, "sm_menu");
  1854. }
  1855. }
  1856. else if (action == MenuAction_End)
  1857. {
  1858. delete menu;
  1859. }
  1860. }
  1861.  
  1862.  
  1863. public int VotingMenuHandler(Menu menu, MenuAction action, int param1, int param2)
  1864. {
  1865. if (action == MenuAction_End)
  1866. {
  1867. /* This is called after VoteEnd */
  1868. delete menu;
  1869. }
  1870. }
  1871.  
  1872. public void VotingResults(Menu menu, int num_votes, int num_clients, const int[][] client_info, int num_items, const int[][] item_info)
  1873. {
  1874. /* See if there were multiple winners */
  1875. int winner = 0;
  1876. if (num_items > 1 && (item_info[0][VOTEINFO_ITEM_VOTES] == item_info[1][VOTEINFO_ITEM_VOTES]))
  1877. {
  1878. winner = GetRandomInt(0, 1);
  1879. CPrintToChatAll("%t %t", "menu_tag", "menu_votingdraw");
  1880. }
  1881. char event[64];
  1882. menu.GetItem(item_info[winner][VOTEINFO_ITEM_INDEX], event, sizeof(event));
  1883. CPrintToChatAll("%t %t", "menu_tag", "menu_votingwon", event, num_clients, num_items);
  1884. ServerCommand("sm_set%s", event);
  1885. }
  1886.  
  1887. public Action Command_VotingMenu(int client, int args)
  1888. {
  1889. if (gc_bPlugin.BoolValue && gc_bVoting.BoolValue)
  1890. {
  1891. if ((warden_iswarden(client) && gc_bSetW.BoolValue) || (CheckVipFlag(client, g_sAdminFlag) && gc_bSetA.BoolValue))
  1892. {
  1893. if ((GetTeamClientCount(CS_TEAM_CT) > 0) && (GetTeamClientCount(CS_TEAM_T) > 0 ))
  1894. {
  1895. char EventDay[64];
  1896. MyJailbreak_GetEventDayName(EventDay);
  1897.  
  1898. if (StrEqual(EventDay, "none", false))
  1899. {
  1900. if (g_iCoolDown == 0)
  1901. {
  1902. if (IsVoteInProgress())
  1903. {
  1904. return Plugin_Handled;
  1905. }
  1906. char menuinfo[64];
  1907. Menu menu = new Menu(VotingMenuHandler);
  1908. menu.VoteResultCallback = VotingResults;
  1909. Format(menuinfo, sizeof(menuinfo), "%T", "menu_voting", LANG_SERVER);
  1910. menu.SetTitle(menuinfo);
  1911.  
  1912. if (GetCommandFlags("sm_setwar") != INVALID_FCVAR_FLAGS)
  1913. {
  1914. Format(menuinfo, sizeof(menuinfo), "%T", "menu_war", LANG_SERVER);
  1915. menu.AddItem("war", menuinfo);
  1916. }
  1917. if (GetCommandFlags("sm_setffa") != INVALID_FCVAR_FLAGS)
  1918. {
  1919. Format(menuinfo, sizeof(menuinfo), "%T", "menu_ffa", LANG_SERVER);
  1920. menu.AddItem("ffa", menuinfo);
  1921. }
  1922. if (GetCommandFlags("sm_setzombie") != INVALID_FCVAR_FLAGS)
  1923. {
  1924. Format(menuinfo, sizeof(menuinfo), "%T", "menu_zombie", LANG_SERVER);
  1925. menu.AddItem("zombie", menuinfo);
  1926. }
  1927. if (GetCommandFlags("sm_sethide") != INVALID_FCVAR_FLAGS)
  1928. {
  1929. Format(menuinfo, sizeof(menuinfo), "%T", "menu_hide", LANG_SERVER);
  1930. menu.AddItem("hide", menuinfo);
  1931. }
  1932. if (GetCommandFlags("sm_setcatch") != INVALID_FCVAR_FLAGS)
  1933. {
  1934. Format(menuinfo, sizeof(menuinfo), "%T", "menu_catch", LANG_SERVER);
  1935. menu.AddItem("catch", menuinfo);
  1936. }
  1937. if (GetCommandFlags("sm_setsuicidebomber") != INVALID_FCVAR_FLAGS)
  1938. {
  1939. Format(menuinfo, sizeof(menuinfo), "%T", "menu_suicidebomber", LANG_SERVER);
  1940. menu.AddItem("suicidebomber", menuinfo);
  1941. }
  1942. if (GetCommandFlags("sm_sethebattle") != INVALID_FCVAR_FLAGS)
  1943. {
  1944. Format(menuinfo, sizeof(menuinfo), "%T", "menu_hebattle", LANG_SERVER);
  1945. menu.AddItem("hebattle", menuinfo);
  1946. }
  1947. if (GetCommandFlags("sm_setnoscope") != INVALID_FCVAR_FLAGS)
  1948. {
  1949. Format(menuinfo, sizeof(menuinfo), "%T", "menu_noscope", LANG_SERVER);
  1950. menu.AddItem("noscope", menuinfo);
  1951. }
  1952. if (GetCommandFlags("sm_setduckhunt") != INVALID_FCVAR_FLAGS)
  1953. {
  1954. Format(menuinfo, sizeof(menuinfo), "%T", "menu_duckhunt", LANG_SERVER);
  1955. menu.AddItem("duckhunt", menuinfo);
  1956. }
  1957. if (GetCommandFlags("sm_setzeus") != INVALID_FCVAR_FLAGS)
  1958. {
  1959. Format(menuinfo, sizeof(menuinfo), "%T", "menu_zeus", LANG_SERVER);
  1960. menu.AddItem("zeus", menuinfo);
  1961. }
  1962. if (GetCommandFlags("sm_setdealdamage") != INVALID_FCVAR_FLAGS)
  1963. {
  1964. Format(menuinfo, sizeof(menuinfo), "%T", "menu_dealdamge", LANG_SERVER);
  1965. menu.AddItem("dealdamage", menuinfo);
  1966. }
  1967. if (GetCommandFlags("sm_setdrunk") != INVALID_FCVAR_FLAGS)
  1968. {
  1969. Format(menuinfo, sizeof(menuinfo), "%T", "menu_drunk", LANG_SERVER);
  1970. menu.AddItem("drunk", menuinfo);
  1971. }
  1972. if (GetCommandFlags("sm_setknifefight") != INVALID_FCVAR_FLAGS)
  1973. {
  1974. Format(menuinfo, sizeof(menuinfo), "%T", "menu_knifefight", LANG_SERVER);
  1975. menu.AddItem("knifefight", menuinfo);
  1976. }
  1977. if (GetCommandFlags("sm_settorch") != INVALID_FCVAR_FLAGS)
  1978. {
  1979. Format(menuinfo, sizeof(menuinfo), "%T", "menu_torch", LANG_SERVER);
  1980. menu.AddItem("torch", menuinfo);
  1981. }
  1982. if (GetCommandFlags("sm_setcowboy") != INVALID_FCVAR_FLAGS)
  1983. {
  1984. Format(menuinfo, sizeof(menuinfo), "%T", "menu_cowboy", LANG_SERVER);
  1985. menu.AddItem("cowboy", menuinfo);
  1986. }
  1987. if (GetCommandFlags("sm_setfreeday") != INVALID_FCVAR_FLAGS)
  1988. {
  1989. Format(menuinfo, sizeof(menuinfo), "%T", "menu_Freeday", LANG_SERVER);
  1990. menu.AddItem("freeday", menuinfo);
  1991. }
  1992. menu.ExitButton = true;
  1993. menu.DisplayVoteToAll(25);
  1994. g_iCoolDown = gc_iCooldownDay.IntValue + 1;
  1995. }
  1996. else CReplyToCommand(client, "%t %t", "menu_tag", "menu_wait", g_iCoolDown);
  1997. }
  1998. else CReplyToCommand(client, "%t %t", "menu_tag", "menu_progress", EventDay);
  1999. }
  2000. else CReplyToCommand(client, "%t %t", "menu_tag", "menu_minplayer");
  2001. }
  2002. else CReplyToCommand(client, "%t %t", "menu_tag", "warden_notwarden");
  2003. }
  2004. else CReplyToCommand(client, "%t %t", "menu_tag", "menu_disabled");
  2005. return Plugin_Handled;
  2006. }
  2007.  
  2008.  
  2009. /******************************************************************************
  2010. TIMER
  2011. ******************************************************************************/
  2012.  
  2013.  
  2014. public Action Timer_WelcomeMessage(Handle timer, any client)
  2015. {
  2016. if (gc_bWelcome.BoolValue && IsValidClient(client, false, true))
  2017. {
  2018. CPrintToChat(client, "%t %t", "menu_tag", "menu_info");
  2019. }
  2020. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement