hlmod.hu
https://hlmod.hu/

Kickre írás
https://hlmod.hu/viewtopic.php?f=9&t=21518
Oldal: 1 / 1

Szerző:  SmaCk [ 2015.07.16. 12:33 ]
Hozzászólás témája:  Kickre írás

Sziasztok.

Ezt valaki átírná nekem, hogy kickelje a játékosokat, ne bannolja?!

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. enum Color
  3. {
  4. NORMAL = 1, // clients scr_concolor cvar color
  5. GREEN, // Green Color
  6. TEAM_COLOR, // Red, grey, blue
  7. GREY, // grey
  8. RED, // Red
  9. BLUE, // Blue
  10. }
  11.  
  12. new TeamName[][] =
  13. {
  14. "",
  15. "TERRORIST",
  16. "CT",
  17. "SPECTATOR"
  18. }
  19.  
  20. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  21. {
  22. static message[256];
  23.  
  24. switch(type)
  25. {
  26. case NORMAL: // clients scr_concolor cvar color
  27. {
  28. message[0] = 0x01;
  29. }
  30. case GREEN: // Green
  31. {
  32. message[0] = 0x04;
  33. }
  34. default: // White, Red, Blue
  35. {
  36. message[0] = 0x03;
  37. }
  38. }
  39.  
  40. vformat(message[1], 251, msg, 4);
  41. message[192] = '^0';
  42.  
  43. static team, ColorChange, index, MSG_Type;
  44.  
  45. if(id)
  46. {
  47. MSG_Type = MSG_ONE;
  48. index = id;
  49. } else {
  50. index = FindPlayer();
  51. MSG_Type = MSG_ALL;
  52. }
  53.  
  54. team = get_user_team(index);
  55. ColorChange = ColorSelection(index, MSG_Type, type);
  56.  
  57. ShowColorMessage(index, MSG_Type, message);
  58.  
  59. if(ColorChange)
  60. {
  61. Team_Info(index, MSG_Type, TeamName[team]);
  62. }
  63. }
  64.  
  65. ShowColorMessage(id, type, message[])
  66. {
  67. message_begin(type, get_user_msgid("SayText"), _, id);
  68. write_byte(id)
  69. write_string(message);
  70. message_end();
  71. }
  72.  
  73. Team_Info(id, type, team[])
  74. {
  75. message_begin(type, get_user_msgid("TeamInfo"), _, id);
  76. write_byte(id);
  77. write_string(team);
  78. message_end();
  79.  
  80. return 1;
  81. }
  82.  
  83. ColorSelection(index, type, Color:Type)
  84. {
  85. switch(Type)
  86. {
  87. case RED:
  88. {
  89. return Team_Info(index, type, TeamName[1]);
  90. }
  91. case BLUE:
  92. {
  93. return Team_Info(index, type, TeamName[2]);
  94. }
  95. case GREY:
  96. {
  97. return Team_Info(index, type, TeamName[0]);
  98. }
  99. }
  100.  
  101. return 0;
  102. }
  103.  
  104. FindPlayer()
  105. {
  106. static i;
  107. i = -1;
  108.  
  109. while(i <= get_maxplayers())
  110. {
  111. if(is_user_connected(++i))
  112. {
  113. return i;
  114. }
  115. }
  116.  
  117. return -1;
  118. }
  119.  
  120.  
  121. new const gName[] = "^x04[PING]^x01 ";
  122.  
  123. new HIGHPING_MAX = 100 // Bannolja X ping ut�n
  124. new HIGHPING_TIME = 3 // Bannol�si ellen�rz�sek id�k�z�t jelenti.
  125. new HIGHPING_TESTS = 2 // Bannol�s el�tt tesztek sz�ma
  126.  
  127. new iNumTests[33]
  128.  
  129. public plugin_init() {
  130. register_plugin("Ping ban","1.0"," wassair & insatiors")
  131. if (HIGHPING_TIME < 3) HIGHPING_TIME = 3
  132. if (HIGHPING_TESTS < 2) HIGHPING_TESTS = 2
  133. return PLUGIN_CONTINUE
  134. }
  135.  
  136. public client_disconnect(id) {
  137. remove_task(id)
  138. return PLUGIN_CONTINUE
  139. }
  140.  
  141. public client_putinserver(id) {
  142. iNumTests[id] = 0
  143. if (!is_user_bot(id)) {
  144. new param[1]
  145. param[0] = id
  146. set_task(30.0, "showWarn", id, param, 1)
  147. }
  148. return PLUGIN_CONTINUE
  149. }
  150.  
  151. kickPlayer(id) {
  152. new name[32]
  153. get_user_name(id, name, 31)
  154. new uID = get_user_userid(id)
  155. server_cmd("banid 1 #%d", uID)
  156. client_cmd(id, "echo ^"[PING] Magas ping miatt banolva 1 percre!^"; disconnect")
  157. ColorChat(0, GREEN, "%s^x03 %s^x01 banolva nagy ping miatt.", gName, name)
  158. return PLUGIN_CONTINUE
  159. }
  160.  
  161. public checkPing(param[]) {
  162. new id = param[0]
  163. if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION)) {
  164. remove_task(id)
  165. ColorChat(id, GREEN, "%s Nincs ping ellenorzes mert admin vagy!", gName)
  166. return PLUGIN_CONTINUE
  167. }
  168. new p, l
  169. get_user_ping(id, p, l)
  170. if (p > HIGHPING_MAX)
  171. ++iNumTests[id]
  172. else
  173. if (iNumTests[id] > 0) --iNumTests[id]
  174. if (iNumTests[id] > HIGHPING_TESTS)
  175. kickPlayer(id)
  176. return PLUGIN_CONTINUE
  177. }
  178.  
  179. public showWarn(param[]) {
  180. ColorChat(param[0], GREEN, "%s A pinged maximum ^x04 %d ^x01 lehet, ha nagyobb 1 perc ban!", gName, HIGHPING_MAX)
  181. set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
  182. return PLUGIN_CONTINUE
  183. }

