seroff

New_Anti_Reconnect 3.2 By JohnJ, Fix Seroff!

Dec 27th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fun>
  4.  
  5. new PLUGIN[]="New_Anti_Reconnect"
  6. new AUTHOR[]="JohnJ"
  7. new VERSION[]="3.2"
  8.  
  9. new RTIME[]="amx_reconnect_time"
  10. new RCAN[]="amx_reconnect_can"
  11. new SCORESAVE[]="amx_reconnect_ss"
  12. new RSTATIC[]="amx_reconnect_static"
  13. new RSTIME[]="amx_reconnect_stime"
  14.  
  15. new t_disconnect[33] = {0, ...}
  16. new t_scoresave[33] = {0, ...}
  17. new ips[33][24]
  18. new sfrags[33] = {0, ...}
  19. new sdeaths[33] = {0, ...}
  20. new useretry[33] = {0, ...}
  21.  
  22. public plugin_init()
  23. {
  24. register_plugin(PLUGIN, VERSION, AUTHOR)
  25. register_cvar(RTIME, "7")
  26. register_cvar(RCAN, "0")
  27. register_cvar(SCORESAVE, "1")
  28. register_cvar(RSTATIC, "1")
  29. register_cvar(RSTIME, "7")
  30. register_event("TeamInfo","outspec","a") // восстанавливает счёт игроку в соответствии с настройками как только тот зайдёт за команду
  31. }
  32.  
  33. public client_connect(id)
  34. {
  35. new maxexit = get_cvar_num(RTIME)
  36. new maxstata = get_cvar_num(RSTIME)
  37. new canreconnect = get_cvar_num(RCAN)
  38. new ssave = get_cvar_num(SCORESAVE)
  39. new ip[24]
  40. get_user_ip(id,ip,23,0)
  41.  
  42. client_cmd(id, "mp3 play sound/waitsound_1w.mp3")
  43.  
  44. if ((maxexit>0) && (canreconnect==0) && (equali(ip,ips[id])))
  45. {
  46. new Float:nexTime = get_gametime()
  47.  
  48. if (t_disconnect[id] > nexTime)
  49. {
  50. new stat = get_cvar_num(RSTATIC)
  51. new timewait
  52. if (stat==0)
  53. {
  54. t_disconnect[id] = floatround(nexTime) + maxexit
  55. t_scoresave[id] = floatround(nexTime) + maxstata
  56. timewait=maxexit
  57. }
  58. else
  59. {
  60. timewait=t_disconnect[id]-floatround(nexTime)
  61. }
  62. server_cmd("kick #%d ^"Реконнект ЗАПРЕЩЁН. Жди %d секунд.^"", get_user_userid(id), timewait)
  63. return PLUGIN_CONTINUE
  64. }
  65. }
  66. if (ssave==1)
  67. {
  68. new Float:nexTime = get_gametime()
  69.  
  70. if (t_scoresave[id] <= nexTime)
  71. {
  72. sdeaths[id]=0
  73. sfrags[id]=0
  74. useretry[id]=0
  75. }
  76. return PLUGIN_CONTINUE
  77. }
  78.  
  79. return PLUGIN_CONTINUE
  80. }
  81.  
  82. public outspec()
  83. {
  84. new id=read_data(1)
  85. if ((useretry[id]==1) && (is_user_connected(id)))
  86. {
  87. cs_set_user_deaths(id,sdeaths[id])
  88. set_user_frags(id,sfrags[id])
  89. useretry[id]=0
  90. sdeaths[id]=0
  91. sfrags[id]=0
  92. }
  93. return PLUGIN_CONTINUE
  94. }
  95.  
  96. public client_disconnect(id)
  97. {
  98. new maxexit = get_cvar_num(RTIME)
  99. new maxstata = get_cvar_num(RSTIME)
  100. new ssave = get_cvar_num(SCORESAVE)
  101.  
  102. new Float:theTime = get_gametime()
  103. t_disconnect[id] = floatround(theTime) + maxexit
  104. t_scoresave[id] = floatround(theTime) + maxstata
  105. get_user_ip(id,ips[id],23,0)
  106.  
  107. if (ssave==1)
  108. {
  109. sdeaths[id] = get_user_deaths(id)
  110. sfrags[id] = get_user_frags(id)
  111. useretry[id]=1
  112. }
  113. return PLUGIN_CONTINUE
  114. }
  115.  
  116. public plugin_precache()
  117. {
  118. precache_generic("sound/waitsound_1w.mp3")
  119. }
Advertisement
Add Comment
Please, Sign In to add comment