Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define KICK_MSG "your kick message"
  5.  
  6. public plugin_init()
  7. {
  8.     register_plugin(PLUGIN, VERSION, AUTHOR)
  9.     register_cvar("amx_only_steam", "1")
  10. }
  11. public client_putinserver(id)
  12. {
  13.     if (get_cvar_num("amx_only_steam") == 1)
  14.         return PLUGIN_HANDLER
  15.  
  16.     if (is_user_bot(id) && is_user_hltv(id))
  17.         return PLUGIN_HANDLED
  18.  
  19.     if (get_user_flags(id) & ADMIN_IMMUNITY)
  20.         return PLUGIN_HANDLED
  21.  
  22.     if (get_cvar_num("amx_only_steam") == 1)
  23.     {
  24.         new ui[32]
  25.         new uname[32]
  26.         get_user_ip(id, uip, 31, 1)
  27.         get_user_name(id, uname, 31)
  28.  
  29.         if (!isSteam(id))
  30.         {
  31.             log_amx("User ^"%s^" ^"%s^" kicked due to invalid IP address", uname, uip)
  32.             server_cmd("kick #%d ^"%s^"", get_user_userid(id), KICK_MSG)
  33.         }
  34.     }
  35.  
  36.     return PLUGIN_CONTINUE
  37. }
  38. bool:isSteam(id)
  39. {
  40.     new bool:result = false
  41.     new pcv_dp_r_protocol = get_cvar_pointer ("dp_r_protocol")
  42.     new pcv_dp_r_id_provider = get_cvar_pointer ("dp_r_id_provider")
  43.     if (pcv_dp_r_protocol && pcv_dp_r_id_provider)
  44.     {
  45.         server_cmd("dp_clientinfo %d", id)
  46.         server_exec()
  47.         new authprov = get_pcvar_num(pcv_dp_r_id_provider)
  48.  
  49.         if (authprov == 2) result = true
  50.     }
  51.  
  52.     return result
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement