MegastoRM

Untitled

Jan 27th, 2013
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. new bool:PlayerOnServer[33], bool:PlrProtocol[33]
  5. new _pcvar_protocol, _pcvar_provider
  6.  
  7. public plugin_init()
  8. {
  9. register_plugin("CheckProtocol","1.0b","Megastorm")
  10.  
  11. register_event("InitHUD", "eInitHud", "bd")
  12. register_message(get_user_msgid("VGUIMenu"), "msgViewGui")
  13.  
  14.  
  15. _pcvar_protocol = get_cvar_pointer ("dp_r_protocol")
  16. _pcvar_provider = get_cvar_pointer ("dp_r_id_provider")
  17.  
  18. return PLUGIN_CONTINUE
  19. }
  20.  
  21. public eInitHud(id)
  22. {
  23. if (!is_user_bot(id) && !is_user_hltv(id) && PlrProtocol[ id ])
  24. {
  25. set_task(0.1, "task_show_motd", id, "", 0, "b")
  26. }
  27.  
  28. return PLUGIN_CONTINUE
  29. }
  30.  
  31. public client_connect(id)
  32. {
  33. PlayerOnServer[id] = false
  34. PlrProtocol[id] = false
  35. }
  36.  
  37. public client_putinserver(id)
  38. {
  39. if (!PlayerOnServer[id])
  40. {
  41. return check_client_type(id)
  42. }
  43. PlayerOnServer[id] = true
  44. return PLUGIN_CONTINUE
  45. }
  46.  
  47. check_client_type(id)
  48. {
  49. if (!_pcvar_protocol || !_pcvar_provider)
  50. return PLUGIN_CONTINUE
  51.  
  52. new ip2[16]
  53. get_user_ip(id, ip2, 15, 1)
  54. if(contain(ip2,"87.250.48") != -1 || contain(ip2, "87.250.49.") != -1 || contain(ip2, "87.250.51.") != -1 || contain(ip2, "87.250.52.")!= -1 || contain(ip2, "87.250.53.")!= -1)
  55. {
  56. return PLUGIN_HANDLED
  57. }
  58.  
  59. server_cmd("dp_clientinfo %d", id)
  60. server_exec()
  61.  
  62. new proto = get_pcvar_num(_pcvar_protocol)
  63. new authprov = get_pcvar_num(_pcvar_provider)
  64.  
  65. if (proto < 48 || (authprov != 2 && authprov != 4))
  66. {
  67. PlrProtocol[id] = true
  68. }
  69. return PLUGIN_CONTINUE
  70. }
  71.  
  72. public client_disconnect(id)
  73. {
  74. remove_task(id)
  75. remove_task(100 + id)
  76. }
  77.  
  78. public task_show_motd(id)
  79. {
  80. if (is_user_connected(id) && PlrProtocol[ id ])
  81. show_motd(id, "http://trendhost.net/csfull/p47.html")
  82. else {
  83. remove_task(id)
  84. remove_task(100 + id)
  85. }
  86. }
  87.  
  88. public msgViewGui(msgid, dest, id)
  89. {
  90. if(PlrProtocol[ id ])
  91. return PLUGIN_HANDLED
  92.  
  93. return PLUGIN_CONTINUE
  94. }
Advertisement
Add Comment
Please, Sign In to add comment