Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.86 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4.  
  5. new Float:g_lastcheck[33], Float:g_lastcheck2[33]
  6. new Float:g_cur_origin[33][3]
  7. new Float:g_vic_origin[33][3]
  8.  
  9. new antihack_active
  10. new cvar_antispeed, cvar_antispeed_code, cvar_ban_minutes
  11.  
  12. public plugin_init()
  13. {
  14.     register_plugin("AntiHack Speed", "1.0", "Dias")
  15.    
  16.     register_event("HLTV", "event_newround", "a", "1=0", "2=0")
  17.     register_logevent("event_round_end", 2, "1=Round_End")
  18.     register_event("TextMsg","event_round_end","a","2=#Game_Commencing","2=#Game_will_restart_in")
  19.    
  20.     cvar_antispeed = register_cvar("sv_antihack_speed", "1")
  21.     cvar_antispeed_code = register_cvar("sv_antihack_speed_code", "250.0")
  22.     cvar_ban_minutes = register_cvar("sv_antihack_ban_minutes", "10")
  23. }
  24.  
  25. public plugin_cfg()
  26. {
  27.     set_task(1.0, "event_newround")
  28. }
  29.  
  30. public event_newround(id)
  31. {
  32.     set_task(1.0, "active_antihack", id)
  33. }
  34.  
  35. public event_round_end(id)
  36. {
  37.     antihack_active = 0
  38. }
  39.  
  40. public active_antihack(id)
  41. {
  42.     antihack_active = 1
  43.     g_vic_origin[id] = g_cur_origin[id]
  44. }
  45.  
  46. public client_PostThink(id)
  47. {
  48.     if(is_user_alive(id) && antihack_active && get_pcvar_num(cvar_antispeed))
  49.     {
  50.         static Float:Current_Time
  51.         Current_Time = get_gametime()
  52.        
  53.         if(Current_Time - 0.5 > g_lastcheck[id])
  54.         {
  55.             pev(id, pev_origin, g_cur_origin[id])
  56.             g_lastcheck[id] = Current_Time
  57.         }
  58.        
  59.         if(Current_Time - 1.0 > g_lastcheck2[id])
  60.         {
  61.             check_origin(id)
  62.             g_lastcheck2[id] = Current_Time
  63.         }  
  64.     }
  65. }
  66.  
  67. public check_origin(id)
  68. {
  69.     static Float:distance
  70.    
  71.     pev(id, pev_origin, g_vic_origin[id])
  72.     distance = get_distance_f(g_cur_origin[id], g_vic_origin[id])
  73.  
  74.     if(distance > get_pcvar_float(cvar_antispeed_code) && pev(id, pev_flags) & FL_ONGROUND)
  75.     {
  76.         static name[32]
  77.         get_user_name(id, name, sizeof(name))
  78.        
  79.         server_cmd("amx_banip %s %s Hack_Speed_Detect", get_pcvar_num(cvar_ban_minutes), name)
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement