IsPlayerInFrontOfPlayer
#1

Hey, can someone possibly make me a function?

Of

IsPlayerInFrontOfPlayer

I tried loads of times, and failed on every single try, then got mad, and deleted it all.

Could someone make me one?

It's self explanatory.
Reply
#2

pawn Code:
stock IsPlayerBehindPlayer(playerid, targetid, Float:dOffset)
{
    new Float:pa,Float:ta;
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid)) return 0;

    GetPlayerFacingAngle(playerid, pa);
    GetPlayerFacingAngle(targetid, ta);
    if(AngleInRangeOfAngle(pa, ta, dOffset) && IsPlayerFacingPlayer(playerid, targetid, dOffset)) return true;
    return false;
}

stock AngleInRangeOfAngle(Float:a1, Float:a2, Float:range)
{
    a1 -= a2;
    if((a1 < range) && (a1 > -range)) return true;
    return false;
}
make use with that :d

tbh just change

AngleInRangeOfAngle(pa, ta, dOffset) with a -180 or something?
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=105568
Reply
#4

Edited
Reply
#5

Thanks all :3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)