Hi guys. Sorry but both didn't work. I've installed WhBlocker properly. I know that for a fact since producing error-free logs. And I've tried some anti-wallhack plugins that I could find. The problem I think is the prone_position plugin makes your hull very small and as long as that part doesn't go thru the wall it doesn't count as a wallhack.
I tried studying TraceLine and came up with a test plugin. It works but I think it could be a lot better. So just a refresher, I'm trying to make the player keep a certain distance (50 units) away from walls. In the test plugin I fire a TraceLine that's 50 units long towards the direction they're going and when the line gets a hit any movement towards that object is halted. This is what I got:
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define TRACE_DIST 50.0 // Fixed distace of trace
#define TRACE_HEIGHT 25.0 // To avoid blocking movement when going up slopes
#define PUSH_DIST -0.1 // Strength of push when player goes near a wall
new beampoint;
new bool:g_push_enabled;
new Float:g_origin[33][3];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_PlayerPreThink,"FM_PreThink", false);
register_forward(FM_PlayerPreThink,"FM_PostThink", true);
register_concmd("debug", "Debug");
}
public plugin_precache()
{
beampoint = precache_model("sprites/laserbeam.spr")
}
// Toggle command to enable/disable plugin
public Debug(user)
{
if(!g_push_enabled)
g_push_enabled = true;
else
g_push_enabled = false;
}
public FM_PreThink(user)
{
if(!g_push_enabled)
return FMRES_IGNORED
pev(user, pev_origin, g_origin[user]);
return FMRES_HANDLED
}
public FM_PostThink(user)
{
if(!g_push_enabled)
return FMRES_IGNORED
static Float:origin2[3];
static Float:velocity[3];
static Float:velocity2[3];
static Float:fraction
static trace; trace = 0;
pev(user, pev_velocity, velocity);
origin2[0] = g_origin[user][0];
origin2[1] = g_origin[user][1];
origin2[2] = g_origin[user][2] + TRACE_HEIGHT;
velocity2[0] = velocity[0];
velocity2[1] = velocity[1];
velocity2[2] = velocity[2];
// This part I don't know what I'm doing.
// Supposedly I want to fire a TraceLine that's 50 units long
// directly towards the diretion the player is moving
if(velocity[0] != 0.0)
{
if(velocity[0] < 0.0) origin2[0] -= TRACE_DIST;
else origin2[0] += TRACE_DIST;
velocity2[0] = velocity[0] * PUSH_DIST;
}
if(velocity[1] != 0.0)
{
if(velocity[1] < 0.0) origin2[1] -= TRACE_DIST;
else origin2[1] += TRACE_DIST;
velocity2[1] = velocity[1] * PUSH_DIST;
}
engfunc(EngFunc_TraceLine, g_origin[user], origin2, IGNORE_MONSTERS, 0, trace);
get_tr2(trace, TR_flFraction, fraction)
// draw_laser(g_origin[user], origin2, 1); // Laser effect to visually see the trace
if(fraction < 1.0)
{
// set_pev(user, pev_maxspeed, 1.0); // Sets player speed
// engfunc(EngFunc_SetOrigin, user, g_origin[user]); // Teleports player back to old origin
set_pev(user, pev_velocity, velocity2); // Pushes player back opposite the direction they're going
// Cheap way of blocking movement
client_cmd(user, "-forward");
client_cmd(user, "-back");
client_cmd(user, "-left");
client_cmd(user, "-right");
}
return FMRES_HANDLED
}
public draw_laser(Float:start[3], Float:end[3], staytime)
{
message_begin(MSG_ALL, SVC_TEMPENTITY)
write_byte(TE_BEAMPOINTS)
engfunc(EngFunc_WriteCoord, start[0])
engfunc(EngFunc_WriteCoord, start[1])
engfunc(EngFunc_WriteCoord, start[2])
engfunc(EngFunc_WriteCoord, end[0])
engfunc(EngFunc_WriteCoord, end[1])
engfunc(EngFunc_WriteCoord, end[2])
write_short(beampoint)
write_byte(0)
write_byte(0)
write_byte(staytime) // In tenths of a second.
write_byte(10)
write_byte(1)
write_byte(0) // Red
write_byte(255) // Green
write_byte(0) // Blue
write_byte(127)
write_byte(1)
message_end()
}
It works but there are issues I'm having with this:
1. The trace is not directly towards where the player is moving.
2. My method of blocking movement is kinda cheap. Also counter-intuitive since you have to re-press the movement keys to get them to work again. The other two I tried (teleporting and setting player speed) doesn't block movement completely. The player can still slowly get near the wall...
__________________