hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.29. 15:17



Jelenlévő felhasználók

Jelenleg 343 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 342 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: 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  [ 13 hozzászólás ]  Oldal Előző 1 2
Szerző Üzenet
 Hozzászólás témája: Re: Ban Plugin
HozzászólásElküldve: 2016.05.14. 12:22 
Offline
Beavatott
Avatar

Csatlakozott: 2015.11.01. 11:29
Hozzászólások: 94
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 1 alkalommal
Remelem meg erted :D


Csatolmányok:
level999paint.png
level999paint.png [ 1016.21 KiB | Megtekintve 1209 alkalommal ]

_________________
Kép
Kép
Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ban Plugin
HozzászólásElküldve: 2016.05.14. 19:06 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.01.15. 19:04
Hozzászólások: 407
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 176 alkalommal
Advanced Bans pluginnal kompatibilis plmenu:
  1. /* AMX Mod X
  2. *   Players Menu Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. *  originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. *  This program is free software; you can redistribute it and/or modify it
  11. *  under the terms of the GNU General Public License as published by the
  12. *  Free Software Foundation; either version 2 of the License, or (at
  13. *  your option) any later version.
  14. *
  15. *  This program is distributed in the hope that it will be useful, but
  16. *  WITHOUT ANY WARRANTY; without even the implied warranty of
  17. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. *  General Public License for more details.
  19. *
  20. *  You should have received a copy of the GNU General Public License
  21. *  along with this program; if not, write to the Free Software Foundation,
  22. *  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. *  In addition, as a special exception, the author gives permission to
  25. *  link the code of this program with the Half-Life Game Engine ("HL
  26. *  Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. *  L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. *  respects for all of the code used other than the HL Engine and MODs
  29. *  from Valve. If you modify this file, you may extend this exception
  30. *  to your version of the file, but you are not obligated to do so. If
  31. *  you do not wish to do so, delete this exception statement from your
  32. *  version.
  33. */
  34.  
  35. #include <amxmodx>
  36. #include <amxmisc>
  37.  
  38. /** skip autoloading since it's optional */
  39. #define AMXMODX_NOAUTOLOAD
  40. #include <cstrike>
  41.  
  42. new g_menuPosition[33]
  43. new g_menuPlayers[33][32]
  44. new g_menuPlayersNum[33]
  45. new g_menuOption[33]
  46. new g_menuSettings[33]
  47.  
  48. new g_menuSelect[33][64]
  49. new g_menuSelectNum[33]
  50.  
  51. #define MAX_CLCMDS 24
  52.  
  53. new g_clcmdName[MAX_CLCMDS][32]
  54. new g_clcmdCmd[MAX_CLCMDS][64]
  55. new g_clcmdMisc[MAX_CLCMDS][2]
  56. new g_clcmdNum
  57.  
  58. new g_coloredMenus
  59. new g_cstrike = 0
  60.  
  61. new Array:g_bantimes;
  62. new Array:g_slapsettings;
  63.  
  64. new g_CSTeamNames[3][] = {
  65.     "TERRORIST",
  66.     "CT",
  67.     "SPECTATOR"
  68. }
  69. new g_CSTeamNumbers[3][] = {
  70.     "1",
  71.     "2",
  72.     "6"
  73. }
  74. new g_CSTeamiNumbers[3] = {
  75.     1,
  76.     2,
  77.     6
  78. }
  79.  
  80. new g_ban_player[33];
  81.  
  82.  
  83. public plugin_natives()
  84. {
  85.     set_module_filter("module_filter")
  86.     set_native_filter("native_filter")
  87. }
  88.  
  89. public plugin_init()
  90. {
  91.     register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
  92.     register_dictionary("common.txt")
  93.     register_dictionary("admincmd.txt")
  94.     register_dictionary("plmenu.txt")
  95.  
  96.     register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
  97.     register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
  98.     register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
  99.     register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
  100.     register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
  101.     register_clcmd("amx_banreason", "CmdBanReason", ADMIN_BAN, "<reason>");
  102.     register_clcmd("amx_bantime", "CmdBanTime", ADMIN_BAN, "<time>");
  103.  
  104.     register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu")
  105.     register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu")
  106.     register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu")
  107.     register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu")
  108.     register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu")
  109.    
  110.    
  111.     g_bantimes = ArrayCreate();
  112.     // Load up the old default values
  113.     ArrayPushCell(g_bantimes, 0);
  114.     ArrayPushCell(g_bantimes, 5);
  115.     ArrayPushCell(g_bantimes, 10);
  116.     ArrayPushCell(g_bantimes, 15);
  117.     ArrayPushCell(g_bantimes, 30);
  118.     ArrayPushCell(g_bantimes, 45);
  119.     ArrayPushCell(g_bantimes, 60);
  120.    
  121.    
  122.     g_slapsettings = ArrayCreate();
  123.     // Old default values
  124.     ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
  125.     ArrayPushCell(g_slapsettings, 0); // slap 0 damage
  126.     ArrayPushCell(g_slapsettings, 1);
  127.     ArrayPushCell(g_slapsettings, 5);
  128.    
  129.    
  130.     register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
  131.     register_srvcmd("amx_plmenu_slapdmg", "plmenu_setslapdmg");
  132.  
  133.     g_coloredMenus = colored_menus()
  134.  
  135.     new clcmds_ini_file[64]
  136.     get_configsdir(clcmds_ini_file, 63)
  137.     format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
  138.     load_settings(clcmds_ini_file)
  139.  
  140.     if (module_exists("cstrike"))
  141.         g_cstrike = 1
  142. }
  143. public plmenu_setbantimes()
  144. {
  145.     new buff[32];
  146.     new args = read_argc();
  147.    
  148.     if (args <= 1)
  149.     {
  150.         server_print("usage: amx_plmenu_bantimes <time1> [time2] [time3] ...");
  151.         server_print("   use time of 0 for permanent.");
  152.        
  153.         return;
  154.     }
  155.    
  156.     ArrayClear(g_bantimes);
  157.    
  158.     for (new i = 1; i < args; i++)
  159.     {
  160.         read_argv(i, buff, charsmax(buff));
  161.        
  162.         ArrayPushCell(g_bantimes, str_to_num(buff));
  163.        
  164.     }
  165.    
  166. }
  167. public plmenu_setslapdmg()
  168. {
  169.     new buff[32];
  170.     new args = read_argc();
  171.    
  172.     if (args <= 1)
  173.     {
  174.         server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
  175.         server_print("   slay is automatically set for the first value.");
  176.        
  177.         return;
  178.     }
  179.    
  180.     ArrayClear(g_slapsettings);
  181.    
  182.     ArrayPushCell(g_slapsettings, 0); // compensate for slay
  183.    
  184.     for (new i = 1; i < args; i++)
  185.     {
  186.         read_argv(i, buff, charsmax(buff));
  187.        
  188.         ArrayPushCell(g_slapsettings, str_to_num(buff));
  189.        
  190.     }
  191.    
  192. }
  193. public module_filter(const module[])
  194. {
  195.     if (equali(module, "cstrike"))
  196.         return PLUGIN_HANDLED
  197.    
  198.     return PLUGIN_CONTINUE
  199. }
  200.  
  201. public native_filter(const name[], index, trap)
  202. {
  203.     if (!trap)
  204.         return PLUGIN_HANDLED
  205.        
  206.     return PLUGIN_CONTINUE
  207. }
  208.  
  209. /* Ban menu */
  210.  
  211. public client_disconnect(id)
  212. {
  213.     g_ban_player[id] = 0;
  214. }
  215.  
  216. public CmdBanTime(id)
  217. {
  218.     new player = g_ban_player[id];
  219.    
  220.     if( !player ) return PLUGIN_HANDLED;
  221.    
  222.     new bantime[128], btime;
  223.     read_args(bantime, sizeof(bantime) - 1);
  224.     remove_quotes(bantime);
  225.     btime = str_to_num(bantime);
  226.     if(btime < 0) btime *= -1;
  227.    
  228.     g_menuSettings[id] = btime;
  229.    
  230.     client_cmd(id, "messagemode amx_banreason");
  231.            
  232.     client_print(id, print_chat, "[AMXX] Kerlek add meg az okot.");
  233.    
  234.     return PLUGIN_HANDLED;
  235. }
  236.  
  237. public CmdBanReason(id)
  238. {
  239.     new player = g_ban_player[id];
  240.    
  241.     if( !player ) return PLUGIN_HANDLED;
  242.    
  243.     new reason[128];
  244.     read_args(reason, sizeof(reason) - 1);
  245.     remove_quotes(reason);
  246.    
  247.     new name[32], name2[32], authid[32], authid2[32]
  248.  
  249.     get_user_name(player, name2, 31)
  250.     get_user_authid(id, authid, 31)
  251.     get_user_authid(player, authid2, 31)
  252.     get_user_name(id, name, 31)
  253.    
  254.     new userid2 = get_user_userid(player)
  255.  
  256.     log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id], reason)
  257.  
  258.     if ( !equal("STEAM_0:", authid2, 8))
  259.     {
  260.         client_cmd(id, "amx_banip #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  261.     }
  262.     else
  263.     {
  264.         client_cmd(id, "amx_ban #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  265.     }
  266.  
  267.     server_exec()
  268.    
  269.     g_ban_player[id] = 0;
  270.  
  271.     displayBanMenu(id, g_menuPosition[id])
  272.    
  273.     return PLUGIN_HANDLED;
  274. }
  275.  
  276. public actionBanMenu(id, key)
  277. {
  278.     switch (key)
  279.     {
  280.         case 7:
  281.         {
  282.             /* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
  283.            
  284.             ++g_menuOption[id]
  285.             if(g_menuOption[id] != ArraySize(g_bantimes))
  286.                 g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
  287.             else
  288.             {
  289.                 g_menuOption[id] = -1;
  290.                 g_menuSettings[id] = -1;
  291.             }
  292.            
  293.  
  294.             displayBanMenu(id, g_menuPosition[id])
  295.         }
  296.         case 8: displayBanMenu(id, ++g_menuPosition[id])
  297.         case 9: displayBanMenu(id, --g_menuPosition[id])
  298.         default:
  299.         {
  300.             g_ban_player[id] = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  301.            
  302.             if(g_menuSettings[id] == -1)
  303.             {
  304.                 client_cmd(id, "messagemode amx_bantime");
  305.            
  306.                 client_print(id, print_chat, "[AMXX] Kerlek add meg az idot.");
  307.             }
  308.             else
  309.             {
  310.                 client_cmd(id, "messagemode amx_banreason");
  311.            
  312.                 client_print(id, print_chat, "[AMXX] Kerlek add meg az okot.");
  313.             }
  314.            
  315.            
  316.             /*new name[32], name2[32], authid[32], authid2[32]
  317.        
  318.             get_user_name(player, name2, 31)
  319.             get_user_authid(id, authid, 31)
  320.             get_user_authid(player, authid2, 31)
  321.             get_user_name(id, name, 31)
  322.            
  323.             new userid2 = get_user_userid(player)
  324.  
  325.             log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id])
  326.  
  327.             if (g_menuSettings[id]==0) // permanent
  328.             {
  329.                 new maxpl = get_maxplayers();
  330.                 for (new i = 1; i <= maxpl; i++)
  331.                 {
  332.                     show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM");
  333.                 }
  334.             }
  335.             else
  336.             {
  337.                 new tempTime[32];
  338.                 formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
  339.                 new maxpl = get_maxplayers();
  340.                 for (new i = 1; i <= maxpl; i++)
  341.                 {
  342.                     show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
  343.                 }
  344.             }
  345.             // ---------- check for Steam ID added by MistaGee --------------------
  346.             // IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE
  347.            
  348.             if (equal("4294967295", authid2)
  349.                 || equal("HLTV", authid2)
  350.                 || equal("STEAM_ID_LAN", authid2)
  351.                 || equali("VALVE_ID_LAN", authid2))
  352.             {
  353.                 // END OF MODIFICATIONS BY MISTAGEE
  354.                 server_cmd("amx_banip #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  355.             }
  356.             else
  357.             {
  358.                 server_cmd("amx_ban #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  359.             }
  360.  
  361.             server_exec()
  362.  
  363.             displayBanMenu(id, g_menuPosition[id])*/
  364.         }
  365.     }
  366.    
  367.     return PLUGIN_HANDLED
  368. }
  369.  
  370. displayBanMenu(id, pos)
  371. {
  372.     if (pos < 0)
  373.         return
  374.  
  375.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  376.  
  377.     new menuBody[512]
  378.     new b = 0
  379.     new i
  380.     new name[32]
  381.     new start = pos * 7
  382.  
  383.     if (start >= g_menuPlayersNum[id])
  384.         start = pos = g_menuPosition[id] = 0
  385.  
  386.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  387.     new end = start + 7
  388.     new keys = MENU_KEY_0|MENU_KEY_8
  389.  
  390.     if (end > g_menuPlayersNum[id])
  391.         end = g_menuPlayersNum[id]
  392.  
  393.     for (new a = start; a < end; ++a)
  394.     {
  395.         i = g_menuPlayers[id][a]
  396.         get_user_name(i, name, 31)
  397.  
  398.         if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  399.         {
  400.             ++b
  401.            
  402.             if (g_coloredMenus)
  403.                 len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  404.             else
  405.                 len += format(menuBody[len], 511-len, "#. %s^n", name)
  406.         } else {
  407.             keys |= (1<<b)
  408.                
  409.             if (is_user_admin(i))
  410.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  411.             else
  412.                 len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  413.         }
  414.     }
  415.  
  416.     if (g_menuSettings[id] == -1)
  417.         len += format(menuBody[len], 511-len, "^n8. Egyeni ido^n")
  418.     else if (g_menuSettings[id])
  419.     {
  420.         new banLength[32]
  421.         if (timeToString(g_menuSettings[id], banLength, 31))
  422.             len += format(menuBody[len], 511-len, "^n8. Ban for %s^n", banLength)
  423.         else
  424.             len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
  425.     }
  426.     else
  427.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
  428.  
  429.     if (end != g_menuPlayersNum[id])
  430.     {
  431.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  432.         keys |= MENU_KEY_9
  433.     }
  434.     else
  435.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  436.  
  437.     show_menu(id, keys, menuBody, -1, "Ban Menu")
  438. }
  439.  
  440. timeToString(minutes, output[], len)
  441. {
  442.     new hours = minutes / 60;
  443.     minutes %= 60;
  444.    
  445.     new days = hours / 24;
  446.     hours %= 24;
  447.    
  448.     new ret
  449.    
  450.     if (days)
  451.         ret += formatex(output[ret], len-ret, "%s%d day%s", ret ? ", " : "", days, (days == 1) ? "" : "s")
  452.    
  453.     if (hours)
  454.         ret += formatex(output[ret], len-ret, "%s%d hour%s", ret ? ", " : "", hours, (hours == 1) ? "" : "s")
  455.    
  456.     if (minutes)
  457.         ret += formatex(output[ret], len-ret, "%s%d minute%s", ret ? ", " : "", minutes, (minutes == 1) ? "" : "s")
  458.    
  459.     return ret
  460. }
  461.  
  462. public cmdBanMenu(id, level, cid)
  463. {
  464.     if (!cmd_access(id, level, cid, 1))
  465.         return PLUGIN_HANDLED
  466.  
  467.     g_menuOption[id] = -1
  468.    
  469.     g_menuSettings[id] = -1
  470.    
  471.     displayBanMenu(id, g_menuPosition[id] = 0)
  472.  
  473.     return PLUGIN_HANDLED
  474. }
  475.  
  476. /* Slap/Slay */
  477.  
  478. public actionSlapMenu(id, key)
  479. {
  480.     switch (key)
  481.     {
  482.         case 7:
  483.         {
  484.             ++g_menuOption[id]
  485.            
  486.             g_menuOption[id] %= ArraySize(g_slapsettings);
  487.            
  488.             g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  489.            
  490.             displaySlapMenu(id, g_menuPosition[id]);
  491.         }
  492.         case 8: displaySlapMenu(id, ++g_menuPosition[id])
  493.         case 9: displaySlapMenu(id, --g_menuPosition[id])
  494.         default:
  495.         {
  496.             new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  497.             new name2[32]
  498.            
  499.             get_user_name(player, name2, 31)
  500.  
  501.             if (!is_user_alive(player))
  502.             {
  503.                 client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
  504.                 displaySlapMenu(id, g_menuPosition[id])
  505.                 return PLUGIN_HANDLED
  506.             }
  507.  
  508.             new authid[32], authid2[32], name[32]
  509.  
  510.             get_user_authid(id, authid, 31)
  511.             get_user_authid(player, authid2, 31)
  512.             get_user_name(id, name, 31)
  513.  
  514.             if (g_menuOption[id])
  515.             {
  516.                 log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2)
  517.  
  518.                 show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
  519.             } else {
  520.                 log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
  521.                
  522.                 show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
  523.             }
  524.  
  525.             if (g_menuOption[id])
  526.                 user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
  527.             else
  528.                 user_kill(player)
  529.  
  530.             displaySlapMenu(id, g_menuPosition[id])
  531.         }
  532.     }
  533.    
  534.     return PLUGIN_HANDLED
  535. }
  536.  
  537. displaySlapMenu(id, pos)
  538. {
  539.     if (pos < 0)
  540.         return
  541.  
  542.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  543.  
  544.     new menuBody[512]
  545.     new b = 0
  546.     new i
  547.     new name[32], team[4]
  548.     new start = pos * 7
  549.  
  550.     if (start >= g_menuPlayersNum[id])
  551.         start = pos = g_menuPosition[id] = 0
  552.  
  553.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  554.     new end = start + 7
  555.     new keys = MENU_KEY_0|MENU_KEY_8
  556.  
  557.     if (end > g_menuPlayersNum[id])
  558.         end = g_menuPlayersNum[id]
  559.  
  560.     for (new a = start; a < end; ++a)
  561.     {
  562.         i = g_menuPlayers[id][a]
  563.         get_user_name(i, name, 31)
  564.        
  565.         if (g_cstrike)
  566.         {
  567.             if (cs_get_user_team(i) == CS_TEAM_T)
  568.             {
  569.                 copy(team, 3, "TE")
  570.             }
  571.             else if (cs_get_user_team(i) == CS_TEAM_CT)
  572.             {
  573.                 copy(team, 3, "CT")
  574.             } else {
  575.                 get_user_team(i, team, 3)
  576.             }
  577.         } else {
  578.             get_user_team(i, team, 3)
  579.         }
  580.  
  581.         if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  582.         {
  583.             ++b
  584.        
  585.             if (g_coloredMenus)
  586.                 len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  587.             else
  588.                 len += format(menuBody[len], 511-len, "#. %s   %s^n", name, team)      
  589.         } else {
  590.             keys |= (1<<b)
  591.                
  592.             if (is_user_admin(i))
  593.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s *   %s^n", ++b, name, team)
  594.             else
  595.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s   %s^n", ++b, name, team)
  596.         }
  597.     }
  598.  
  599.     if (g_menuOption[id])
  600.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
  601.     else
  602.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
  603.  
  604.     if (end != g_menuPlayersNum[id])
  605.     {
  606.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  607.         keys |= MENU_KEY_9
  608.     }
  609.     else
  610.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  611.  
  612.     show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
  613. }
  614.  
  615. public cmdSlapMenu(id, level, cid)
  616. {
  617.     if (!cmd_access(id, level, cid, 1))
  618.         return PLUGIN_HANDLED
  619.  
  620.     g_menuOption[id] = 0
  621.     if (ArraySize(g_slapsettings) > 0)
  622.     {
  623.         g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  624.     }
  625.     else
  626.     {
  627.         // should never happen, but failsafe
  628.         g_menuSettings[id] = 0
  629.     }
  630.  
  631.     displaySlapMenu(id, g_menuPosition[id] = 0)
  632.  
  633.     return PLUGIN_HANDLED
  634. }
  635.  
  636. /* Kick */
  637.  
  638. public actionKickMenu(id, key)
  639. {
  640.     switch (key)
  641.     {
  642.         case 8: displayKickMenu(id, ++g_menuPosition[id])
  643.         case 9: displayKickMenu(id, --g_menuPosition[id])
  644.         default:
  645.         {
  646.             new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
  647.             new authid[32], authid2[32], name[32], name2[32]
  648.            
  649.             get_user_authid(id, authid, 31)
  650.             get_user_authid(player, authid2, 31)
  651.             get_user_name(id, name, 31)
  652.             get_user_name(player, name2, 31)
  653.            
  654.             new userid2 = get_user_userid(player)
  655.  
  656.             log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2)
  657.  
  658.             show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2);
  659.  
  660.            
  661.             server_cmd("kick #%d", userid2)
  662.             server_exec()
  663.  
  664.             displayKickMenu(id, g_menuPosition[id])
  665.         }
  666.     }
  667.  
  668.     return PLUGIN_HANDLED
  669. }
  670.  
  671. displayKickMenu(id, pos)
  672. {
  673.     if (pos < 0)
  674.         return
  675.  
  676.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  677.  
  678.     new menuBody[512]
  679.     new b = 0
  680.     new i
  681.     new name[32]
  682.     new start = pos * 8
  683.  
  684.     if (start >= g_menuPlayersNum[id])
  685.         start = pos = g_menuPosition[id] = 0
  686.  
  687.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
  688.     new end = start + 8
  689.     new keys = MENU_KEY_0
  690.  
  691.     if (end > g_menuPlayersNum[id])
  692.         end = g_menuPlayersNum[id]
  693.  
  694.     for (new a = start; a < end; ++a)
  695.     {
  696.         i = g_menuPlayers[id][a]
  697.         get_user_name(i, name, 31)
  698.  
  699.         if (access(i, ADMIN_IMMUNITY) && i != id)
  700.         {
  701.             ++b
  702.        
  703.             if (g_coloredMenus)
  704.                 len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  705.             else
  706.                 len += format(menuBody[len], 511-len, "#. %s^n", name)
  707.         } else {
  708.             keys |= (1<<b)
  709.                
  710.             if (is_user_admin(i))
  711.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  712.             else
  713.                 len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  714.         }
  715.     }
  716.  
  717.     if (end != g_menuPlayersNum[id])
  718.     {
  719.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  720.         keys |= MENU_KEY_9
  721.     }
  722.     else
  723.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  724.  
  725.     show_menu(id, keys, menuBody, -1, "Kick Menu")
  726. }
  727.  
  728. public cmdKickMenu(id, level, cid)
  729. {
  730.     if (cmd_access(id, level, cid, 1))
  731.         displayKickMenu(id, g_menuPosition[id] = 0)
  732.  
  733.     return PLUGIN_HANDLED
  734. }
  735.  
  736. /* Team menu */
  737.  
  738. public actionTeamMenu(id, key)
  739. {
  740.     switch (key)
  741.     {
  742.         case 7:
  743.         {
  744.             g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike ? 3 : 2);
  745.             displayTeamMenu(id, g_menuPosition[id])
  746.         }
  747.         case 8: displayTeamMenu(id, ++g_menuPosition[id])
  748.         case 9: displayTeamMenu(id, --g_menuPosition[id])
  749.         default:
  750.         {
  751.             new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  752.             new authid[32], authid2[32], name[32], name2[32]
  753.  
  754.             get_user_name(player, name2, 31)
  755.             get_user_authid(id, authid, 31)
  756.             get_user_authid(player, authid2, 31)
  757.             get_user_name(id, name, 31)
  758.                
  759.             log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_menuOption[id] ? "TERRORIST" : "CT")
  760.  
  761.             show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[g_menuOption[id] % 3]);
  762.  
  763.             if (g_cstrike)
  764.             {
  765.                 if (is_user_alive(player))
  766.                 {
  767.                     new deaths = cs_get_user_deaths(player)
  768.                     user_kill(player, 1)
  769.                     cs_set_user_deaths(player, deaths)
  770.                 }
  771.                 // This modulo math just aligns the option to the CsTeams-corresponding number
  772.                 cs_set_user_team(player, (g_menuOption[id] % 3) + 1)
  773.                 cs_reset_user_model(player)
  774.             } else {
  775.                 new limit_setting = get_cvar_num("mp_limitteams")
  776.                
  777.                 set_cvar_num("mp_limitteams", 0)
  778.                 engclient_cmd(player, "jointeam", g_CSTeamNumbers[g_menuOption[id] % 2])
  779.                 engclient_cmd(player, "joinclass", "1")
  780.                 set_cvar_num("mp_limitteams", limit_setting)
  781.             }
  782.  
  783.             displayTeamMenu(id, g_menuPosition[id])
  784.         }
  785.     }
  786.    
  787.     return PLUGIN_HANDLED
  788. }
  789.  
  790. displayTeamMenu(id, pos)
  791. {
  792.     if (pos < 0)
  793.         return
  794.  
  795.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  796.  
  797.     new menuBody[512]
  798.     new b = 0
  799.     new i, iteam
  800.     new name[32], team[4]
  801.     new start = pos * 7
  802.  
  803.     if (start >= g_menuPlayersNum[id])
  804.         start = pos = g_menuPosition[id] = 0
  805.  
  806.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  807.     new end = start + 7
  808.     new keys = MENU_KEY_0|MENU_KEY_8
  809.  
  810.     if (end > g_menuPlayersNum[id])
  811.         end = g_menuPlayersNum[id]
  812.  
  813.     for (new a = start; a < end; ++a)
  814.     {
  815.         i = g_menuPlayers[id][a]
  816.         get_user_name(i, name, 31)
  817.        
  818.         if (g_cstrike)
  819.         {
  820.             iteam = _:cs_get_user_team(i)
  821.            
  822.             if (iteam == 1)
  823.             {
  824.                 copy(team, 3, "TE")
  825.             }
  826.             else if (iteam == 2)
  827.             {
  828.                 copy(team, 3, "CT")
  829.             }
  830.             else if (iteam == 3)
  831.             {
  832.                 copy(team, 3, "SPE");
  833.                 iteam = 6;
  834.             } else {
  835.                 iteam = get_user_team(i, team, 3)
  836.             }
  837.         } else {
  838.             iteam = get_user_team(i, team, 3)
  839.         }
  840.  
  841.         if ((iteam == g_CSTeamiNumbers[g_menuOption[id] % (g_cstrike ? 3 : 2)]) || (access(i, ADMIN_IMMUNITY) && i != id))
  842.         {
  843.             ++b
  844.            
  845.             if (g_coloredMenus)
  846.                 len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  847.             else
  848.                 len += format(menuBody[len], 511-len, "#. %s   %s^n", name, team)      
  849.         } else {
  850.             keys |= (1<<b)
  851.                
  852.             if (is_user_admin(i))
  853.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s *   %s^n", ++b, name, team)
  854.             else
  855.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s   %s^n", ++b, name, team)
  856.         }
  857.     }
  858.  
  859.     len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_CSTeamNames[g_menuOption[id] % (g_cstrike ? 3 : 2)])
  860.  
  861.     if (end != g_menuPlayersNum[id])
  862.     {
  863.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  864.         keys |= MENU_KEY_9
  865.     }
  866.     else
  867.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  868.  
  869.     show_menu(id, keys, menuBody, -1, "Team Menu")
  870. }
  871.  
  872. public cmdTeamMenu(id, level, cid)
  873. {
  874.     if (!cmd_access(id, level, cid, 1))
  875.         return PLUGIN_HANDLED
  876.  
  877.     g_menuOption[id] = 0
  878.  
  879.     displayTeamMenu(id, g_menuPosition[id] = 0)
  880.  
  881.     return PLUGIN_HANDLED
  882. }
  883.  
  884. /* Client cmds menu */
  885.  
  886. public actionClcmdMenu(id, key)
  887. {
  888.     switch (key)
  889.     {
  890.         case 7:
  891.         {
  892.             ++g_menuOption[id]
  893.             g_menuOption[id] %= g_menuSelectNum[id]
  894.             displayClcmdMenu(id, g_menuPosition[id])
  895.         }
  896.         case 8: displayClcmdMenu(id, ++g_menuPosition[id])
  897.         case 9: displayClcmdMenu(id, --g_menuPosition[id])
  898.         default:
  899.         {
  900.             new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  901.             new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
  902.            
  903.             if (is_user_connected(player))
  904.             {
  905.                 new command[512], authid[32], name[32], userid[32]
  906.                
  907.                 copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
  908.                 get_user_authid(player, authid, 31)
  909.                 get_user_name(player, name, 31)
  910.                 num_to_str(get_user_userid(player), userid, 31)
  911.                
  912.                 replace(command, charsmax(command), "%userid%", userid)
  913.                 replace(command, charsmax(command), "%authid%", authid)
  914.                 replace(command, charsmax(command), "%name%", name)
  915.                
  916.                 if (flags & 1)
  917.                 {
  918.                     server_cmd("%s", command)
  919.                     server_exec()
  920.                 } else if (flags & 2)
  921.                     client_cmd(id, "%s", command)
  922.                 else if (flags & 4)
  923.                     client_cmd(player, "%s", command)
  924.             }
  925.            
  926.             if (flags & 8)
  927.                 displayClcmdMenu(id, g_menuPosition[id])
  928.         }
  929.     }
  930.    
  931.     return PLUGIN_HANDLED
  932. }
  933.  
  934. displayClcmdMenu(id, pos)
  935. {
  936.     if (pos < 0)
  937.         return
  938.  
  939.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  940.  
  941.     new menuBody[512]
  942.     new b = 0
  943.     new i
  944.     new name[32]
  945.     new start = pos * 7
  946.  
  947.     if (start >= g_menuPlayersNum[id])
  948.         start = pos = g_menuPosition[id] = 0
  949.  
  950.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  951.     new end = start + 7
  952.     new keys = MENU_KEY_0|MENU_KEY_8
  953.  
  954.     if (end > g_menuPlayersNum[id])
  955.         end = g_menuPlayersNum[id]
  956.  
  957.     for (new a = start; a < end; ++a)
  958.     {
  959.         i = g_menuPlayers[id][a]
  960.         get_user_name(i, name, 31)
  961.  
  962.         if (!g_menuSelectNum[id] || (access(i, ADMIN_IMMUNITY) && i != id))
  963.         {
  964.             ++b
  965.            
  966.             if (g_coloredMenus)
  967.                 len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  968.             else
  969.                 len += format(menuBody[len], 511-len, "#. %s^n", name)     
  970.         } else {
  971.             keys |= (1<<b)
  972.                
  973.             if (is_user_admin(i))
  974.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  975.             else
  976.                 len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  977.         }
  978.     }
  979.  
  980.     if (g_menuSelectNum[id])
  981.         len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
  982.     else
  983.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
  984.  
  985.     if (end != g_menuPlayersNum[id])
  986.     {
  987.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  988.         keys |= MENU_KEY_9
  989.     }
  990.     else
  991.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  992.  
  993.     show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
  994. }
  995.  
  996. public cmdClcmdMenu(id, level, cid)
  997. {
  998.     if (!cmd_access(id, level, cid, 1))
  999.         return PLUGIN_HANDLED
  1000.  
  1001.     g_menuSelectNum[id] = 0
  1002.  
  1003.     for (new a = 0; a < g_clcmdNum; ++a)
  1004.         if (access(id, g_clcmdMisc[a][0]))
  1005.             g_menuSelect[id][g_menuSelectNum[id]++] = a
  1006.  
  1007.     g_menuOption[id] = 0
  1008.  
  1009.     displayClcmdMenu(id, g_menuPosition[id] = 0)
  1010.  
  1011.     return PLUGIN_HANDLED
  1012. }
  1013.  
  1014. load_settings(szFilename[])
  1015. {
  1016.     if (!file_exists(szFilename))
  1017.         return 0
  1018.  
  1019.     new text[256], szFlags[32], szAccess[32]
  1020.     new a, pos = 0
  1021.  
  1022.     while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
  1023.     {
  1024.         if (text[0] == ';') continue
  1025.  
  1026.         if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
  1027.         {
  1028.             while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
  1029.             {
  1030.                 // do nothing
  1031.             }
  1032.  
  1033.             g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
  1034.             g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
  1035.             g_clcmdNum++
  1036.         }
  1037.     }
  1038.  
  1039.     return 1
  1040. }

