HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* AMX Mod X script.
  2. * AG Menu
  3. *
  4. * by Sparky911
  5. *
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software Foundation,
  19. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * In addition, as a special exception, the author gives permission to
  22. * link the code of this program with the Half-Life Game Engine ("HL
  23. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  24. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  25. * respects for all of the code used other than the HL Engine and MODs
  26. * from Valve. If you modify this file, you may extend this exception
  27. * to your version of the file, but you are not obligated to do so. If
  28. * you do not wish to do so, delete this exception statement from your
  29. * version.
  30. */
  31.  
  32. #include <amxmodx>
  33. #include <amxmisc>
  34.  
  35. new PLUGIN[]="AMX PASS/NO PASS"
  36. new AUTHOR[]="Sparky911"
  37. new VERSION[]="1.00"
  38.  
  39. new authid[32]
  40. new name[32]
  41.  
  42. public plugin_init()
  43. {
  44. register_plugin(PLUGIN, VERSION, AUTHOR)
  45.  
  46. register_concmd("amx_pass", "pass", ADMIN_BAN, "- Sets a server password")
  47. register_concmd("amx_nopass", "nopass", ADMIN_BAN, "- Removes the server password")
  48. }
  49.  
  50. public pass(id, level, cid)
  51. {
  52. if(!cmd_access(id, level, cid, 1))
  53. return PLUGIN_HANDLED
  54.  
  55. new cmd[32], password[128]
  56.  
  57. read_argv(0, cmd, 31)
  58. read_args(password, 127)
  59. replace(password, 127, cmd, "")
  60. format(password, 127, "%s", password)
  61.  
  62. get_user_name(id, name, 31)
  63. get_user_authid(id, authid, 31)
  64. switch (get_cvar_num("amx_show_activity")) {
  65. case 2: client_print(0,print_chat,"ADMIN %s has set a server password",name)
  66. case 1: client_print(0,print_chat,"ADMIN: A server password has been set")
  67. }
  68. log_amx("Cmd: ^"%s<%d><%s>^" set the server password to %s",name,get_user_userid(id),authid,password)
  69. set_cvar_string("sv_password", password)
  70.  
  71. return PLUGIN_HANDLED
  72. }
  73.  
  74. public nopass(id, level, cid)
  75. {
  76. if(!cmd_access(id, level, cid, 1))
  77. return PLUGIN_HANDLED
  78.  
  79. get_user_name(id, name, 31)
  80. get_user_authid(id, authid, 31)
  81. switch (get_cvar_num("amx_show_activity")) {
  82. case 2: client_print(0,print_chat,"ADMIN %s has removed the server password",name)
  83. case 1: client_print(0,print_chat,"ADMIN: The server password has been removed")
  84. }
  85. log_amx("Cmd: ^"%s<%d><%s>^" removed server password", name,get_user_userid(id),authid)
  86. set_cvar_string("sv_password", "")
  87.  
  88. return PLUGIN_HANDLED
  89. }