AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   what makes WH see it? (https://forums.alliedmods.net/showthread.php?t=249304)

Jhob94 10-03-2014 21:34

what makes WH see it?
 
Lucia by joaquimandrade:
PHP Code:

#include <amxmodx>
#include <amxmisc>

#include <cstrike>

#include <engine>
#include <fakemeta>
#include <hamsandwich>

#include <xs>

new ModelWeapon[] = "models/p_glock18.mdl"
new ModelWeaponID

new Models[CsTeams][] =
{
    
"",
    
"models/player/leet/leet.mdl",
    
"models/player/sas/sas.mdl",
    
""
}

new 
ModelsIDs[CsTeams]

new const 
Plugin[] = "Lucia Hallucination"
new const Author[] = "joaquimandrade"
new const Version[]    = "1.0"

enum EntityData
{
    
Origin[3],
    
Angles[3],
    
CsTeams:Team
}

const 
MaxSlots 32

new bool:OnFirstPersonView[MaxSlots+1]
new 
SpectatingUser[MaxSlots+1]

new 
UserNeedsEntity[MaxSlots+1]
new 
UserEntityData[MaxSlots+1][EntityData]
new 
HasPermissions[MaxSlots+1]

new 
Float:LastTimeViewedAnEntity[MaxSlots+1]

const 
PermissionFlag ADMIN_BAN

new CheckVisibilityForward

new CurrentHost 
new CurrentEnt

new Float:VectorNormalHideStartFactor 46.0
new Float:VectorNormalHideEndFactor 40.0

new Float:VectorNormalHideStep 1.0

new const Float:PlayerRay 22.0
new const Float:HullFactor 0.5

const Float:PlayerHideMaxDistance 1200.0

new CsTeams:Teams CS_TEAM_T CS_TEAM_CT

new OnFirstPersonViewN

new ForwardAddToFullPackPre
new ForwardAddToFullPackPost

new ForwardCmdStart

public plugin_precache()
{
    
ModelWeaponID precache_model(ModelWeapon)
    
    
ModelsIDs[CS_TEAM_T] = precache_model(Models[CS_TEAM_T])
    
ModelsIDs[CS_TEAM_CT] = precache_model(Models[CS_TEAM_CT])
}
public 
plugin_init()
{
    
register_plugin(Plugin,Version,Author)

    
register_event("TextMsg","specMode","b","2&#Spec_Mode")
    
register_event("StatusValue","specTarget","bd","1=2")
    
register_event("SpecHealth2","specTarget","bd")
    
    
RegisterHam(Ham_Spawn,"player","playerSpawn",1)
    
    
register_cvar("luciaHallucination",Version,FCVAR_SERVER|FCVAR_SPONLY);
    
    
register_clcmd("luciaToggle","luciaToggle",PermissionFlag)
}

public 
luciaToggle(id,level,cid
{
    if(
cmd_access(id,level,cid,0))
    {
        
toggle(id)
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
checkVisibility(id,pset)
{    
    if(
CurrentEnt == id)
    {
        
unregister_forward(FM_CheckVisibility,CheckVisibilityForward)
        
CheckVisibilityForward 0
        
        forward_return
(FMV_CELL,1)
        return 
FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED
}

public 
addToFullPackPre(eseenthosthostflagsplayerpSet)
{
    if(
player && (host != ent) && is_user_alive(ent))
    {
        if((
LastTimeViewedAnEntity[host] != get_gametime()) && (((UserNeedsEntity[host]) && (cs_get_user_team(host) != cs_get_user_team(ent))) || (OnFirstPersonView[host] && UserNeedsEntity[SpectatingUser[host]] && (cs_get_user_team(SpectatingUser[host]) != cs_get_user_team(ent)))))
        {
            if(!
engfunc(EngFunc_CheckVisibility,ent,pSet))
            {
                
CurrentEnt ent
                CurrentHost 
host
                
                
if(!CheckVisibilityForward)
                {
                    
CheckVisibilityForward register_forward(FM_CheckVisibility,"checkVisibility")
                }
            }
        }
    }
}

public 
addToFullPackPost(eseenthosthostflagsplayerpSet)
{    
    if((
host == CurrentHost) && (ent == CurrentEnt))
    {        
        
LastTimeViewedAnEntity[CurrentHost] = get_gametime()
        
        new 
CsTeams:team
        
        
if(OnFirstPersonView[host])
        {
            new 
spectated SpectatingUser[host]
            
            
team UserEntityData[spectated][Team]
            
            static 
Float:origin[3]
            
pev(spectated,pev_origin,origin)
            
            
engfunc(EngFunc_TraceLine,origin,Float:UserEntityData[spectated][Origin],0,spectated,0)
            
            
get_tr2(0,TR_EndPos,origin)
            
            
set_es(es,ES_Origin,origin)
            
set_es(es,ES_Angles,Float:UserEntityData[spectated][Angles])    
            
            
set_es(es,ES_RenderMode,kRenderTransAlpha)
            
set_es(es,ES_RenderAmt,170)
        
        }
        else
        {
            
team UserEntityData[host][Team]
            
            
set_es(es,ES_Origin,Float:UserEntityData[host][Origin])
            
set_es(es,ES_Angles,Float:UserEntityData[host][Angles])    
        }
        
        new 
CsTeams:enemyTeam Teams team
        
        
        set_es
(es,ES_Team,_:enemyTeam)
        
set_es(es,ES_ModelIndex,ModelsIDs[enemyTeam])
        
set_es(es,ES_WeaponModel,ModelWeaponID)
        
set_es(es,ES_Effects,EF_INVLIGHT)    
    }
    
    
CurrentHost CurrentEnt 0
}

hullCheck(Float:origin[3])
{    
    static 
Float:margin[3]
    
    
xs_vec_copy(origin,margin)
    
    for(new 
i=0;i<3;i++)
        
margin[i] += HullFactor
    
    engfunc
(EngFunc_TraceHull,origin,margin,1,HULL_POINT,0,0)
    return 
get_tr2(0,TR_AllSolid)
    
}

bool:isSafeHideOrigin(Float:origin[3])
{
    static 
Float:centerPointsZDistanceMultiply[] = {1.2,0.5,0.0,-0.5,-1.0,-1.5}
    static 
Float:centerPoints[sizeof centerPointsZDistanceMultiply][3]
    
    for(new 
i=0;i<sizeof centerPointsZDistanceMultiply;i++)
    {
        
xs_vec_copy(origin,centerPoints[i])
        
centerPoints[i][2] += centerPointsZDistanceMultiply[i] * (PlayerRay)
        
        if(!
hullCheck(centerPoints[i]))
        {
            return 
false
        
}
        
        static 
Float:borderPointsXYDistanceMultiply[4][2] = {{0.0,1.2},{1.2,0.0},{0.0,-1.2},{-1.2,0.0}}
        
        for(new 
j=0;j<4;j++)
        {
            static 
Float:borderPoint[3]
            
xs_vec_copy(centerPoints[i],borderPoint)
            
            for(new 
k=0;k<2;k++)
            {
                
borderPoint[k] += borderPointsXYDistanceMultiply[j][k] * (PlayerRay)
            }
            
            if(!
hullCheck(borderPoint))
            {
                return 
false
            
}
        }
    }
    
    return 
true
}

getEntityData(id)
{
    static 
Float:origin[3],Float:viewAngles[3],Float:viewOfs[3]
    
    
pev(id,pev_origin,origin)
    
pev(id,pev_view_ofs,viewOfs)
    
    
xs_vec_add(origin,viewOfs,origin)
    
    
pev(id,pev_v_angle,viewAngles)
    
    static 
Float:path[3]
    
    
angle_vector(viewAngles,ANGLEVECTOR_FORWARD,path)
    
xs_vec_normalize(path,path)
    
    
xs_vec_mul_scalar(path,PlayerHideMaxDistance,path)
    
    static 
Float:end[3]
    
    
xs_vec_add(origin,path,end)
    
    
engfunc(EngFunc_TraceLine,origin,end,0,id,0);
    
    static 
Float:fraction
    get_tr2
(0,TR_flFraction,fraction)
    
    if((
fraction != 1.0) && (get_tr2(0,TR_Hit) == -1))
    {
        
get_tr2(0,TR_EndPos,end)
        
        static 
Float:normal[3]
        
get_tr2(0,TR_vecPlaneNormal,normal)
        
        static 
Float:normalPath[3]
        
        for(new 
Float:i=VectorNormalHideStartFactor;i>=VectorNormalHideEndFactor;i-=VectorNormalHideStep)
        {
            
xs_vec_mul_scalar(normal,-i,normalPath)
            
xs_vec_add(end,normalPath,normalPath)
            
            if(
isSafeHideOrigin(normalPath))
            {
                static 
Float:angles[3]
                
                
vector_to_angle(normal,angles)
            
                if(
angles[0] > 0.0)
                    
angles[0] = 0.0
                
                xs_vec_copy
(angles,Float:UserEntityData[id][Angles])
                
xs_vec_copy(normalPath,Float:UserEntityData[id][Origin])
                
                
UserEntityData[id][Team] = _:cs_get_user_team(id)
                
                return 
true
            
}
        }
    }
    
    return 
false
}

toggle(id)
{
    if(
OnFirstPersonView[id])
    {        
        if(
UserNeedsEntity[SpectatingUser[id]])
        {
            
client_print(id,print_chat,"[Lucia Hallucination] Stopped")
            
            
UserNeedsEntity[SpectatingUser[id]] = false
        
}
        else
        {
            if(
getEntityData(SpectatingUser[id]))
            {
                
client_print(id,print_chat,"[Lucia Hallucination] Started")
                
                
UserNeedsEntity[SpectatingUser[id]] = true
            
}
            else
            {
                
client_print(id,print_chat,"[Lucia Hallucination] Failed to find an available spot")
            }
        }
    }
}

public 
cmdStart(id)
{
    if((
get_user_button(id) & IN_RELOAD) && (~get_user_oldbutton(id) & IN_RELOAD))
        
toggle(id)
}

handleJoiningFirstPersonView(id)
{    
    
OnFirstPersonView[id] = true
    
    
if(!OnFirstPersonViewN++)
    {
        
ForwardAddToFullPackPre register_forward(FM_AddToFullPack,"addToFullPackPre",0);
        
ForwardAddToFullPackPost register_forward(FM_AddToFullPack,"addToFullPackPost",1)
        
ForwardCmdStart register_forward(FM_CmdStart,"cmdStart")
    }
}

handleQuitingFirstPersonView(id)
{
    
OnFirstPersonView[id] = false
    UserNeedsEntity
[SpectatingUser[id]] = false
    SpectatingUser
[id] = 0
    
    
if(!--OnFirstPersonViewN)
    {
        
unregister_forward(FM_AddToFullPack,ForwardAddToFullPackPre)
        
unregister_forward(FM_AddToFullPack,ForwardAddToFullPackPost,1)
        
unregister_forward(FM_CmdStart,ForwardCmdStart)
    }
}

public 
playerSpawn(id)
{
    if(
OnFirstPersonView[id] && is_user_alive(id))
    {
        
handleQuitingFirstPersonView(id)
    }
}

public 
client_authorized(id)
{
    
HasPermissions[id] = get_user_flags(id) & PermissionFlag
}

public 
client_disconnect(id)
{
    if(
OnFirstPersonView[id])
    {
        
handleQuitingFirstPersonView(id)
    }
}

public 
specMode(id)
{
    if(
HasPermissions[id])
    {
        new 
specMode[12]
        
read_data(2,specMode,11)
            
        if(
specMode[10] == '4')
        {
            
handleJoiningFirstPersonView(id)
        }
        else if(
OnFirstPersonView[id])
        {
            
handleQuitingFirstPersonView(id)
        }
    }
}

public 
specTarget(id)
{
    new 
spectated read_data(2);
        
    if(
spectated)
    {
        if(
OnFirstPersonView[id])
        {
            if(
spectated != SpectatingUser[id])
            {
                
handleQuitingFirstPersonView(id)
                
SpectatingUser[id] = spectated;                
                
handleJoiningFirstPersonView(id)
            }
        }
        else
        {
            
SpectatingUser[id] = spectated;
        }
    }


I am trying to understand what is making it be visible to cheaters and invisible to who doesnt cheats.
That anti cheat is too old and bit famous, people already know it so iam trying to develop a new one, but changing alpha is only good for who use ESP/aimbot, WH wont be caught :3

hornet 10-03-2014 23:20

Re: what makes WH see it?
 
I'm not quite sure of your question, your English could use some improvement.
If your asking about wallhack, the only thing you can really do is not send the player origin update to a client if they cannot physically see the next player.

fysiks 10-04-2014 04:50

Re: what makes WH see it?
 
You don't need to repost code that already exists on the forums, a link will do. Or better yet, you could ask in the plugin's thread.

Anyways, the key to the magic is the addtofullpack functionality. As far as I remember from my discussions with Joaquim, it basically creates a player only for the person that is suspected of hacking. The data of the player is only available to the hacker's computer and hence why I dubbed it a hallucination (yes, I contributed the second half of the plugin name :)).

Jhob94 10-04-2014 08:15

Re: what makes WH see it?
 
I checked addtofullpack, i tried using transalpha and it works for ESP/Aimbot, but not WH. I thought maybe it was
this: set_es(es,ES_Effects,EF_INVLIGHT), but players could still seing me xD

My idea is to make the admin that uses the command become invisible, but only invisible to who isn't running any cheat. Maybe it is not possible? I am not sure.

aron9forever 10-04-2014 09:28

Re: what makes WH see it?
 
well i know for sure that alpha players are invisible to wallhackers
that's because I run a furien server, so only ESP or footstep or whatever hackers will know about them

I also use lucia and afaik the player is fully visible but inside walls or floors so normal players just can't see them(but can hear them)

Baws 10-04-2014 09:39

Re: what makes WH see it?
 
There's plenty of wallhacks out there. If you go to youtube you will see all sort of wallhacks. And as I understood, there's a wallhack where the walls becomes transparent. Maybe make them non transparent?

klippy 10-04-2014 09:41

Re: what makes WH see it?
 
Long time ago, I inspected Lucia's code a little bit, and my conclusion is:
Because you can't create a new real player, the plugin looks for a player that you currently do not see, and (using AddToFullPack magic) sets him into a wall for a player you are spectating, and also for you, so you know what you are doing. Wallhack program still thinks its a real player there, so it will render him through the walls.
So, it fails if - there is not enough space for a player to get into a wall in front of a suspected player, or, there is no alive players which the suspected player doesn't see in a given moment.

Jhob94 10-04-2014 10:24

Re: what makes WH see it?
 
Quote:

Originally Posted by Baws (Post 2206945)
There's plenty of wallhacks out there. If you go to youtube you will see all sort of wallhacks. And as I understood, there's a wallhack where the walls becomes transparent. Maybe make them non transparent?

That's not what i need. There is something like that already but doesn't works 100%


Quote:

Originally Posted by KliPPy (Post 2206947)
Long time ago, I inspected Lucia's code a little bit, and my conclusion is:
Because you can't create a new real player, the plugin looks for a player that you currently do not see, and (using AddToFullPack magic) sets him into a wall for a player you are spectating, and also for you, so you know what you are doing. Wallhack program still thinks its a real player there, so it will render him through the walls.
So, it fails if - there is not enough space for a player to get into a wall in front of a suspected player, or, there is no alive players which the suspected player doesn't see in a given moment.

That's not what i am asking.

klippy 10-04-2014 17:08

Re: what makes WH see it?
 
Quote:

Originally Posted by Jhob94 (Post 2206973)
That's not what i need. There is something like that already but doesn't works 100%




That's not what i am asking.

Can you please explain more precisely what you really need?

aron9forever 10-04-2014 17:31

Re: what makes WH see it?
 
Quote:

Originally Posted by KliPPy (Post 2207128)
Can you please explain more precisely what you really need?

he wants an admin cmd that would make an admin invisible to normal players and visible to hackers
long story short that's pretty impossible for most of wallhacks


All times are GMT -4. The time now is 17:36.

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