Check if player is looking at the coordinate?
#3

Might this code can help you:
PHP код:
IsActorInPlayerFacingAngle(playeridactoridFloat:max_angle 90.0bool:isdynamic DEFAULT_IS_DYNAMIC_PARAMETER)
{
    if(!
IsPlayerConnected(playerid) || !AP_IsValidActor(actorid))
        return 
0;
    new 
Float:ang,
        
Float:second_ang,
        
Float:result;
    
GetPlayerFacingAngle(playeridang);
    
#if USING_STREAMER
        
if(isdynamic)
            
GetDynamicActorFacingAngle(actoridsecond_ang);
        else
            
GetActorFacingAngle(actoridsecond_ang);
    
#else
        #pragma unused isdynamic
        
GetActorFacingAngle(actoridsecond_ang);
    
#endif
    
if(ang 180.0)
        
result 180.0 ang;
    else
        
result ang 180.0;
    
    if(
second_ang max_angle 360.0 || second_ang max_angle 0.0)
        return ((
360.0 max_angle <= result <= 360.0) || (0.0 <= result <= max_angle));
    else
        return (
second_ang max_angle <= result <= second_ang max_angle);

Taken from : https://github.com/Dayrion/actor_plu...nc#L1444-L1473
Reply


Messages In This Thread
Check if player is looking at the coordinate? - by Paulthaz - 12.05.2018, 19:23
Re: Check if player is looking at the coordinate? - by Gameluner - 12.05.2018, 21:37
Re: Check if player is looking at the coordinate? - by Dayrion - 12.05.2018, 21:56

Forum Jump:


Users browsing this thread: 1 Guest(s)