Raised This Month: $51 Target: $400
 12% 

Solved [CS:GO] how i can check if bullet was through the wall


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ayyyyyyylmao
Junior Member
Join Date: Apr 2018
Old 08-21-2018 , 02:47   [CS:GO] how i can check if bullet was through the wall
Reply With Quote #1

all in title, i want return true, if bullet through the wall

Last edited by ayyyyyyylmao; 08-22-2018 at 09:37.
ayyyyyyylmao is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-21-2018 , 03:22   Re: [CS:GO] how i can check if bullet was through the wall
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=1841890

maybe this will help?

or

https://wiki.alliedmods.net/Counter-...s#player_death

and check penetrated
__________________
8guawong is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-21-2018 , 06:33   Re: [CS:GO] how i can check if bullet was through the wall
Reply With Quote #3

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_Hurt);
}

public 
Action Event_Hurt(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iVictim GetClientOfUserId(hEvent.GetInt("userid"));
    
    if (
iVictim <= MaxClients && IsClientInGame(iVictim))
    {
        
int iAttacker GetClientOfUserId(hEvent.GetInt("attacker"));
        
        if (
iVictim <= MaxClients && IsClientInGame(iAttacker))
        {
            if (
iVictim != iAttacker)
            {
                
float iAPos[3], iVPos[3];
                
                
GetClientEyePosition(iAttackeriAPos);
                
GetClientEyePosition(iVictimiVPos);
                
                
Handle hTrace TR_TraceRayFilterEx(iAPosiVPosMASK_SOLIDRayType_EndPointTR_EntityFilteriVictim);
                
                if (
TR_DidHit(hTrace))
                {
                    
/* Do something */
                
}
                
                
CloseHandle(hTrace);
            }
        }
    }
}

public 
bool TR_EntityFilter(int iEntityint iContentsMaskany iData)
{
    return 
false;


Last edited by mug1wara; 08-23-2018 at 08:06.
mug1wara is offline
ayyyyyyylmao
Junior Member
Join Date: Apr 2018
Old 08-22-2018 , 09:53   Re: [CS:GO] how i can check if bullet was through the wall
Reply With Quote #4

Quote:
Originally Posted by mug1wara View Post
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_Hurt);
}

public 
Action Event_Hurt(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iVictim GetClientOfUserId(hEvent.GetInt("userid"));
    
    if (
iVictim <= MaxClients && IsClientInGame(iVictim))
    {
        
int iAttacker GetClientOfUserId(hEvent.GetInt("userid"));
        
        if (
iVictim <= MaxClients && IsClientInGame(iAttacker))
        {
            if (
iVictim != iAttacker)
            {
                
float iAPos[3], iVPos[3];
                
                
GetClientEyePosition(iAttackeriAPos);
                
GetClientEyePosition(iVictimiVPos);
                
                
Handle hTrace TR_TraceRayFilterEx(iAPosiVPosMASK_SOLIDRayType_EndPointTR_EntityFilteriVictim);
                
                if (
TR_DidHit(hTrace))
                {
                    
/* Do something */
                
}
                
                
CloseHandle(hTrace);
            }
        }
    }
}

public 
bool TR_EntityFilter(int iEntityint iContentsMaskany iData)
{
    return 
false;

csgo doesnt have player_hurt event, no?
ayyyyyyylmao is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-22-2018 , 10:17   Re: [CS:GO] how i can check if bullet was through the wall
Reply With Quote #5

Quote:
Originally Posted by ayyyyyyylmao View Post
csgo doesnt have player_hurt event, no?
player_hurt is a generic event according to the wiki

https://wiki.alliedmods.net/Generic_Source_Events
__________________
8guawong is offline
stephen473
Senior Member
Join Date: Jan 2017
Location: somewhere on earth
Old 08-22-2018 , 12:08   Re: [CS:GO] how i can check if bullet was through the wall
Reply With Quote #6

Quote:
Originally Posted by mug1wara View Post
PHP Code:
int iVictim GetClientOfUserId(hEvent.GetInt("userid"));
int iAttacker GetClientOfUserId(hEvent.GetInt("userid"));


i guess it won't work, because you get client for two times.
__________________
Also known as Hardy`.

Feel free to contact me if you have a private plugin request!

My Steam Profile | Discord: Hardy`#3792
stephen473 is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-23-2018 , 08:06   Re: [CS:GO] how i can check if bullet was through the wall
Reply With Quote #7

woops, meant to be attacker
mug1wara 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 03:13.


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