IsPlayerLookAt Function
#7

pawn Код:
public IsPlayerLookAt(playerid, const Float:range,
    const Float:x, const Float:y, const Float:z, const Float:max_al, const Float:max_ar)
{
    if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
    {
        new Float:angle, Float:Pos[3];
        GetPlayerFacingAngle(playerid, angle);
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        if(Pos[0] > x) angle -= (atan( (Pos[1] - y) / (Pos[0] - x) ) + 90.0);
        else           angle -= (atan( (Pos[1] - y) / (Pos[0] - x) ) + 270.0);
        if(angle < 0) {
            if((angle > -max_al) || ((angle + 360.0) < max_ar)) return 1;
        } else {
            if((angle < max_ar) || ((angle - 360.0) > -mal_al)) return 1;
        }
    }
    return 0;
}
Not tested but actually I thought that there were already an include with such functions released
Reply


Messages In This Thread
IsPlayerLookAt Function - by Voldemort - 23.08.2010, 14:30
Re: IsPlayerLookAt Function - by boelie - 23.08.2010, 14:52
Re: IsPlayerLookAt Function - by Voldemort - 23.08.2010, 14:57
Re: IsPlayerLookAt Function - by boelie - 23.08.2010, 15:01
Re: IsPlayerLookAt Function - by Claude - 23.08.2010, 15:06
Re: IsPlayerLookAt Function - by Voldemort - 23.08.2010, 15:18
Re: IsPlayerLookAt Function - by Nero_3D - 23.08.2010, 16:32
Re: IsPlayerLookAt Function - by Voldemort - 23.08.2010, 18:43
Re: IsPlayerLookAt Function - by Nero_3D - 23.08.2010, 19:49

Forum Jump:


Users browsing this thread: 2 Guest(s)