IsPlayerInFrontOfPlayer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsPlayerInFrontOfPlayer (
/showthread.php?tid=203797)
IsPlayerInFrontOfPlayer -
WillyP - 28.12.2010
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.
Re: IsPlayerInFrontOfPlayer -
The_Gangstas - 28.12.2010
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?
Re: IsPlayerInFrontOfPlayer -
Retardedwolf - 28.12.2010
https://sampforum.blast.hk/showthread.php?tid=105568
Re: IsPlayerInFrontOfPlayer -
admantis - 28.12.2010
Edited
Re: IsPlayerInFrontOfPlayer -
WillyP - 28.12.2010
Thanks all :3