AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Wallhack Detector (https://forums.alliedmods.net/showthread.php?t=82099)

endeffects 12-17-2008 06:26

Wallhack Detector
 
i've released my first version of this plugin:
http://forums.alliedmods.net/showthread.php?p=728767

_____________________________________________ __
old posting:

Hallo,

i'm working on a simple wallhack detector.
the plugin watches each player every round for wallkills,
if a player reaches a specific number of wallkills per round
we make a log entry.

i'm not really good in amxx scripting so i have used some
code of Alka, SAMURAI and Bugsy, so all credits going out to them.
however, theoreticly everything should work :D
but it seems like that there are a few bugs.

in example the logfile don't contains the correct player information.
can somebody please have a look into it?


Code:

#include <amxmodx>
#include <fakemeta_util>
 
#define PLUGIN "Wallhack Detector"
#define VERSION "0.1"
#define AUTHOR ""
#define CharsMax(%1) sizeof %1 - 1
#define WALLHACK_MAX_DETECTS 3
new WallKills[33]
public plugin_init()
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_event("DeathMsg", "EventDeathMsg", "a")
}
public EventDeathMsg()
{
 static Killer, Victim, Weapon[32]
 read_data(4, Weapon, CharsMax(Weapon))
 
 if(equali(Weapon, "grenade"))
  return 1
 
 Killer = read_data(1)
 Victim = read_data(2)
 
 static bool:IsVisible;
 IsVisible = fm_is_ent_visible(Killer, Victim, 1)
 
 if(!IsVisible)
  WallKills[Killer]++;
 
 if(WallKills[Killer] >= WALLHACK_MAX_DETECTS)
 {
  WallKills[Killer] = 0
 
  new szName[33]
  new szAuthID[35]
  new szIP[22]
  new szMap[21]
  new szLog[143]
  //new userid = get_user_userid(Killer)
 
  get_user_name( Killer , szName , 32)
  get_user_authid( Killer , szAuthID, 34)
  get_user_ip( Killer , szIP , 21 )
  copy( szIP , strfind(szIP , ":") , szIP)
  get_mapname( szMap , 20)
 
  format(szLog, 142, "A wallhack was detected on %s [%s] [%s] [%s]" , szName , szAuthID , szIP  , szMap )
 
  server_print( "[Wallhack Detector] %s" , szLog )
  LogDetection(szLog)
 
 }
 
 return 0;
}
public LogDetection( szLog[] )
{
 new szData[175]
 new szLogFile[64]
 new iHour, iMinute, iSecond
 new iYear, iMonth, iDay
 
 time(iHour, iMinute, iSecond )
 date( iYear, iMonth, iDay )
 iYear-=2000
 format( szData , 174, "[%02d/%02d/%02d] [%02d:%02d:%02d] %s" , iMonth, iDay , iYear , iHour, iMinute, iSecond, szLog)
 
 get_localinfo( "amxx_logs" , szLogFile , 63 )
 format( szLogFile , 63 , "%s/wallhackdetections.log" , szLogFile )
 
 write_file(szLogFile ,szData ,-1)
}
public  client_death ()
{
 static Victim
 Victim = read_data(2)
 
 WallKills[Victim] = 0
}
public client_disconnect(id)
{
 WallKills[id] = 0
}
public client_authorized(id)
{
 WallKills[id] = 0
}



All times are GMT -4. The time now is 09:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.