Could someone explaing me how "GetXYInFrontOfPlayer" works? - 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: Could someone explaing me how "GetXYInFrontOfPlayer" works? (
/showthread.php?tid=509510)
Could someone explaing me how "GetXYInFrontOfPlayer" works? -
Kyance - 27.04.2014
As the title says, could someone explain it?
pawn Код:
GetXYInFrontOfPlayer(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);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return 1; //Needed this because if 'if' ..
}
Can it be used, to
detect if a player is looking at another player, or not?
Like.
pawn Код:
new Float:X, Float:Y, Float:Z
GetPlayerPos(playerid, X, Y, Z);
if(GetXYInFrontOfPlayer(issuerid, X, Y, 5))
{
SendClientMessage(issuerid, -1, "no aimbot");
}
else
{
SendClientMessage(issuerid, -1, "aimbot");
}
or something like that? xd
Re: Could someone explaing me how "GetXYInFrontOfPlayer" works? -
PrinceKumar - 27.04.2014
Edit: sorry i was posting ur post answer but unfortunately i pasted wrong post to ur thread.
As i know this function is use for create objects in front of player and this function is based on 2D which will check according to straight line instead of a plane , n i m not sure but think that u may get success .
Re: Could someone explaing me how "GetXYInFrontOfPlayer" works? -
RajatPawar - 27.04.2014
Quote:
Originally Posted by ******
|
In addition to that,
Polar co-ordinates
Co-ordinate system
Polar to cartesian conversion