Átalakítod amxx-re, majd felrakod szerveredre, az alap plmenu plugint felülírva.
Ha az idő helyén az "Egyeni ido" van kiválasztva akkor a játékostól kéri, hogy írja be a bannolás idejét, ellenkező esetben csak okot kér.

Ők köszönték meg demon nek ezt a hozzászólást: K1LLeR (2016.05.15. 15:43)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ban Plugin
HozzászólásElküldve: 2016.05.15. 13:47 
Offline
Beavatott
Avatar

Csatlakozott: 2015.11.01. 11:29
Hozzászólások: 94
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 1 alkalommal
demon írta:
Advanced Bans pluginnal kompatibilis plmenu:
  1. /* AMX Mod X
  2. *   Players Menu Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. *  originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. *  This program is free software; you can redistribute it and/or modify it
  11. *  under the terms of the GNU General Public License as published by the
  12. *  Free Software Foundation; either version 2 of the License, or (at
  13. *  your option) any later version.
  14. *
  15. *  This program is distributed in the hope that it will be useful, but
  16. *  WITHOUT ANY WARRANTY; without even the implied warranty of
  17. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. *  General Public License for more details.
  19. *
  20. *  You should have received a copy of the GNU General Public License
  21. *  along with this program; if not, write to the Free Software Foundation,
  22. *  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. *  In addition, as a special exception, the author gives permission to
  25. *  link the code of this program with the Half-Life Game Engine ("HL
  26. *  Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. *  L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. *  respects for all of the code used other than the HL Engine and MODs
  29. *  from Valve. If you modify this file, you may extend this exception
  30. *  to your version of the file, but you are not obligated to do so. If
  31. *  you do not wish to do so, delete this exception statement from your
  32. *  version.
  33. */
  34.  
  35. #include <amxmodx>
  36. #include <amxmisc>
  37.  
  38. /** skip autoloading since it's optional */
  39. #define AMXMODX_NOAUTOLOAD
  40. #include <cstrike>
  41.  
  42. new g_menuPosition[33]
  43. new g_menuPlayers[33][32]
  44. new g_menuPlayersNum[33]
  45. new g_menuOption[33]
  46. new g_menuSettings[33]
  47.  
  48. new g_menuSelect[33][64]
  49. new g_menuSelectNum[33]
  50.  
  51. #define MAX_CLCMDS 24
  52.  
  53. new g_clcmdName[MAX_CLCMDS][32]
  54. new g_clcmdCmd[MAX_CLCMDS][64]
  55. new g_clcmdMisc[MAX_CLCMDS][2]
  56. new g_clcmdNum
  57.  
  58. new g_coloredMenus
  59. new g_cstrike = 0
  60.  
  61. new Array:g_bantimes;
  62. new Array:g_slapsettings;
  63.  
  64. new g_CSTeamNames[3][] = {
  65.     "TERRORIST",
  66.     "CT",
  67.     "SPECTATOR"
  68. }
  69. new g_CSTeamNumbers[3][] = {
  70.     "1",
  71.     "2",
  72.     "6"
  73. }
  74. new g_CSTeamiNumbers[3] = {
  75.     1,
  76.     2,
  77.     6
  78. }
  79.  
  80. new g_ban_player[33];
  81.  
  82.  
  83. public plugin_natives()
  84. {
  85.     set_module_filter("module_filter")
  86.     set_native_filter("native_filter")
  87. }
  88.  
  89. public plugin_init()
  90. {
  91.     register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
  92.     register_dictionary("common.txt")
  93.     register_dictionary("admincmd.txt")
  94.     register_dictionary("plmenu.txt")
  95.  
  96.     register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
  97.     register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
  98.     register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
  99.     register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
  100.     register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
  101.     register_clcmd("amx_banreason", "CmdBanReason", ADMIN_BAN, "<reason>");
  102.     register_clcmd("amx_bantime", "CmdBanTime", ADMIN_BAN, "<time>");
  103.  
  104.     register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu")
  105.     register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu")
  106.     register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu")
  107.     register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu")
  108.     register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu")
  109.    
  110.    
  111.     g_bantimes = ArrayCreate();
  112.     // Load up the old default values
  113.     ArrayPushCell(g_bantimes, 0);
  114.     ArrayPushCell(g_bantimes, 5);
  115.     ArrayPushCell(g_bantimes, 10);
  116.     ArrayPushCell(g_bantimes, 15);
  117.     ArrayPushCell(g_bantimes, 30);
  118.     ArrayPushCell(g_bantimes, 45);
  119.     ArrayPushCell(g_bantimes, 60);
  120.    
  121.    
  122.     g_slapsettings = ArrayCreate();
  123.     // Old default values
  124.     ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
  125.     ArrayPushCell(g_slapsettings, 0); // slap 0 damage
  126.     ArrayPushCell(g_slapsettings, 1);
  127.     ArrayPushCell(g_slapsettings, 5);
  128.    
  129.    
  130.     register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
  131.     register_srvcmd("amx_plmenu_slapdmg", "plmenu_setslapdmg");
  132.  
  133.     g_coloredMenus = colored_menus()
  134.  
  135.     new clcmds_ini_file[64]
  136.     get_configsdir(clcmds_ini_file, 63)
  137.     format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
  138.     load_settings(clcmds_ini_file)
  139.  
  140.     if (module_exists("cstrike"))
  141.         g_cstrike = 1
  142. }
  143. public plmenu_setbantimes()
  144. {
  145.     new buff[32];
  146.     new args = read_argc();
  147.    
  148.     if (args <= 1)
  149.     {
  150.         server_print("usage: amx_plmenu_bantimes <time1> [time2] [time3] ...");
  151.         server_print("   use time of 0 for permanent.");
  152.        
  153.         return;
  154.     }
  155.    
  156.     ArrayClear(g_bantimes);
  157.    
  158.     for (new i = 1; i < args; i++)
  159.     {
  160.         read_argv(i, buff, charsmax(buff));
  161.        
  162.         ArrayPushCell(g_bantimes, str_to_num(buff));
  163.        
  164.     }
  165.    
  166. }
  167. public plmenu_setslapdmg()
  168. {
  169.     new buff[32];
  170.     new args = read_argc();
  171.    
  172.     if (args <= 1)
  173.     {
  174.         server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
  175.         server_print("   slay is automatically set for the first value.");
  176.        
  177.         return;
  178.     }
  179.    
  180.     ArrayClear(g_slapsettings);
  181.    
  182.     ArrayPushCell(g_slapsettings, 0); // compensate for slay
  183.    
  184.     for (new i = 1; i < args; i++)
  185.     {
  186.         read_argv(i, buff, charsmax(buff));
  187.        
  188.         ArrayPushCell(g_slapsettings, str_to_num(buff));
  189.        
  190.     }
  191.    
  192. }
  193. public module_filter(const module[])
  194. {
  195.     if (equali(module, "cstrike"))
  196.         return PLUGIN_HANDLED
  197.    
  198.     return PLUGIN_CONTINUE
  199. }
  200.  
  201. public native_filter(const name[], index, trap)
  202. {
  203.     if (!trap)
  204.         return PLUGIN_HANDLED
  205.        
  206.     return PLUGIN_CONTINUE
  207. }
  208.  
  209. /* Ban menu */
  210.  
  211. public client_disconnect(id)
  212. {
  213.     g_ban_player[id] = 0;
  214. }
  215.  
  216. public CmdBanTime(id)
  217. {
  218.     new player = g_ban_player[id];
  219.    
  220.     if( !player ) return PLUGIN_HANDLED;
  221.    
  222.     new bantime[128], btime;
  223.     read_args(bantime, sizeof(bantime) - 1);
  224.     remove_quotes(bantime);
  225.     btime = str_to_num(bantime);
  226.     if(btime < 0) btime *= -1;
  227.    
  228.     g_menuSettings[id] = btime;
  229.    
  230.     client_cmd(id, "messagemode amx_banreason");
  231.            
  232.     client_print(id, print_chat, "[AMXX] Kerlek add meg az okot.");
  233.    
  234.     return PLUGIN_HANDLED;
  235. }
  236.  
  237. public CmdBanReason(id)
  238. {
  239.     new player = g_ban_player[id];
  240.    
  241.     if( !player ) return PLUGIN_HANDLED;
  242.    
  243.     new reason[128];
  244.     read_args(reason, sizeof(reason) - 1);
  245.     remove_quotes(reason);
  246.    
  247.     new name[32], name2[32], authid[32], authid2[32]
  248.  
  249.     get_user_name(player, name2, 31)
  250.     get_user_authid(id, authid, 31)
  251.     get_user_authid(player, authid2, 31)
  252.     get_user_name(id, name, 31)
  253.    
  254.     new userid2 = get_user_userid(player)
  255.  
  256.     log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id], reason)
  257.  
  258.     if ( !equal("STEAM_0:", authid2, 8))
  259.     {
  260.         client_cmd(id, "amx_banip #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  261.     }
  262.     else
  263.     {
  264.         client_cmd(id, "amx_ban #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  265.     }
  266.  
  267.     server_exec()
  268.    
  269.     g_ban_player[id] = 0;
  270.  
  271.     displayBanMenu(id, g_menuPosition[id])
  272.    
  273.     return PLUGIN_HANDLED;
  274. }
  275.  
  276. public actionBanMenu(id, key)
  277. {
  278.     switch (key)
  279.     {
  280.         case 7:
  281.         {
  282.             /* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
  283.            
  284.             ++g_menuOption[id]
  285.             if(g_menuOption[id] != ArraySize(g_bantimes))
  286.                 g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
  287.             else
  288.             {
  289.                 g_menuOption[id] = -1;
  290.                 g_menuSettings[id] = -1;
  291.             }
  292.            
  293.  
  294.             displayBanMenu(id, g_menuPosition[id])
  295.         }
  296.         case 8: displayBanMenu(id, ++g_menuPosition[id])
  297.         case 9: displayBanMenu(id, --g_menuPosition[id])
  298.         default:
  299.         {
  300.             g_ban_player[id] = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  301.            
  302.             if(g_menuSettings[id] == -1)
  303.             {
  304.                 client_cmd(id, "messagemode amx_bantime");
  305.            
  306.                 client_print(id, print_chat, "[AMXX] Kerlek add meg az idot.");
  307.             }
  308.             else
  309.             {
  310.                 client_cmd(id, "messagemode amx_banreason");
  311.            
  312.                 client_print(id, print_chat, "[AMXX] Kerlek add meg az okot.");
  313.             }
  314.            
  315.            
  316.             /*new name[32], name2[32], authid[32], authid2[32]
  317.        
  318.             get_user_name(player, name2, 31)
  319.             get_user_authid(id, authid, 31)
  320.             get_user_authid(player, authid2, 31)
  321.             get_user_name(id, name, 31)
  322.            
  323.             new userid2 = get_user_userid(player)
  324.  
  325.             log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id])
  326.  
  327.             if (g_menuSettings[id]==0) // permanent
  328.             {
  329.                 new maxpl = get_maxplayers();
  330.                 for (new i = 1; i <= maxpl; i++)
  331.                 {
  332.                     show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM");
  333.                 }
  334.             }
  335.             else
  336.             {
  337.                 new tempTime[32];
  338.                 formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
  339.                 new maxpl = get_maxplayers();
  340.                 for (new i = 1; i <= maxpl; i++)
  341.                 {
  342.                     show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
  343.                 }
  344.             }
  345.             // ---------- check for Steam ID added by MistaGee --------------------
  346.             // IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE
  347.            
  348.             if (equal("4294967295", authid2)
  349.                 || equal("HLTV", authid2)
  350.                 || equal("STEAM_ID_LAN", authid2)
  351.                 || equali("VALVE_ID_LAN", authid2))
  352.             {
  353.                 // END OF MODIFICATIONS BY MISTAGEE
  354.                 server_cmd("amx_banip #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  355.             }
  356.             else
  357.             {
  358.                 server_cmd("amx_ban #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  359.             }
  360.  
  361.             server_exec()
  362.  
  363.             displayBanMenu(id, g_menuPosition[id])*/
  364.         }
  365.     }
  366.    
  367.     return PLUGIN_HANDLED
  368. }
  369.  
  370. displayBanMenu(id, pos)
  371. {
  372.     if (pos < 0)
  373.         return
  374.  
  375.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  376.  
  377.     new menuBody[512]
  378.     new b = 0
  379.     new i
  380.     new name[32]
  381.     new start = pos * 7
  382.  
  383.     if (start >= g_menuPlayersNum[id])
  384.         start = pos = g_menuPosition[id] = 0
  385.  
  386.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  387.     new end = start + 7
  388.     new keys = MENU_KEY_0|MENU_KEY_8
  389.  
  390.     if (end > g_menuPlayersNum[id])
  391.         end = g_menuPlayersNum[id]
  392.  
  393.     for (new a = start; a < end; ++a)
  394.     {
  395.         i = g_menuPlayers[id][a]
  396.         get_user_name(i, name, 31)
  397.  
  398.         if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  399.         {
  400.             ++b
  401.            
  402.             if (g_coloredMenus)
  403.                 len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  404.             else
  405.                 len += format(menuBody[len], 511-len, "#. %s^n", name)
  406.         } else {
  407.             keys |= (1<<b)
  408.                
  409.             if (is_user_admin(i))
  410.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  411.             else
  412.                 len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  413.         }
  414.     }
  415.  
  416.     if (g_menuSettings[id] == -1)
  417.         len += format(menuBody[len], 511-len, "^n8. Egyeni ido^n")
  418.     else if (g_menuSettings[id])
  419.     {
  420.         new banLength[32]
  421.         if (timeToString(g_menuSettings[id], banLength, 31))
  422.             len += format(menuBody[len], 511-len, "^n8. Ban for %s^n", banLength)
  423.         else
  424.             len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
  425.     }
  426.     else
  427.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
  428.  
  429.     if (end != g_menuPlayersNum[id])
  430.     {
  431.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  432.         keys |= MENU_KEY_9
  433.     }
  434.     else
  435.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  436.  
  437.     show_menu(id, keys, menuBody, -1, "Ban Menu")
  438. }
  439.  
  440. timeToString(minutes, output[], len)
  441. {
  442.     new hours = minutes / 60;
  443.     minutes %= 60;
  444.    
  445.     new days = hours / 24;
  446.     hours %= 24;
  447.    
  448.     new ret
  449.    
  450.     if (days)
  451.         ret += formatex(output[ret], len-ret, "%s%d day%s", ret ? ", " : "", days, (days == 1) ? "" : "s")
  452.    
  453.     if (hours)
  454.         ret += formatex(output[ret], len-ret, "%s%d hour%s", ret ? ", " : "", hours, (hours == 1) ? "" : "s")
  455.    
  456.     if (minutes)
  457.         ret += formatex(output[ret], len-ret, "%s%d minute%s", ret ? ", " : "", minutes, (minutes == 1) ? "" : "s")
  458.    
  459.     return ret
  460. }
  461.  
  462. public cmdBanMenu(id, level, cid)
  463. {
  464.     if (!cmd_access(id, level, cid, 1))
  465.         return PLUGIN_HANDLED
  466.  
  467.     g_menuOption[id] = -1
  468.    
  469.     g_menuSettings[id] = -1
  470.    
  471.     displayBanMenu(id, g_menuPosition[id] = 0)
  472.  
  473.     return PLUGIN_HANDLED
  474. }
  475.  
  476. /* Slap/Slay */
  477.  
  478. public actionSlapMenu(id, key)
  479. {
  480.     switch (key)
  481.     {
  482.         case 7:
  483.         {
  484.             ++g_menuOption[id]
  485.            
  486.             g_menuOption[id] %= ArraySize(g_slapsettings);
  487.            
  488.             g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  489.            
  490.             displaySlapMenu(id, g_menuPosition[id]);
  491.         }
  492.         case 8: displaySlapMenu(id, ++g_menuPosition[id])
  493.         case 9: displaySlapMenu(id, --g_menuPosition[id])
  494.         default:
  495.         {
  496.             new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  497.             new name2[32]
  498.            
  499.             get_user_name(player, name2, 31)
  500.  
  501.             if (!is_user_alive(player))
  502.             {
  503.                 client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
  504.                 displaySlapMenu(id, g_menuPosition[id])
  505.                 return PLUGIN_HANDLED
  506.             }
  507.  
  508.             new authid[32], authid2[32], name[32]
  509.  
  510.             get_user_authid(id, authid, 31)
  511.             get_user_authid(player, authid2, 31)
  512.             get_user_name(id, name, 31)
  513.  
  514.             if (g_menuOption[id])
  515.             {
  516.                 log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2)
  517.  
  518.                 show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
  519.             } else {
  520.                 log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
  521.                
  522.                 show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
  523.             }
  524.  
  525.             if (g_menuOption[id])
  526.                 user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
  527.             else
  528.                 user_kill(player)
  529.  
  530.             displaySlapMenu(id, g_menuPosition[id])
  531.         }
  532.     }
  533.    
  534.     return PLUGIN_HANDLED
  535. }
  536.  
  537. displaySlapMenu(id, pos)
  538. {
  539.     if (pos < 0)
  540.         return
  541.  
  542.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  543.  
  544.     new menuBody[512]
  545.     new b = 0
  546.     new i
  547.     new name[32], team[4]
  548.     new start = pos * 7
  549.  
  550.     if (start >= g_menuPlayersNum[id])
  551.         start = pos = g_menuPosition[id] = 0
  552.  
  553.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  554.     new end = start + 7
  555.     new keys = MENU_KEY_0|MENU_KEY_8
  556.  
  557.     if (end > g_menuPlayersNum[id])
  558.         end = g_menuPlayersNum[id]
  559.  
  560.     for (new a = start; a < end; ++a)
  561.     {
  562.         i = g_menuPlayers[id][a]
  563.         get_user_name(i, name, 31)
  564.        
  565.         if (g_cstrike)
  566.         {
  567.             if (cs_get_user_team(i) == CS_TEAM_T)
  568.             {
  569.                 copy(team, 3, "TE")
  570.             }
  571.             else if (cs_get_user_team(i) == CS_TEAM_CT)
  572.             {
  573.                 copy(team, 3, "CT")
  574.             } else {
  575.                 get_user_team(i, team, 3)
  576.             }
  577.         } else {
  578.             get_user_team(i, team, 3)
  579.         }
  580.  
  581.         if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  582.         {
  583.             ++b
  584.        
  585.             if (g_coloredMenus)
  586.                 len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  587.             else
  588.                 len += format(menuBody[len], 511-len, "#. %s   %s^n", name, team)      
  589.         } else {
  590.             keys |= (1<<b)
  591.                
  592.             if (is_user_admin(i))
  593.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s *   %s^n", ++b, name, team)
  594.             else
  595.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s   %s^n", ++b, name, team)
  596.         }
  597.     }
  598.  
  599.     if (g_menuOption[id])
  600.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
  601.     else
  602.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
  603.  
  604.     if (end != g_menuPlayersNum[id])
  605.     {
  606.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  607.         keys |= MENU_KEY_9
  608.     }
  609.     else
  610.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  611.  
  612.     show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
  613. }
  614.  
  615. public cmdSlapMenu(id, level, cid)
  616. {
  617.     if (!cmd_access(id, level, cid, 1))
  618.         return PLUGIN_HANDLED
  619.  
  620.     g_menuOption[id] = 0
  621.     if (ArraySize(g_slapsettings) > 0)
  622.     {
  623.         g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  624.     }
  625.     else
  626.     {
  627.         // should never happen, but failsafe
  628.         g_menuSettings[id] = 0
  629.     }
  630.  
  631.     displaySlapMenu(id, g_menuPosition[id] = 0)
  632.  
  633.     return PLUGIN_HANDLED
  634. }
  635.  
  636. /* Kick */
  637.  
  638. public actionKickMenu(id, key)
  639. {
  640.     switch (key)
  641.     {
  642.         case 8: displayKickMenu(id, ++g_menuPosition[id])
  643.         case 9: displayKickMenu(id, --g_menuPosition[id])
  644.         default:
  645.         {
  646.             new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
  647.             new authid[32], authid2[32], name[32], name2[32]
  648.            
  649.             get_user_authid(id, authid, 31)
  650.             get_user_authid(player, authid2, 31)
  651.             get_user_name(id, name, 31)
  652.             get_user_name(player, name2, 31)
  653.            
  654.             new userid2 = get_user_userid(player)
  655.  
  656.             log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2)
  657.  
  658.             show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2);
  659.  
  660.            
  661.             server_cmd("kick #%d", userid2)
  662.             server_exec()
  663.  
  664.             displayKickMenu(id, g_menuPosition[id])
  665.         }
  666.     }
  667.  
  668.     return PLUGIN_HANDLED
  669. }
  670.  
  671. displayKickMenu(id, pos)
  672. {
  673.     if (pos < 0)
  674.         return
  675.  
  676.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  677.  
  678.     new menuBody[512]
  679.     new b = 0
  680.     new i
  681.     new name[32]
  682.     new start = pos * 8
  683.  
  684.     if (start >= g_menuPlayersNum[id])
  685.         start = pos = g_menuPosition[id] = 0
  686.  
  687.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
  688.     new end = start + 8
  689.     new keys = MENU_KEY_0
  690.  
  691.     if (end > g_menuPlayersNum[id])
  692.         end = g_menuPlayersNum[id]
  693.  
  694.     for (new a = start; a < end; ++a)
  695.     {
  696.         i = g_menuPlayers[id][a]
  697.         get_user_name(i, name, 31)
  698.  
  699.         if (access(i, ADMIN_IMMUNITY) && i != id)
  700.         {
  701.             ++b
  702.        
  703.             if (g_coloredMenus)
  704.                 len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  705.             else
  706.                 len += format(menuBody[len], 511-len, "#. %s^n", name)
  707.         } else {
  708.             keys |= (1<<b)
  709.                
  710.             if (is_user_admin(i))
  711.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  712.             else
  713.                 len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  714.         }
  715.     }
  716.  
  717.     if (end != g_menuPlayersNum[id])
  718.     {
  719.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  720.         keys |= MENU_KEY_9
  721.     }
  722.     else
  723.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  724.  
  725.     show_menu(id, keys, menuBody, -1, "Kick Menu")
  726. }
  727.  
  728. public cmdKickMenu(id, level, cid)
  729. {
  730.     if (cmd_access(id, level, cid, 1))
  731.         displayKickMenu(id, g_menuPosition[id] = 0)
  732.  
  733.     return PLUGIN_HANDLED
  734. }
  735.  
  736. /* Team menu */
  737.  
  738. public actionTeamMenu(id, key)
  739. {
  740.     switch (key)
  741.     {
  742.         case 7:
  743.         {
  744.             g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike ? 3 : 2);
  745.             displayTeamMenu(id, g_menuPosition[id])
  746.         }
  747.         case 8: displayTeamMenu(id, ++g_menuPosition[id])
  748.         case 9: displayTeamMenu(id, --g_menuPosition[id])
  749.         default:
  750.         {
  751.             new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  752.             new authid[32], authid2[32], name[32], name2[32]
  753.  
  754.             get_user_name(player, name2, 31)
  755.             get_user_authid(id, authid, 31)
  756.             get_user_authid(player, authid2, 31)
  757.             get_user_name(id, name, 31)
  758.                
  759.             log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_menuOption[id] ? "TERRORIST" : "CT")
  760.  
  761.             show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[g_menuOption[id] % 3]);
  762.  
  763.             if (g_cstrike)
  764.             {
  765.                 if (is_user_alive(player))
  766.                 {
  767.                     new deaths = cs_get_user_deaths(player)
  768.                     user_kill(player, 1)
  769.                     cs_set_user_deaths(player, deaths)
  770.                 }
  771.                 // This modulo math just aligns the option to the CsTeams-corresponding number
  772.                 cs_set_user_team(player, (g_menuOption[id] % 3) + 1)
  773.                 cs_reset_user_model(player)
  774.             } else {
  775.                 new limit_setting = get_cvar_num("mp_limitteams")
  776.                
  777.                 set_cvar_num("mp_limitteams", 0)
  778.                 engclient_cmd(player, "jointeam", g_CSTeamNumbers[g_menuOption[id] % 2])
  779.                 engclient_cmd(player, "joinclass", "1")
  780.                 set_cvar_num("mp_limitteams", limit_setting)
  781.             }
  782.  
  783.             displayTeamMenu(id, g_menuPosition[id])
  784.         }
  785.     }
  786.    
  787.     return PLUGIN_HANDLED
  788. }
  789.  
  790. displayTeamMenu(id, pos)
  791. {
  792.     if (pos < 0)
  793.         return
  794.  
  795.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  796.  
  797.     new menuBody[512]
  798.     new b = 0
  799.     new i, iteam
  800.     new name[32], team[4]
  801.     new start = pos * 7
  802.  
  803.     if (start >= g_menuPlayersNum[id])
  804.         start = pos = g_menuPosition[id] = 0
  805.  
  806.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  807.     new end = start + 7
  808.     new keys = MENU_KEY_0|MENU_KEY_8
  809.  
  810.     if (end > g_menuPlayersNum[id])
  811.         end = g_menuPlayersNum[id]
  812.  
  813.     for (new a = start; a < end; ++a)
  814.     {
  815.         i = g_menuPlayers[id][a]
  816.         get_user_name(i, name, 31)
  817.        
  818.         if (g_cstrike)
  819.         {
  820.             iteam = _:cs_get_user_team(i)
  821.            
  822.             if (iteam == 1)
  823.             {
  824.                 copy(team, 3, "TE")
  825.             }
  826.             else if (iteam == 2)
  827.             {
  828.                 copy(team, 3, "CT")
  829.             }
  830.             else if (iteam == 3)
  831.             {
  832.                 copy(team, 3, "SPE");
  833.                 iteam = 6;
  834.             } else {
  835.                 iteam = get_user_team(i, team, 3)
  836.             }
  837.         } else {
  838.             iteam = get_user_team(i, team, 3)
  839.         }
  840.  
  841.         if ((iteam == g_CSTeamiNumbers[g_menuOption[id] % (g_cstrike ? 3 : 2)]) || (access(i, ADMIN_IMMUNITY) && i != id))
  842.         {
  843.             ++b
  844.            
  845.             if (g_coloredMenus)
  846.                 len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  847.             else
  848.                 len += format(menuBody[len], 511-len, "#. %s   %s^n", name, team)      
  849.         } else {
  850.             keys |= (1<<b)
  851.                
  852.             if (is_user_admin(i))
  853.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s *   %s^n", ++b, name, team)
  854.             else
  855.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s   %s^n", ++b, name, team)
  856.         }
  857.     }
  858.  
  859.     len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_CSTeamNames[g_menuOption[id] % (g_cstrike ? 3 : 2)])
  860.  
  861.     if (end != g_menuPlayersNum[id])
  862.     {
  863.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  864.         keys |= MENU_KEY_9
  865.     }
  866.     else
  867.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  868.  
  869.     show_menu(id, keys, menuBody, -1, "Team Menu")
  870. }
  871.  
  872. public cmdTeamMenu(id, level, cid)
  873. {
  874.     if (!cmd_access(id, level, cid, 1))
  875.         return PLUGIN_HANDLED
  876.  
  877.     g_menuOption[id] = 0
  878.  
  879.     displayTeamMenu(id, g_menuPosition[id] = 0)
  880.  
  881.     return PLUGIN_HANDLED
  882. }
  883.  
  884. /* Client cmds menu */
  885.  
  886. public actionClcmdMenu(id, key)
  887. {
  888.     switch (key)
  889.     {
  890.         case 7:
  891.         {
  892.             ++g_menuOption[id]
  893.             g_menuOption[id] %= g_menuSelectNum[id]
  894.             displayClcmdMenu(id, g_menuPosition[id])
  895.         }
  896.         case 8: displayClcmdMenu(id, ++g_menuPosition[id])
  897.         case 9: displayClcmdMenu(id, --g_menuPosition[id])
  898.         default:
  899.         {
  900.             new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  901.             new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
  902.            
  903.             if (is_user_connected(player))
  904.             {
  905.                 new command[512], authid[32], name[32], userid[32]
  906.                
  907.                 copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
  908.                 get_user_authid(player, authid, 31)
  909.                 get_user_name(player, name, 31)
  910.                 num_to_str(get_user_userid(player), userid, 31)
  911.                
  912.                 replace(command, charsmax(command), "%userid%", userid)
  913.                 replace(command, charsmax(command), "%authid%", authid)
  914.                 replace(command, charsmax(command), "%name%", name)
  915.                
  916.                 if (flags & 1)
  917.                 {
  918.                     server_cmd("%s", command)
  919.                     server_exec()
  920.                 } else if (flags & 2)
  921.                     client_cmd(id, "%s", command)
  922.                 else if (flags & 4)
  923.                     client_cmd(player, "%s", command)
  924.             }
  925.            
  926.             if (flags & 8)
  927.                 displayClcmdMenu(id, g_menuPosition[id])
  928.         }
  929.     }
  930.    
  931.     return PLUGIN_HANDLED
  932. }
  933.  
  934. displayClcmdMenu(id, pos)
  935. {
  936.     if (pos < 0)
  937.         return
  938.  
  939.     get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  940.  
  941.     new menuBody[512]
  942.     new b = 0
  943.     new i
  944.     new name[32]
  945.     new start = pos * 7
  946.  
  947.     if (start >= g_menuPlayersNum[id])
  948.         start = pos = g_menuPosition[id] = 0
  949.  
  950.     new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  951.     new end = start + 7
  952.     new keys = MENU_KEY_0|MENU_KEY_8
  953.  
  954.     if (end > g_menuPlayersNum[id])
  955.         end = g_menuPlayersNum[id]
  956.  
  957.     for (new a = start; a < end; ++a)
  958.     {
  959.         i = g_menuPlayers[id][a]
  960.         get_user_name(i, name, 31)
  961.  
  962.         if (!g_menuSelectNum[id] || (access(i, ADMIN_IMMUNITY) && i != id))
  963.         {
  964.             ++b
  965.            
  966.             if (g_coloredMenus)
  967.                 len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  968.             else
  969.                 len += format(menuBody[len], 511-len, "#. %s^n", name)     
  970.         } else {
  971.             keys |= (1<<b)
  972.                
  973.             if (is_user_admin(i))
  974.                 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  975.             else
  976.                 len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  977.         }
  978.     }
  979.  
  980.     if (g_menuSelectNum[id])
  981.         len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
  982.     else
  983.         len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
  984.  
  985.     if (end != g_menuPlayersNum[id])
  986.     {
  987.         format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  988.         keys |= MENU_KEY_9
  989.     }
  990.     else
  991.         format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  992.  
  993.     show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
  994. }
  995.  
  996. public cmdClcmdMenu(id, level, cid)
  997. {
  998.     if (!cmd_access(id, level, cid, 1))
  999.         return PLUGIN_HANDLED
  1000.  
  1001.     g_menuSelectNum[id] = 0
  1002.  
  1003.     for (new a = 0; a < g_clcmdNum; ++a)
  1004.         if (access(id, g_clcmdMisc[a][0]))
  1005.             g_menuSelect[id][g_menuSelectNum[id]++] = a
  1006.  
  1007.     g_menuOption[id] = 0
  1008.  
  1009.     displayClcmdMenu(id, g_menuPosition[id] = 0)
  1010.  
  1011.     return PLUGIN_HANDLED
  1012. }
  1013.  
  1014. load_settings(szFilename[])
  1015. {
  1016.     if (!file_exists(szFilename))
  1017.         return 0
  1018.  
  1019.     new text[256], szFlags[32], szAccess[32]
  1020.     new a, pos = 0
  1021.  
  1022.     while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
  1023.     {
  1024.         if (text[0] == ';') continue
  1025.  
  1026.         if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
  1027.         {
  1028.             while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
  1029.             {
  1030.                 // do nothing
  1031.             }
  1032.  
  1033.             g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
  1034.             g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
  1035.             g_clcmdNum++
  1036.         }
  1037.     }
  1038.  
  1039.     return 1
  1040. }

Átalakítod amxx-re, majd felrakod szerveredre, az alap plmenu plugint felülírva.
Ha az idő helyén az "Egyeni ido" van kiválasztva akkor a játékostól kéri, hogy írja be a bannolás idejét, ellenkező esetben csak okot kér.



Es egy lang/baninfo.ini-t nem tudnal adni hogy weboldalt tegyunk hozza ? hogy hol kerhetnek unbant?

pl igy irna ki csak + oda lenne irva hogy innen kerhecc unbant : http://www.weboldalam.hu pl stb itt egy kep

_________________
Kép
Kép


A hozzászólást 1 alkalommal szerkesztették, utoljára DeteCT0R 2016.05.15. 15:14-kor.
Nem reklamozunk.


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  [ 13 hozzászólás ]  Oldal Előző 1 2


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 10 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