Szerző:  FloxaY [ 2015.07.16. 12:40 ]
Hozzászólás témája:  Re: Kickre írás

155. sor
SMA Forráskód: [ Mindet kijelol ]
  1. server_cmd("kick #%d", uID)

Szerző:  SmaCk [ 2015.07.16. 13:05 ]
Hozzászólás témája:  Re: Kickre írás

FloxaY írta:
155. sor
SMA Forráskód: [ Mindet kijelol ]server_cmd("kick #%d", uID)


És még azt meglehetne csinálni, hogy ne időre kickelje, hanem simán egy kick.. Tehát az hülyeség, hogy 1percre kickeli..:D Csak simán egy kick kellene.
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. enum Color
  3. {
  4. NORMAL = 1, // clients scr_concolor cvar color
  5. GREEN, // Green Color
  6. TEAM_COLOR, // Red, grey, blue
  7. GREY, // grey
  8. RED, // Red
  9. BLUE, // Blue
  10. }
  11.  
  12. new TeamName[][] =
  13. {
  14. "",
  15. "TERRORIST",
  16. "CT",
  17. "SPECTATOR"
  18. }
  19.  
  20. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  21. {
  22. static message[256];
  23.  
  24. switch(type)
  25. {
  26. case NORMAL: // clients scr_concolor cvar color
  27. {
  28. message[0] = 0x01;
  29. }
  30. case GREEN: // Green
  31. {
  32. message[0] = 0x04;
  33. }
  34. default: // White, Red, Blue
  35. {
  36. message[0] = 0x03;
  37. }
  38. }
  39.  
  40. vformat(message[1], 251, msg, 4);
  41. message[192] = '^0';
  42.  
  43. static team, ColorChange, index, MSG_Type;
  44.  
  45. if(id)
  46. {
  47. MSG_Type = MSG_ONE;
  48. index = id;
  49. } else {
  50. index = FindPlayer();
  51. MSG_Type = MSG_ALL;
  52. }
  53.  
  54. team = get_user_team(index);
  55. ColorChange = ColorSelection(index, MSG_Type, type);
  56.  
  57. ShowColorMessage(index, MSG_Type, message);
  58.  
  59. if(ColorChange)
  60. {
  61. Team_Info(index, MSG_Type, TeamName[team]);
  62. }
  63. }
  64.  
  65. ShowColorMessage(id, type, message[])
  66. {
  67. message_begin(type, get_user_msgid("SayText"), _, id);
  68. write_byte(id)
  69. write_string(message);
  70. message_end();
  71. }
  72.  
  73. Team_Info(id, type, team[])
  74. {
  75. message_begin(type, get_user_msgid("TeamInfo"), _, id);
  76. write_byte(id);
  77. write_string(team);
  78. message_end();
  79.  
  80. return 1;
  81. }
  82.  
  83. ColorSelection(index, type, Color:Type)
  84. {
  85. switch(Type)
  86. {
  87. case RED:
  88. {
  89. return Team_Info(index, type, TeamName[1]);
  90. }
  91. case BLUE:
  92. {
  93. return Team_Info(index, type, TeamName[2]);
  94. }
  95. case GREY:
  96. {
  97. return Team_Info(index, type, TeamName[0]);
  98. }
  99. }
  100.  
  101. return 0;
  102. }
  103.  
  104. FindPlayer()
  105. {
  106. static i;
  107. i = -1;
  108.  
  109. while(i <= get_maxplayers())
  110. {
  111. if(is_user_connected(++i))
  112. {
  113. return i;
  114. }
  115. }
  116.  
  117. return -1;
  118. }
  119.  
  120.  
  121. new const gName[] = "^x04[PING]^x01 ";
  122.  
  123. new HIGHPING_MAX = 100 // Bannolja X ping ut n
  124. new HIGHPING_TIME = 3 // Bannol si ellen rz sek id k z t jelenti.
  125. new HIGHPING_TESTS = 2 // Bannol s el tt tesztek sz ma
  126.  
  127. new iNumTests[33]
  128.  
  129. public plugin_init() {
  130. register_plugin("Ping ban","1.0"," wassair & insatiors")
  131. if (HIGHPING_TIME < 3) HIGHPING_TIME = 3
  132. if (HIGHPING_TESTS < 2) HIGHPING_TESTS = 2
  133. return PLUGIN_CONTINUE
  134. }
  135.  
  136. public client_disconnect(id) {
  137. remove_task(id)
  138. return PLUGIN_CONTINUE
  139. }
  140.  
  141. public client_putinserver(id) {
  142. iNumTests[id] = 0
  143. if (!is_user_bot(id)) {
  144. new param[1]
  145. param[0] = id
  146. set_task(30.0, "showWarn", id, param, 1)
  147. }
  148. return PLUGIN_CONTINUE
  149. }
  150.  
  151. kickPlayer(id) {
  152. new name[32]
  153. get_user_name(id, name, 31)
  154. new uID = get_user_userid(id)
  155. server_cmd("kick #%d", uID)
  156. client_cmd(id, "echo ^"[PING] Magas ping miatt kickelve 1 percre!^"; disconnect")
  157. ColorChat(0, GREEN, "%s^x03 %s^x01 kickelve nagy ping miatt.", gName, name)
  158. return PLUGIN_CONTINUE
  159. }
  160.  
  161. public checkPing(param[]) {
  162. new id = param[0]
  163. if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION)) {
  164. remove_task(id)
  165. ColorChat(id, GREEN, "%s Nincs ping ellenőrzés, mert admin vagy!", gName)
  166. return PLUGIN_CONTINUE
  167. }
  168. new p, l
  169. get_user_ping(id, p, l)
  170. if (p > HIGHPING_MAX)
  171. ++iNumTests[id]
  172. else
  173. if (iNumTests[id] > 0) --iNumTests[id]
  174. if (iNumTests[id] > HIGHPING_TESTS)
  175. kickPlayer(id)
  176. return PLUGIN_CONTINUE
  177. }
  178.  
  179. public showWarn(param[]) {
  180. ColorChat(param[0], GREEN, "%s A pinged maximum ^x04 %d ^x01 lehet, ha nagyobb kickelve leszel!", gName, HIGHPING_MAX)
  181. set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
  182. return PLUGIN_CONTINUE
  183. }

Szerző:  Akosch:. [ 2015.07.16. 13:07 ]
Hozzászólás témája:  Re: Kickre írás

Azt csak kiírja neki, amúgy sima kicket kap.

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/