How - 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)
+--- Thread: How (
/showthread.php?tid=497708)
How -
Maime - 28.02.2014
How can i detect if a player is aiming at another players back?
Thanks!
Re: How -
MattTucker - 28.02.2014
I don't think it's possible but you can detect if he shot his back
Re: How -
Maime - 28.02.2014
It is possible... i've seen it in a server myself.
Re: How -
MattTucker - 28.02.2014
https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer - This is all I could find of about aimming, good luck lol.
Re: How -
Maime - 28.02.2014
I know every function there is to know because i know that you are supposed to search before asking for help. GetPlayerTargetPlayer woulden't help me abit it just detects if the player is aiming at you it dosen't detect the point of view it just goes random.
EDIT: For the one who can help me i'd appricate it alot, you have no idea.. i really need this.
Re: How -
Maime - 01.03.2014
bump
Re: How -
AIped - 01.03.2014
You sir clearly have not enough scripting knowledge to tell 'MattTucker' is correct or not.
In fact he is right you can use GetPlayerTargetPlayer. What MattTucker failed to mention is that it will only solve part of the problem. You could combine GetPlayerTargetPlayer with functions like these;
pawn Код:
stock GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
a +=180;
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
and
pawn Код:
stock IsPlayerBehindPlayer(playerid,targetid,Float:distance,Float:range)
{
if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid))return 0;
{
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x, y, z);//my pos
GetXYBehindPlayer(targetid,x,y,distance);
if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))return 1;
}
return 0;
}