HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* AMX Mod script
  2.  
  3. Forditotta: Dave www.amxmodx.extra.hu sajtdavid@hotmail.com www.dav3.extra.hu
  4.  
  5. *
  6. * (c) 2002-2003, DynAstY
  7. * This file is provided as is (no warranties).
  8. *
  9. * Players with immunity won't be checked
  10. */
  11.  
  12. #include <amxmodx>
  13.  
  14. new HIGHPING_MAX = 150 // set maximal acceptable ping
  15. new HIGHPING_TIME = 5 // set in seconds frequency of ping checking
  16. new HIGHPING_TESTS = 4 // minimal number of checks before doing anything
  17.  
  18. new iNumTests[33]
  19.  
  20. public plugin_init() {
  21. register_plugin("High Ping Kicker","1.2.0","DynAstY")
  22. if (HIGHPING_TIME < 15) HIGHPING_TIME = 15
  23. if (HIGHPING_TESTS < 4) HIGHPING_TESTS = 4
  24. return PLUGIN_CONTINUE
  25. }
  26.  
  27. public client_disconnect(id) {
  28. remove_task(id)
  29. return PLUGIN_CONTINUE
  30. }
  31.  
  32. public client_putinserver(id) {
  33. iNumTests[id] = 0
  34. if (!is_user_bot(id)) {
  35. new param[1]
  36. param[0] = id
  37. set_task(30.0, "showWarn", id, param, 1)
  38. }
  39. return PLUGIN_CONTINUE
  40. }
  41.  
  42. kickPlayer(id) {
  43. new name[32]
  44. get_user_name(id, name, 31)
  45. new uID = get_user_userid(id)
  46. server_cmd("banid 1 #%d", uID)
  47. client_cmd(id, "echo ^"[HPK] Lecsatlakozva, a magas ping miatt!^"; disconnect")
  48. client_print(0, print_chat, "[HPK] %s lecsatlakoztatva, magas ping-je miatt!", name)
  49. return PLUGIN_CONTINUE
  50. }
  51.  
  52. public checkPing(param[]) {
  53. new id = param[0]
  54. if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION)) {
  55. remove_task(id)
  56. client_print(id, print_chat, "[HPK] Ping Ellenorzes Letiltva Inmunissag Miatt...")
  57. return PLUGIN_CONTINUE
  58. }
  59. new p, l
  60. get_user_ping(id, p, l)
  61. if (p > HIGHPING_MAX)
  62. ++iNumTests[id]
  63. else
  64. if (iNumTests[id] > 0) --iNumTests[id]
  65. if (iNumTests[id] > HIGHPING_TESTS)
  66. kickPlayer(id)
  67. return PLUGIN_CONTINUE
  68. }
  69.  
  70. public showWarn(param[]) {
  71. client_print(param[0], print_chat, "[HPK] Akinek magasabb a pingje %dms-nel, nem jatszhat a szerveren!", HIGHPING_MAX)
  72. set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
  73. return PLUGIN_CONTINUE
  74. }
  75.  
  76.