View Single Post
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-26-2021 , 14:37   Re: How to know which side are the sound coming from
Reply With Quote #3

This is pretty much what I've done so far, pretty hard coded but just an example:

PHP Code:
    new Float:fFireAngle[3]
    
pev(iPlayerpev_anglesfFireAngle)
    
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"a")
    for(new 
iPlayerAroundFloat:fPlayerAngle[3], i;iNum;i++)
    {
        
iPlayerAround iPlayers[i// iPlayerAround is the ID of all players around me, I'm checking which side they are from my perspective.
        
        
pev(iPlayerAroundpev_anglesfPlayerAngle)
        
        if(
40.0 <= (fPlayerAngle[1] - fFireAngle[1]) <= 105.0)
        {
            
log_amx("Player is on my left"
        }
        else if(
120.0 <= (fPlayerAngle[1] - fFireAngle[1]) > -147.0)
        {
            
log_amx("Player is behind me")
        }
        else 
log_amx("Player is on my right")
        
console_print(iPlayer"%f %f %f"fPlayerAngle[0] - fFireAngle[0], fPlayerAngle[1] - fFireAngle[1], fPlayerAngle[2] - fFireAngle[2])
    } 

If I shot at you, I wanna know first if it's behind you, your left or right or in front of you, then create an entity based on that information.

If I shot at behind you, I wanna get an origin behind you and then spawn an entity there.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 02-26-2021 at 14:38.
EFFx is offline