Raised This Month: $ Target: $400
 0% 

[CSS] Problem with sdkhook: TR_TraceRayFilterEx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mirandor
Senior Member
Join Date: Jun 2006
Location: Ile de France
Old 05-17-2014 , 17:40   [CSS] Problem with sdkhook: TR_TraceRayFilterEx
Reply With Quote #1

hi,

I want to prevent players from shooting through walls .
I tried to use first the bullet penetration filter, from Sheepdude (which is also bugged to me)

Actually it works as it should : it blocks bullets to walls BUT often when i try to shoot a player into his head by using a scout (zoomed) without any entity between us, hitgroup return 0, instead of 1...
When i try to cut a player, it returns... nothing!
Obviously in both cases, the player takes zero damage.

I search for a long time, i tried a lot of different things, it's always the same result...

So what's wrong?

Here is the code
PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weaponFloat:damageForce[3], Float:damagePosition[3])
{
    if(!
IsValidClient(attacker) || !IsValidClient(victim))
        return 
Plugin_Continue;
    
    if(
attacker == victim)
        return 
Plugin_Continue;
    
    if(
victim_hitgroups[victim] == 0)
    {
        
damage 0.0;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;
}

public 
Action:OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotypehitboxhitgroup)
{
    if(!
IsValidClient(attacker) || !IsValidClient(victim))
        return 
Plugin_Continue;
    
    if(
attacker == victim)
        return 
Plugin_Continue;
    
    new 
Float:vAngles[3], Float:vOrigin[3];
    
GetClientEyePosition(attacker,vOrigin);
    
GetClientEyeAngles(attackervAngles);
    
    new 
Handle:trace TR_TraceRayFilterEx(vOriginvAnglesMASK_SHOTRayType_InfiniteTraceEntityFilterPlayerattacker);
    new 
index TR_GetEntityIndextrace );
    
victim_hitgroups[index] = 0;
    if(
IsValidClient(index))
    {
        
victim_hitgroups[index] = hitgroup;
        
PrintToChat(attacker"Target: %N | Hitgroup: %d"indexvictim_hitgroups[index]);
    }
    
    return 
Plugin_Continue;
}

public 
bool:TraceEntityFilterPlayer(entitycontentsMaskany:data)
{
    if(
entity <= MaxClients && entity != data)
        return 
true;
        
    return 
false;
}

stock bool:IsValidClient(client)

    if (
client <= MaxClients && IsClientInGame(client))
        return 
true
    
    return 
false


Last edited by Mirandor; 05-17-2014 at 17:45.
Mirandor is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:07.


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