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

Detect if A Player is aiming on a wall


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ynet
Member
Join Date: Aug 2017
Location: israel
Old 05-16-2019 , 09:07   Detect if A Player is aiming on a wall
Reply With Quote #1

as the title says my question is if there is a way to detect if a player is aiming on a wall

i thought about using get_user_aiming or get_user_origin 3 but i am not so sure about those

Last edited by Ynet; 05-16-2019 at 09:08.
Ynet is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 05-16-2019 , 09:29   Re: Detect if A Player is aiming on a wall
Reply With Quote #2

probably traceline of player's aiming and check if its brush or something similar...but why you need it? if im not mistaken then it should be handled by prethink which is not good for the server
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
thEsp
BANNED
Join Date: Aug 2017
Old 05-16-2019 , 12:55   Re: Detect if A Player is aiming on a wall
Reply With Quote #3

This could possibly help you, execute it on touch or client pre/post-think.
PHP Code:
bool:isSolid(iEnt)
{
    return (
iEnt ? ((pev(iEntpev_solid) > SOLID_TRIGGER) ? true false ) : true )

thEsp is offline
Ynet
Member
Join Date: Aug 2017
Location: israel
Old 05-17-2019 , 04:04   Re: Detect if A Player is aiming on a wall
Reply With Quote #4

Quote:
Originally Posted by thEsp View Post
This could possibly help you, execute it on touch or client pre/post-think.
PHP Code:
bool:isSolid(iEnt)
{
    return (
iEnt ? ((pev(iEntpev_solid) > SOLID_TRIGGER) ? true false ) : true )

seems to ignore walls and only pays attention to ladders



here is what i have tried:

PHP Code:
    new entbody;
    
get_user_aimingidentbody9999 ); // 9999 for testing
            
    
if( is_valid_entent ) )
    {
                    
    if( 
isSolid(ent) )
    {
    
client_print(0,print_chat,"Looking At A Wall");
    return
    }


    
client_print(0,print_chat,"Not Looking At A Wall");
    } 

Last edited by Ynet; 05-17-2019 at 04:08.
Ynet is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 05-16-2019 , 19:04   Re: Detect if A Player is aiming on a wall
Reply With Quote #5

Maybe this can help - https://forums.alliedmods.net/showth...18409?p=418409
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-17-2019 , 11:38   Re: Detect if A Player is aiming on a wall
Reply With Quote #6

Brushes from the map have an index of 0, you should add a check for that too as they aren't valid entities.
Ladders usually use func_wall for the alpha transparency of the texture so that's why only they get detected in your case.
__________________
<VeCo> is offline
Ynet
Member
Join Date: Aug 2017
Location: israel
Old 05-17-2019 , 11:52   Re: Detect if A Player is aiming on a wall
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
Brushes from the map have an index of 0, you should add a check for that too as they aren't valid entities.
Ladders usually use func_wall for the alpha transparency of the texture so that's why only they get detected in your case.
i actually removed the check for the valid ent after posting the code and it still ignored most of the walls
Ynet is offline
thEsp
BANNED
Join Date: Aug 2017
Old 05-17-2019 , 12:01   Re: Detect if A Player is aiming on a wall
Reply With Quote #8

So it detected SOME huh? If yes, this may occur due to not every "wall" being "wall". I mean there are some entities like func_illusionary, info_target etc. used for obvious reasons.

Last edited by thEsp; 05-17-2019 at 12:02.
thEsp is offline
Ynet
Member
Join Date: Aug 2017
Location: israel
Old 05-18-2019 , 03:07   Re: Detect if A Player is aiming on a wall
Reply With Quote #9

Quote:
Originally Posted by thEsp View Post
So it detected SOME huh? If yes, this may occur due to not every "wall" being "wall". I mean there are some entities like func_illusionary, info_target etc. used for obvious reasons.
Gates which i am assuming are considered func_rotating were detected as walls

normal walls just got ignored
Ynet is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-17-2019 , 12:08   Re: Detect if A Player is aiming on a wall
Reply With Quote #10

what exactly do you mean by "wall" ?

Brushes have index of 0, other solid entities will have other indexes (func_wall could be a wall, but breakables and rotating objects could also be walls too, or no depending on their use?). get_user_aiming doesn't detect triggers or point entities.
Anything you look at would be a wall, no? LOL
__________________

Last edited by <VeCo>; 05-17-2019 at 12:29.
<VeCo> 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 15:11.


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