hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.16. 19:27



Jelenlévő felhasználók

Jelenleg 366 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 364 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: amx super menu
HozzászólásElküldve:2013.03.30. 22:15 
Offline
Tag

Csatlakozott:2013.03.24. 01:57
Hozzászólások:33
Megköszönt másnak: 7 alkalommal
Sziasztok. Letöltöttem az oldalon található amx super 4.2-őt és ugyebár az amxmodx menübe bele rakja de az első menüpontba. Olyan kérdésem lenne hogy ezt hogy lehetne pl. a 3dik oldalra rakni?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx super menu
HozzászólásElküldve:2013.03.31. 08:26 
Offline
Developer
Avatar

Csatlakozott:2011.06.01. 21:11
Hozzászólások:7966
Megköszönt másnak: 295 alkalommal
Megköszönték neki: 537 alkalommal
Forráskód? Talán abba kell átírni.

_________________
http://www.easyrankup.eu


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx super menu
HozzászólásElküldve:2013.03.31. 14:38 
Offline
Tag

Csatlakozott:2013.03.24. 01:57
Hozzászólások:33
Megköszönt másnak: 7 alkalommal
kiki írta:
Forráskód? Talán abba kell átírni.

SMA Forráskód: [ Mindet kijelol ]
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *
  3.  * AMX Super Menu
  4.  * Devloped/Maintained by Yami Kaitou
  5.  * Last Update: 09/13/2008
  6.  *
  7.  * Minimum Requirements
  8.  * AMX Mod X 1.8.0
  9.  * AMX Super 3.7
  10.  *
  11.  * Credits
  12.  * AMX Mod X Dev Team (for their plmenu.amxx plugin)
  13.  * bmann|420 (for creating the AMX Super plugin)
  14.  * |PJ|Shorty (for assisting me in finding out the get_concmd function)
  15.  * If I forgot you, let me know what you did and I will add you
  16.  *
  17.  * * * * * * * * * * * * * * * * * * * * * * * * * * *
  18.  *
  19.  * AMX Mod X script.
  20.  *
  21.  * AMX Super Menu (amx_super_menu.sma)
  22.  * Copyright (C) 2008 ProjectYami (Yami Kaitou)
  23.  *
  24.  * This program is free software; you can redistribute it and/or
  25.  * modify it under the terms of the GNU General Public License
  26.  * as published by the Free Software Foundation; either version 2
  27.  * of the License, or (at your option) any later version.
  28.  *
  29.  * This program is distributed in the hope that it will be useful,
  30.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  32.  * GNU General Public License for more details.
  33.  *
  34.  * You should have received a copy of the GNU General Public License
  35.  * along with this program; if not, write to the Free Software
  36.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  37.  *
  38.  * In addition, as a special exception, the author gives permission to
  39.  * link the code of this program with the Half-Life Game Engine ("HL
  40.  * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  41.  * L.L.C ("Valve"). You must obey the GNU General Public License in all
  42.  * respects for all of the code used other than the HL Engine and MODs
  43.  * from Valve. If you modify this file, you may extend this exception
  44.  * to your version of the file, but you are not obligated to do so. If
  45.  * you do not wish to do so, delete this exception statement from your
  46.  * version.
  47.  * * * * * * * * * * * * * * * * * * * * * * * * * * */
  48.  
  49. #pragma semicolon 1
  50.  
  51. #include <amxmodx>
  52. #include <amxmisc>
  53.  
  54. #define PLUGIN "AMX_Super Menu"
  55. #define AUTHOR "Yami Kaitou"
  56. #define VERSION "0.8.1"
  57.  
  58. enum
  59. {
  60. alltalk = 1,
  61. lock,
  62. unlock,
  63. extend,
  64. gravity,
  65. fire,
  66. flash,
  67. disarm,
  68. rocket,
  69. uberslap,
  70. revive,
  71. quit,
  72. drug,
  73. teamswap,
  74. heal,
  75. armor,
  76. stack,
  77. bury,
  78. unbury,
  79. slay,
  80. god,
  81. noclip,
  82. speed,
  83. unammo,
  84. swap,
  85. givemoney,
  86. takemoney,
  87. badaim,
  88. gag,
  89. ungag,
  90. maxvalue
  91. }
  92.  
  93. new g_mainmenu, g_alltalkmenu, g_extendmenu, g_gravitymenu, menufunc;
  94. new g_menuPosition[33], g_menuPlayers[33][35], g_menuPlayersNum[33], g_menuProperties[33], g_menuProperties2[33], g_menuPlayerName[33][32], g_menu[33];
  95. new menuname[64];
  96. new allkeys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9;
  97. new Callback;
  98. new g_money[33];
  99. new Array:valueArray, accessLevel[maxvalue];
  100.  
  101. new menuCmd[][128] =
  102. {
  103. "status",
  104. "amx_alltalk %s",
  105. "amx_lock %s",
  106. "amx_unlock %s",
  107. "amx_extend %s",
  108. "amx_gravity %s",
  109. "amx_fire ^"%s^"",
  110. "amx_flash ^"%s^"",
  111. "amx_disarm ^"%s^"",
  112. "amx_rocket ^"%s^"",
  113. "amx_uberslap ^"%s^"",
  114. "amx_revive ^"%s^"",
  115. "amx_quit ^"%s^"",
  116. "amx_drug ^"%s^"",
  117. "amx_teamswap",
  118. "amx_heal ^"%s^" %d",
  119. "amx_armor ^"%s^" %d",
  120. "amx_stack ^"%s^" %d",
  121. "amx_bury ^"%s^"",
  122. "amx_unbury ^"%s^"",
  123. "amx_slay2 ^"%s^" %d",
  124. "amx_godmode ^"%s^" %d",
  125. "amx_noclip ^"%s^" %d",
  126. "amx_speed ^"%s^" %d",
  127. "amx_unammo ^"%s^" %d",
  128. "amx_swap ^"%s^" ^"%s^"",
  129. "amx_givemoney ^"%s^" %d",
  130. "amx_takemoney ^"%s^" %d",
  131. "amx_badaim ^"%s^" %d 0",
  132. "amx_gag ^"%s^" %s %d",
  133. "amx_ungag ^"%s^""
  134. };
  135.  
  136. new cmds[][64] =
  137. {
  138. "nothing",
  139. "amx_alltalk",
  140. "amx_lock",
  141. "amx_unlock",
  142. "amx_extend",
  143. "amx_gravity",
  144. "amx_fire",
  145. "amx_flash",
  146. "amx_disarm",
  147. "amx_rocket",
  148. "amx_uberslap",
  149. "amx_revive",
  150. "amx_quit",
  151. "amx_drug",
  152. "amx_teamswap",
  153. "amx_heal",
  154. "amx_armor",
  155. "amx_stack",
  156. "amx_bury",
  157. "amx_unbury",
  158. "amx_slay2",
  159. "amx_godmode",
  160. "amx_noclip",
  161. "amx_speed",
  162. "amx_unammo",
  163. "amx_swap",
  164. "amx_givemoney",
  165. "amx_takemoney",
  166. "amx_badaim",
  167. "amx_gag",
  168. "amx_ungag"
  169. };
  170.  
  171. public plugin_init()
  172. {
  173. register_plugin(PLUGIN, VERSION, AUTHOR);
  174.  
  175. register_cvar("amx_super_menu",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);
  176. menufunc = register_cvar("supermenu_func", "0");
  177. register_dictionary("amx_super_menu.txt");
  178. register_dictionary("common.txt");
  179.  
  180. // Register New Menus
  181. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_MENU0");
  182. g_mainmenu = menu_create(menuname, "mainMenu");
  183. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_MENU1");
  184. g_alltalkmenu = menu_create(menuname, "alltalkMenu");
  185. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_MENU4");
  186. g_extendmenu = menu_create(menuname, "extendMenu");
  187. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_MENU5");
  188. g_gravitymenu = menu_create(menuname, "gravityMenu");
  189.  
  190. // Register Callbacks
  191. Callback = menu_makecallback("menu_callback");
  192.  
  193. // Register Old Menus
  194. register_menucmd(register_menuid("Lock Menu"), allkeys, "lockMenu");
  195. register_menucmd(register_menuid("Player1 Menu"), allkeys, "player1Menu");
  196. register_menucmd(register_menuid("Player2 Menu"), allkeys, "player2Menu");
  197. register_menucmd(register_menuid("Gag Menu"), allkeys, "gagMenu");
  198.  
  199. register_clcmd("say", "handle_say");
  200. register_clcmd("say_team", "handle_say");
  201. register_concmd("supermenu", "handle_cmd", ADMIN_MENU, " - Bring up the menu for AMX_Super");
  202. register_concmd("amx_supermenu", "handle_cmd", ADMIN_MENU, " - Bring up the menu for AMX_Super");
  203. register_concmd("supermenu_edit", "handle_cmd", ADMIN_MENU, " - Allows you to edit the values the menu displays");
  204. register_concmd("amx_supermenu_edit", "handle_cmd", ADMIN_MENU, " - Allows you to edit the values the menu displays");
  205.  
  206. arrayset(accessLevel, -2, maxvalue);
  207. valueArray = ArrayCreate(1, maxvalue);
  208.  
  209. AddMenuItem("AMX_Super Menu", "amx_supermenu", ADMIN_MENU, PLUGIN);
  210.  
  211. }
  212.  
  213. public plugin_cfg()
  214. {
  215. new index = 0, cmd[64], flags, info[128], flag = 52428799, k;
  216. new max = get_concmdsnum(flag);
  217.  
  218. while (index <= max)
  219. {
  220. get_concmd(index++, cmd, charsmax(cmd), flags, info, charsmax(info), flag);
  221.  
  222. k = 1;
  223. while (k < maxvalue && !equal(cmd, cmds[k])) k++;
  224.  
  225. if (k != maxvalue) accessLevel[k] = flags;
  226. }
  227.  
  228. for (new k = 0; k <= maxvalue; k++)
  229. ArrayPushCell(Array:valueArray, 0);
  230.  
  231. build_arrays();
  232. build_menu();
  233. }
  234.  
  235. public handle_say(id)
  236. {
  237. new arg[32];
  238. read_argv(1, arg, charsmax(arg));
  239.  
  240. if (equal(arg, "/supermenu"))
  241. {
  242. menu_display(id, g_mainmenu, 0);
  243. return PLUGIN_HANDLED;
  244. }
  245.  
  246. return PLUGIN_CONTINUE;
  247. }
  248.  
  249. public handle_cmd(id, level, cid)
  250. {
  251. new cmd[64];
  252. read_argv(0, cmd, charsmax(cmd));
  253.  
  254. if (equal(cmd, "supermenu") || equal(cmd, "amx_supermenu"))
  255. menu_display(id, g_mainmenu, 0);
  256. else if (equal(cmd, "supermenu_edit") || equal(cmd, "amx_supermenu_edit"))
  257. {
  258. if (read_argc() < 2)
  259. {
  260. client_print(id, print_console, "%L", id, "AMXSUPER_NOPARM");
  261. client_print(id, print_console, "%L %s <menu to edit> <value1> [value2] [value3] [value4] ...", id, "USAGE", cmd);
  262. return PLUGIN_HANDLED;
  263. }
  264.  
  265. new type[10], value, Array:temp = ArrayCreate();
  266. read_argv(1, type, charsmax(type));
  267.  
  268. if (equal(type, "extend"))
  269. value = extend;
  270. else if (equal(type, "gravity"))
  271. value = gravity;
  272. else if (equal(type, "heal"))
  273. value = heal;
  274. else if (equal(type, "armor"))
  275. value = armor;
  276. else if (equal(type, "money"))
  277. value = givemoney;
  278. else if (equal(type, "badaim"))
  279. value = badaim;
  280. else if (equal(type, "gag"))
  281. value = gag;
  282.  
  283. if (!(get_user_flags(id)&accessLevel[value]))
  284. {
  285. client_print(id, print_console, "%L", id, "NO_ACC_COM");
  286. return PLUGIN_HANDLED;
  287. }
  288. new msg[256], max = ArraySize(Array:ArrayGetCell(Array:valueArray, value)), k = (value == badaim) ? 2 : 0;
  289. if (read_argc() < 3)
  290. {
  291. client_print(id, print_console, "%L", id, "AMXSUPER_NOPARM");
  292. client_print(id, print_console, "%L %s %s <value1> [value2] [value3] [value4] ...", id, "USAGE", cmd, type);
  293. format(msg, charsmax(msg), "%d", ArrayGetCell(Array:ArrayGetCell(Array:valueArray, value), k++));
  294. while (k < max)
  295. format(msg, charsmax(msg), "%s, %d", msg, ArrayGetCell(Array:ArrayGetCell(Array:valueArray, value), k++));
  296. client_print(id, print_console, "%L: %s", id, "AMXSUPER_CURRENT", type, msg);
  297. return PLUGIN_HANDLED;
  298. }
  299.  
  300. if (value == extend)
  301. {
  302. menu_destroy(g_extendmenu);
  303.  
  304. // Recreating it and building it
  305. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_MENU4");
  306. g_extendmenu = menu_create(menuname, "extendMenu");
  307.  
  308. new arg[4], k = 2;
  309. while (true)
  310. {
  311. read_argv(k, arg, charsmax(arg));
  312. if (equal(arg, "")) break;
  313. ArrayPushCell(temp, str_to_num(arg));
  314. k++;
  315. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_EXTEND", arg);
  316. menu_additem(g_extendmenu, menuname, arg);
  317. }
  318. }
  319. else if (value == gravity)
  320. {
  321. menu_destroy(g_gravitymenu);
  322.  
  323. // Recreating it and building it
  324. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_MENU5");
  325. g_gravitymenu = menu_create(menuname, "gravityMenu");
  326.  
  327. new arg[6], k = 2;
  328. while (true)
  329. {
  330. read_argv(k, arg, charsmax(arg));
  331. if (equal(arg, "")) break;
  332. ArrayPushCell(temp, str_to_num(arg));
  333. k++;
  334. menu_additem(g_gravitymenu, arg, arg);
  335. }
  336. }
  337. else
  338. {
  339. if (value == badaim)
  340. {
  341. ArrayPushCell(temp, 0);
  342. ArrayPushCell(temp, 1);
  343. }
  344. new arg[6], k = 2;
  345. while (true)
  346. {
  347. read_argv(k, arg, charsmax(arg));
  348. if (equal(arg, "")) break;
  349. ArrayPushCell(temp, str_to_num(arg));
  350. k++;
  351. }
  352. }
  353.  
  354. max = ArraySize(temp), k = 0;
  355. format(msg, charsmax(msg), "%d", ArrayGetCell(temp, k++));
  356. while (k < max)
  357. format(msg, charsmax(msg), "%s, %d", msg, ArrayGetCell(temp, k++));
  358. client_print(id, print_console, "%L: %s", id, "AMXSUPER_CURRENT", type, msg);
  359. ArraySetCell(Array:valueArray, value, temp);
  360. }
  361. return PLUGIN_HANDLED;
  362. }
  363.  
  364. build_arrays()
  365. {
  366. new Array:temp = ArrayCreate();
  367. for (new k = 5; k < 16; k+=5)
  368. ArrayPushCell(temp, k);
  369. for (new k = 30; k < 61; k+=15)
  370. ArrayPushCell(temp, k);
  371. ArraySetCell(Array:valueArray, extend, temp);
  372.  
  373. ArrayClear(temp);
  374. for (new k = 0; k < 7; k++)
  375. ArrayPushCell(temp, k * 200);
  376. ArraySetCell(Array:valueArray, gravity, temp);
  377.  
  378. ArrayClear(temp);
  379. ArrayPushCell(temp, 10);
  380. for (new k = 1; k < 5; k++)
  381. ArrayPushCell(temp, k * 25);
  382. ArrayPushCell(temp, 200);
  383. ArraySetCell(Array:valueArray, heal, temp);
  384. ArraySetCell(Array:valueArray, armor, temp);
  385.  
  386. ArrayClear(temp);
  387. for (new k = 500; k < 16001; k*=2)
  388. ArrayPushCell(temp, k);
  389. ArraySetCell(Array:valueArray, givemoney, temp);
  390.  
  391. ArrayClear(temp);
  392. ArrayPushCell(temp, 0);
  393. ArrayPushCell(temp, 1);
  394. for (new k = 5; k < 16; k+=5)
  395. ArrayPushCell(temp, k);
  396. for (new k = 30; k < 61; k+=15)
  397. ArrayPushCell(temp, k);
  398. ArraySetCell(Array:valueArray, badaim, temp);
  399.  
  400. ArrayClear(temp);
  401. ArrayPushCell(temp, 30);
  402. ArrayPushCell(temp, 60);
  403. ArrayPushCell(temp, 300);
  404. for (new k = 600; k < 1801; k+=600)
  405. ArrayPushCell(temp, k);
  406. ArraySetCell(Array:valueArray, gag, temp);
  407. }
  408.  
  409. build_menu()
  410. {
  411. new value[20];
  412.  
  413. // Build Main Menu
  414. for (new num = 1; num < maxvalue; num++)
  415. {
  416. if (num == 3 || num == 19 || num == 27 || num == 30)
  417. continue;
  418.  
  419. new key[17], snum[3];
  420. format(key, charsmax(key), "AMXSUPER_MENU%d", num);
  421. format(snum, charsmax(snum), "%d", num);
  422. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, key);
  423. if (accessLevel[num] != -2)
  424. menu_additem(g_mainmenu, menuname, snum, Callback);
  425. }
  426.  
  427. // Build Alltalk Menu
  428. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_ENABLE");
  429. menu_additem(g_alltalkmenu, menuname, "1");
  430. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_DISABLE");
  431. menu_additem(g_alltalkmenu, menuname, "0");
  432.  
  433. // Build Extend Menu
  434. for (new k = 0; k < 6; k++)
  435. {
  436. format(value, charsmax(value), "%d", ArrayGetCell(Array:ArrayGetCell(Array:valueArray, extend), k));
  437. format(menuname, charsmax(menuname), "%L", LANG_PLAYER, "AMXSUPER_EXTEND", value);
  438. menu_additem(g_extendmenu, menuname, value);
  439. }
  440.  
  441. // Build Gravity Menu
  442. for (new k = 0; k < 6; k++)
  443. {
  444. format(value, charsmax(value), "%d", ArrayGetCell(Array:ArrayGetCell(Array:valueArray, gravity), k));
  445. menu_additem(g_gravitymenu, value, value);
  446. }
  447. }
  448.  
  449. get_menu_players(&num)
  450. {
  451. new temp[32], players[35], k;
  452. get_players(temp, num);
  453.  
  454. for (k = 0; k < num; k++) players[k] = temp[k];
  455.  
  456. players[k] = 33;
  457. players[k+1] = 34;
  458. players[k+2] = 35;
  459. num += 3;
  460.  
  461. return players;
  462. }
  463.  
  464. public menu_callback(id, menu, item)
  465. {
  466. if (item < 0)
  467. return ITEM_DISABLED;
  468.  
  469. new cmd[3], access, callback;
  470. menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
  471.  
  472. if (get_user_flags(id)&accessLevel[str_to_num(cmd)])
  473. return ITEM_ENABLED;
  474. return ITEM_DISABLED;
  475. }
  476.  
  477. public mainMenu(id, menu, item)
  478. {
  479. if (item < 0)
  480. return PLUGIN_CONTINUE;
  481.  
  482. new cmd[3];
  483. new access, callback;
  484. menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
  485.  
  486. new num = str_to_num(cmd);
  487.  
  488. g_menuProperties[id] = 0;
  489. g_menuPosition[id] = 0;
  490.  
  491. switch(num)
  492. {
  493. case alltalk:
  494. menu_display(id, g_alltalkmenu, 0);
  495. case lock, unlock:
  496. displayLockMenu(id);
  497. case extend:
  498. menu_display(id, g_extendmenu, 0);
  499. case gravity:
  500. menu_display(id, g_gravitymenu, 0);
  501. case teamswap:
  502. {
  503. client_cmd(id, cmds[teamswap]);
  504. return PLUGIN_HANDLED;
  505. }
  506. case gag:
  507. displayGagMenu(id, 0);
  508. case fire, flash, disarm, rocket, uberslap, revive, quit, drug, swap:
  509. displayPlayer1Menu(id, 0, num);
  510. case heal, armor, stack, bury, unbury, slay, god, noclip, speed, unammo, givemoney, takemoney, badaim:
  511. displayPlayer2Menu(id, 0, num);
  512. }
  513.  
  514. return PLUGIN_CONTINUE;
  515. }
  516.  
  517. public alltalkMenu(id, menu, item)
  518. {
  519. if (item == MENU_EXIT && get_pcvar_num(menufunc))
  520. {
  521. menu_display(id, g_mainmenu, 0);
  522. return PLUGIN_CONTINUE;
  523. }
  524. if (item < 0)
  525. return PLUGIN_CONTINUE;
  526.  
  527. new cmd[3], access, callback;
  528. menu_item_getinfo(menu, item, access, cmd, 2,_,_, callback);
  529.  
  530. client_cmd(id, menuCmd[alltalk], cmd);
  531.  
  532. return PLUGIN_HANDLED;
  533. }
  534.  
  535. public lockMenu(id, key)
  536. {
  537. new team[6];
  538. switch(key)
  539. {
  540. case 0:
  541. format(team, charsmax(team), "CT");
  542. case 1:
  543. format(team, charsmax(team), "T");
  544. case 2:
  545. format(team, charsmax(team), "Auto");
  546. case 3:
  547. format(team, charsmax(team), "Spec");
  548. case 4:
  549. {
  550. if (g_menuProperties[id] == lock)
  551. g_menuProperties[id] = unlock;
  552. else
  553. g_menuProperties[id] = lock;
  554. displayLockMenu(id);
  555. return PLUGIN_HANDLED;
  556. }
  557. case 9:
  558. {
  559. if (get_pcvar_num(menufunc))
  560. {
  561. menu_display(id, g_mainmenu, 0);
  562. return PLUGIN_HANDLED;
  563. }
  564. }
  565. default: return PLUGIN_HANDLED;
  566. }
  567.  
  568. client_cmd(id, menuCmd[g_menuProperties[id]], team);
  569.  
  570. displayLockMenu(id);
  571.  
  572. return PLUGIN_HANDLED;
  573. }
  574.  
  575. displayLockMenu(id)
  576. {
  577. new menuBody[1000], line[100];
  578.  
  579. format(menuBody, charsmax(menuBody), "\y");
  580. if (g_menuProperties[id] == lock)
  581. format(line, charsmax(line), "%L ^n", id, "AMXSUPER_LOCK");
  582. else
  583. format(line, charsmax(line), "%L ^n", id, "AMXSUPER_UNLOCK");
  584. add(menuBody, charsmax(menuBody), line);
  585. format(line, charsmax(line), "^n\w^n");
  586. add(menuBody, charsmax(menuBody), line);
  587. format(line, charsmax(line), "1. %L ^n", id, "AMXSUPER_TEAMCT");
  588. add(menuBody, charsmax(menuBody), line);
  589. format(line, charsmax(line), "2. %L ^n", id, "AMXSUPER_TEAMT");
  590. add(menuBody, charsmax(menuBody), line);
  591. format(line, charsmax(line), "3. %L ^n", id, "AMXSUPER_TEAMAUTO");
  592. add(menuBody, charsmax(menuBody), line);
  593. format(line, charsmax(line), "4. %L ^n", id, "AMXSUPER_TEAMSPEC");
  594. add(menuBody, charsmax(menuBody), line);
  595. if (g_menuProperties[id] == lock)
  596. format(line, charsmax(line), "^n5. %L ^n", id, "AMXSUPER_LOCK");
  597. else
  598. format(line, charsmax(line), "^n5. %L ^n", id, "AMXSUPER_UNLOCK");
  599. add(menuBody, charsmax(menuBody), line);
  600. format(line, charsmax(line), "^n^n0. %L", id, "EXIT");
  601. add(menuBody, charsmax(menuBody), line);
  602. new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5;
  603.  
  604. show_menu(id, keys, menuBody, -1, "Lock Menu");
  605. }
  606.  
  607. public extendMenu(id, menu, item)
  608. {
  609. if (item == MENU_EXIT && get_pcvar_num(menufunc))
  610. {
  611. menu_display(id, g_mainmenu, 0);
  612. return PLUGIN_CONTINUE;
  613. }
  614. if (item < 0)
  615. return PLUGIN_CONTINUE;
  616.  
  617. new cmd[4], access, callback;
  618. menu_item_getinfo(menu, item, access, cmd, 3,_,_, callback);
  619.  
  620. client_cmd(id, menuCmd[extend], cmd);
  621.  
  622. return PLUGIN_HANDLED;
  623. }
  624.  
  625. public gravityMenu(id, menu, item)
  626. {
  627. if (item == MENU_EXIT && get_pcvar_num(menufunc))
  628. {
  629. menu_display(id, g_mainmenu, 0);
  630. return PLUGIN_CONTINUE;
  631. }
  632. if (item < 0)
  633. return PLUGIN_CONTINUE;
  634.  
  635. new cmd[5], access, callback;
  636. menu_item_getinfo(menu, item, access, cmd, 4,_,_, callback);
  637.  
  638. client_cmd(id, menuCmd[gravity], cmd);
  639.  
  640. return PLUGIN_HANDLED;
  641. }
  642.  
  643. public player1Menu(id, key)
  644. {
  645. switch (key)
  646. {
  647. case 8: displayPlayer1Menu(id, ++g_menuPosition[id], g_menu[id]);
  648. case 9: displayPlayer1Menu(id, --g_menuPosition[id], g_menu[id]);
  649. default:
  650. {
  651. new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key];
  652. new name[32];
  653.  
  654. if (g_menu[id] != swap)
  655. {
  656. switch (player)
  657. {
  658. case 33: format(name, charsmax(name), "@ALL");
  659. case 34: format(name, charsmax(name), "@T");
  660. case 35: format(name, charsmax(name), "@CT");
  661. default: get_user_name(player, name, charsmax(name));
  662. }
  663. client_cmd(id, menuCmd[g_menu[id]], name);
  664. }
  665. else
  666. {
  667. if (equal(g_menuPlayerName[id], ""))
  668. {
  669. format(g_menuPlayerName[id], 31, "%s", name);
  670. g_menuPosition[id] = 0;
  671. displayPlayer1Menu(id, g_menuPosition[id], g_menu[id]);
  672. }
  673. else
  674. {
  675. client_cmd(id, menuCmd[swap], g_menuPlayerName[id], name);
  676. format(g_menuPlayerName[id], 31, "");
  677. }
  678. }
  679. }
  680. }
  681.  
  682. displayPlayer1Menu(id, g_menuPosition[id], g_menu[id]);
  683.  
  684. return PLUGIN_HANDLED;
  685. }
  686.  
  687. displayPlayer1Menu(id, pos, menu)
  688. {
  689. if (pos < 0)
  690. {
  691. if (get_pcvar_num(menufunc))
  692. menu_display(id, g_mainmenu, 0);
  693. return;
  694. }
  695.  
  696. g_menu[id] = menu;
  697. g_menuPlayers[id] = get_menu_players(g_menuPlayersNum[id]);
  698.  
  699. new menuBody[1024];
  700. new b = 0;
  701. new i;
  702. new name[32];
  703. new start = pos * 8;
  704.  
  705. if (start >= g_menuPlayersNum[id])
  706. start = pos = g_menuPosition[id] = 0;
  707.  
  708. new key[17];
  709. format(key, charsmax(key), "AMXSUPER_MENU%d", menu);
  710. new len = format(menuBody, 1023, "\y%L\R%d/%d^n\w^n", id, key, pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)));
  711. new end = start + 8;
  712. new keys = MENU_KEY_0;
  713.  
  714. if (end > g_menuPlayersNum[id])
  715. end = g_menuPlayersNum[id];
  716.  
  717. for (new a = start; a < end; ++a)
  718. {
  719. i = g_menuPlayers[id][a];
  720.  
  721. if (g_menu[id] != swap)
  722. switch (i)
  723. {
  724. case 33: format(name, charsmax(name), "%L", id, "AMXSUPER_ALL");
  725. case 34: format(name, charsmax(name), "%L", id, "AMXSUPER_TEAMT");
  726. case 35: format(name, charsmax(name), "%L", id, "AMXSUPER_TEAMCT");
  727. default: get_user_name(i, name, 31);
  728. }
  729. else
  730. get_user_name(i, name, 31);
  731.  
  732. if (i < 33 && i != id && access(i, ADMIN_IMMUNITY))
  733. {
  734. ++b;
  735. len += format(menuBody[len], 1023-len, "\d\r%d. \w%s^n\w", b, name);
  736. } else {
  737. keys |= (1<<b);
  738.  
  739. if (i < 33 && is_user_admin(i))
  740. len += format(menuBody[len], 1023-len, "\r%d. \w%s \r*^n\w", ++b, name);
  741. else
  742. len += format(menuBody[len], 1023-len, "\r%d. \w%s^n", ++b, name);
  743. }
  744. }
  745.  
  746. if (end != g_menuPlayersNum[id])
  747. {
  748. format(menuBody[len], 1023-len, "^n\r9. \w%L...^n\r0. \w%L", id, "MORE", id, pos ? "BACK" : "EXIT");
  749. keys |= MENU_KEY_9;
  750. }
  751. else
  752. format(menuBody[len], 1023-len, "^n\r0. \w%L", id, pos ? "BACK" : "EXIT");
  753.  
  754. show_menu(id, keys, menuBody, -1, "Player1 Menu");
  755. }
  756.  
  757. public player2Menu(id, key)
  758. {
  759. switch (key)
  760. {
  761. case 7:
  762. {
  763. switch (g_menu[id])
  764. {
  765. case heal, armor: if (++g_menuProperties[id] > 5) g_menuProperties[id] = 0;
  766. case stack, god, noclip: if (++g_menuProperties[id] > 2) g_menuProperties[id] = 0;
  767. case slay: if (++g_menuProperties[id] > 3) g_menuProperties[id] = 1;
  768. case speed, unammo, bury, unbury: if (++g_menuProperties[id] > 1) g_menuProperties[id] = 0;
  769. case badaim: if (++g_menuProperties[id] > 7) g_menuProperties[id] = 0;
  770. case givemoney, takemoney:
  771. {
  772. if (++g_menuProperties[id] > 5)
  773. {
  774. g_menuProperties[id] = 0;
  775. if (g_money[id] == -1)
  776. g_money[id] = 1;
  777. else
  778. g_money[id] = -1;
  779. }
  780. }
  781. }
  782. displayPlayer2Menu(id, g_menuPosition[id], g_menu[id]);
  783. }
  784. case 8: displayPlayer2Menu(id, ++g_menuPosition[id], g_menu[id]);
  785. case 9: displayPlayer2Menu(id, --g_menuPosition[id], g_menu[id]);
  786. default:
  787. {
  788. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key];
  789. new name[32];
  790.  
  791. switch (player)
  792. {
  793. case 33: format(name, charsmax(name), "@ALL");
  794. case 34: format(name, charsmax(name), "@T");
  795. case 35: format(name, charsmax(name), "@CT");
  796. default: get_user_name(player, name, charsmax(name));
  797. }
  798.  
  799. switch (g_menu[id])
  800. {
  801. case heal, armor, badaim: client_cmd(id, menuCmd[g_menu[id]], name, ArrayGetCell(Array:ArrayGetCell(Array:valueArray, g_menu[id]), g_menuProperties[id]));
  802. case stack, slay, god, noclip, speed, unammo: client_cmd(id, menuCmd[g_menu[id]], name, g_menuProperties[id]);
  803. case givemoney, takemoney: client_cmd(id, (g_money[id] == -1) ? menuCmd[takemoney] : menuCmd[givemoney], name, ArrayGetCell(Array:ArrayGetCell(Array:valueArray, g_menu[id]), g_menuProperties[id]));
  804. case bury, unbury: client_cmd(id, menuCmd[bury], name);
  805. }
  806. }
  807. }
  808.  
  809. displayPlayer2Menu(id, g_menuPosition[id], g_menu[id]);
  810.  
  811. return PLUGIN_HANDLED;
  812. }
  813.  
  814. displayPlayer2Menu(id, pos, menu)
  815. {
  816. if (pos < 0)
  817. {
  818. if (get_pcvar_num(menufunc))
  819. menu_display(id, g_mainmenu, 0);
  820. return;
  821. }
  822.  
  823. g_menu[id] = menu;
  824. g_menuPlayers[id] = get_menu_players(g_menuPlayersNum[id]);
  825.  
  826. new menuBody[1024];
  827. new b = 0;
  828. new i;
  829. new name[32];
  830. new start = pos * 7;
  831.  
  832. if (start >= g_menuPlayersNum[id])
  833. start = pos = g_menuPosition[id] = 0;
  834.  
  835. new key[20];
  836. if (menu == bury || menu == unbury)
  837. format(key, charsmax(key), "\yAMXSUPER_%s", (g_menuProperties[id]) ? "UNBURY" : "BURY");
  838. else
  839. format(key, charsmax(key), "AMXSUPER_MENU%d", menu);
  840. new len = format(menuBody, 1023, "\y%L\R%d/%d^n\w^n", id, key, pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)));
  841. new end = start + 7;
  842. new keys = MENU_KEY_0;
  843.  
  844. if (end > g_menuPlayersNum[id])
  845. end = g_menuPlayersNum[id];
  846.  
  847. for (new a = start; a < end; ++a)
  848. {
  849. i = g_menuPlayers[id][a];
  850.  
  851. switch (i)
  852. {
  853. case 33: format(name, charsmax(name), "%L", id, "AMXSUPER_ALL");
  854. case 34: format(name, charsmax(name), "%L", id, "AMXSUPER_TEAMT");
  855. case 35: format(name, charsmax(name), "%L", id, "AMXSUPER_TEAMCT");
  856. default: get_user_name(i, name, 31);
  857. }
  858.  
  859. if (i < 33 && i != id && access(i, ADMIN_IMMUNITY))
  860. {
  861. ++b;
  862. len += format(menuBody[len], 1023-len, "\d\r%d. \w%s^n\w", b, name);
  863. } else {
  864. keys |= (1<<b);
  865.  
  866. if (i < 33 && is_user_admin(i))
  867. len += format(menuBody[len], 1023-len, "\r%d. \w%s \r*^n\w", ++b, name);
  868. else
  869. len += format(menuBody[len], 1023-len, "\r%d. \w%s^n", ++b, name);
  870. }
  871. }
  872.  
  873. new option[20];
  874. if (menu == heal || menu == armor || menu == badaim || menu == givemoney || menu == takemoney)
  875. format(option, charsmax(option), "%d", ArrayGetCell(Array:ArrayGetCell(Array:valueArray, menu), g_menuProperties[id]));
  876.  
  877. switch (menu)
  878. {
  879. case heal: len += format(menuBody[len], 1023-len, "\r8. \w%L", id, "AMXSUPER_HEAL", option);
  880. case armor: len += format(menuBody[len], 1023-len, "\r8. \w%L", id, "AMXSUPER_ARMOR", option);
  881. case stack: len += format(menuBody[len], 1023-len, "\r8. \w%L", id, "AMXSUPER_STACK", g_menuProperties[id]);
  882. case bury, unbury: len += format(menuBody[len], 1023-len, "\r8. \w%L", id, (g_menuProperties[id]) ? "AMXSUPER_BURY" : "AMXSUPER_UNBURY");
  883. case slay:
  884. {
  885. format(key, charsmax(key), "AMXSUPER_SLAY%d", g_menuProperties[id]);
  886. len += format(menuBody[len], 1023-len, "\r8. \w%L", id, key);
  887. }
  888. case god, noclip, speed, unammo:
  889. {
  890. format(key, charsmax(key), "AMXSUPER_GOD%d", g_menuProperties[id]);
  891. len += format(menuBody[len], 1023-len, "\r8. \w%L", id, key);
  892. }
  893. case badaim:
  894. {
  895. format(key, charsmax(key), "AMXSUPER_%s", (g_menuProperties[id] < 2) ? (g_menuProperties[id]) ? "GOD0" : "GOD1" : "MINS");
  896. if (g_menuProperties[id] < 2)
  897. len += format(menuBody[len], 1023-len, "\r8. \w%L", id, key);
  898. else
  899. len += format(menuBody[len], 1023-len, "\r8. \w%L", id, key, option);
  900. }
  901. case givemoney, takemoney: len += format(menuBody[len], 1023-len, "\r8. \w%L", id, (g_money[id] == -1) ? "AMXSUPER_TAKE" : "AMXSUPER_GIVE", option);
  902. }
  903. keys |= MENU_KEY_8;
  904.  
  905. if (end != g_menuPlayersNum[id])
  906. {
  907. format(menuBody[len], 1023-len, "^n\r9. \w%L...^n\r0. \w%L", id, "MORE", id, pos ? "BACK" : "EXIT");
  908. keys |= MENU_KEY_9;
  909. }
  910. else
  911. format(menuBody[len], 1023-len, "^n\r0. \w%L", id, pos ? "BACK" : "EXIT");
  912.  
  913. show_menu(id, keys, menuBody, -1, "Player2 Menu");
  914. }
  915.  
  916. public gagMenu(id, key)
  917. {
  918. switch (key)
  919. {
  920. case 6:
  921. {
  922. if (++g_menuProperties[id] > 5) g_menuProperties[id] = 0;
  923. displayGagMenu(id, g_menuPosition[id]);
  924. }
  925. case 7:
  926. {
  927. if (++g_menuProperties2[id] > 7) g_menuProperties2[id] = 0;
  928. displayGagMenu(id, g_menuPosition[id]);
  929. }
  930. case 8: displayGagMenu(id, ++g_menuPosition[id]);
  931. case 9: displayGagMenu(id, --g_menuPosition[id]);
  932. default:
  933. {
  934. new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key];
  935. new name[32];
  936.  
  937. switch (player)
  938. {
  939. case 33: format(name, charsmax(name), "@ALL");
  940. case 34: format(name, charsmax(name), "@T");
  941. case 35: format(name, charsmax(name), "@CT");
  942. default: get_user_name(player, name, charsmax(name));
  943. }
  944.  
  945. if (g_menuProperties2[id] == 7)
  946. client_cmd(id, menuCmd[ungag], name);
  947. else
  948. {
  949. new flags[4];
  950.  
  951. switch (g_menuProperties2[id])
  952. {
  953. case 0: format(flags, charsmax(flags), "a");
  954. case 1: format(flags, charsmax(flags), "b");
  955. case 2: format(flags, charsmax(flags), "c");
  956. case 3: format(flags, charsmax(flags), "ab");
  957. case 4: format(flags, charsmax(flags), "ac");
  958. case 5: format(flags, charsmax(flags), "bc");
  959. case 6: format(flags, charsmax(flags), "abc");
  960. }
  961.  
  962. client_cmd(id, menuCmd[gag], name, flags, ArrayGetCell(Array:ArrayGetCell(Array:valueArray, g_menu[id]), g_menuProperties[id]));
  963. }
  964. }
  965. }
  966.  
  967. displayGagMenu(id, g_menuPosition[id]);
  968.  
  969. return PLUGIN_HANDLED;
  970. }
  971.  
  972. displayGagMenu(id, pos)
  973. {
  974. if (pos < 0)
  975. {
  976. if (get_pcvar_num(menufunc))
  977. menu_display(id, g_mainmenu, 0);
  978. return;
  979. }
  980.  
  981. g_menuPlayers[id] = get_menu_players(g_menuPlayersNum[id]);
  982.  
  983. new menuBody[1024];
  984. new b = 0;
  985. new i;
  986. new name[32];
  987. new start = pos * 6;
  988.  
  989. if (start >= g_menuPlayersNum[id])
  990. start = pos = g_menuPosition[id] = 0;
  991.  
  992. new key[20];
  993. format(key, charsmax(key), "\yAMXSUPER_MENU%d", gag);
  994. new len = format(menuBody, 1023, "\y%L\R%d/%d^n\w^n", id, key, pos + 1, (g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0)));
  995. new end = start + 6;
  996. new keys = MENU_KEY_0|MENU_KEY_7|MENU_KEY_8;
  997.  
  998. if (end > g_menuPlayersNum[id])
  999. end = g_menuPlayersNum[id];
  1000.  
  1001. for (new a = start; a < end; ++a)
  1002. {
  1003. i = g_menuPlayers[id][a];
  1004.  
  1005. switch (i)
  1006. {
  1007. case 33: format(name, charsmax(name), "%L", id, "AMXSUPER_ALL");
  1008. case 34: format(name, charsmax(name), "%L", id, "AMXSUPER_TEAMT");
  1009. case 35: format(name, charsmax(name), "%L", id, "AMXSUPER_TEAMCT");
  1010. default: get_user_name(i, name, 31);
  1011. }
  1012.  
  1013. if (i < 33 && i != id && access(i, ADMIN_IMMUNITY))
  1014. {
  1015. ++b;
  1016. len += format(menuBody[len], 1023-len, "\d\r%d. \w%s^n\w", b, name);
  1017. } else {
  1018. keys |= (1<<b);
  1019.  
  1020. if (i < 33 && is_user_admin(i))
  1021. len += format(menuBody[len], 1023-len, "\r%d. \w%s \r*^n\w", ++b, name);
  1022. else
  1023. len += format(menuBody[len], 1023-len, "\r%d. \w%s^n", ++b, name);
  1024. }
  1025. }
  1026.  
  1027. new option[20];
  1028. format(option, charsmax(option), "%d", ArrayGetCell(Array:ArrayGetCell(Array:valueArray, g_menu[id]), g_menuProperties[id]));
  1029. len += format(menuBody[len], 1023-len, "7. %L^n", id, "AMXSUPER_SECS", option);
  1030.  
  1031. switch (g_menuProperties2[id])
  1032. {
  1033. case 0: len += format(menuBody[len], 1023-len, "8. %L^n", id, "AMXSUPER_GAGA");
  1034. case 1: len += format(menuBody[len], 1023-len, "8. %L^n", id, "AMXSUPER_GAGB");
  1035. case 2: len += format(menuBody[len], 1023-len, "8. %L^n", id, "AMXSUPER_GAGC");
  1036. case 3: len += format(menuBody[len], 1023-len, "8. %L & %L^n", id, "AMXSUPER_GAGA", id, "AMXSUPER_GAGB");
  1037. case 4: len += format(menuBody[len], 1023-len, "8. %L & %L^n", id, "AMXSUPER_GAGA", id, "AMXSUPER_GAGC");
  1038. case 5: len += format(menuBody[len], 1023-len, "8. %L & %L^n", id, "AMXSUPER_GAGB", id, "AMXSUPER_GAGC");
  1039. case 6: len += format(menuBody[len], 1023-len, "8. %L & %L & %L^n", id, "AMXSUPER_GAGA", id, "AMXSUPER_GAGB", id, "AMXSUPER_GAGC");
  1040. case 7: len += format(menuBody[len], 1023-len, "8. %L^n", id, "AMXSUPER_UNGAG");
  1041. }
  1042.  
  1043. if (end != g_menuPlayersNum[id])
  1044. {
  1045. format(menuBody[len], 1023-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT");
  1046. keys |= MENU_KEY_9;
  1047. }
  1048. else
  1049. format(menuBody[len], 1023-len, "^n0. %L", id, pos ? "BACK" : "EXIT");
  1050.  
  1051. show_menu(id, keys, menuBody, -1, "Gag Menu");
  1052. }



Ebben megtudnád mondani mit írjak át hogy jó legyen?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: amx super menu
HozzászólásElküldve:2013.03.31. 14:40 
Offline
Tag

Csatlakozott:2013.03.31. 14:10
Hozzászólások:52
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 2 alkalommal
cstrike/addons/amxmodx/configs/custommenuitems.cfg

Ott a példa benne

_________________
10 féle ember van: aki ért a programozáshoz, és aki nem


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 23 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole