Check if a player is behind a player
#8

Quote:
Originally Posted by milanosie
View Post
That checks if the player is near, not behind.

Probs need to get the angle, and then compare the angle to the other players pos.
Shouldn't be too hard.
Yeah misread the topic anyways this should do it,

pawn Code:
stock IsPlayerBehindPlayer(playerid, targetid, Float:dOffset) {
    new Float:playera,Float:playert;
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid)) return 0;
    GetPlayerFacingAngle(playerid, playera);
    GetPlayerFacingAngle(targetid, playert);
    if(AngleInRangeOfAngle(playera, playert, dOffset) && IsPlayerFacingPlayer(playerid, targetid, dOffset)) return true;
    return false;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)