SA-MP Forums Archive
Get player aiming at - 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: Get player aiming at (/showthread.php?tid=91897)



Get player aiming at - Rickk - 17.08.2009

hey, here is a short question:

Is there a way to get the coцrdinates of where the player is aiming at?

I think MTA found a way (with the laser-pointer in the map editor).



Re: Get player aiming at - dice7 - 17.08.2009

GetPlayerFacingAngle and use of some sinus and cosinus


Re: Get player aiming at - paytas - 17.08.2009

It's not possible yet.


Re: Get player aiming at - gijsmin - 17.08.2009

Quote:
Originally Posted by paytas
It's not possible yet.
it is i saw it in a server, you need to script it like dice7 told you


Re: Get player aiming at - paytas - 17.08.2009

thats bs, u can't get where the payer is aiming at in 3d, only 2d -> useless.


Re: Get player aiming at - dice7 - 17.08.2009

paytas has a point. btw, script for telling you where you aim, 2d only. This is useful when you have a car spawn command
and with this you can make the car spawn right infront of you

pawn Code:
new Float:X,Float:Y,Float:Z,Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
X += (5 * floatsin(-A, degrees));
Y += (5 * floatcos(-A, degrees));
CreateVehicle(411, X, Y, Z, 0.0, -1, -1, 600);



Re: Get player aiming at - Rickk - 17.08.2009

Yes I have seen that piece of code before, but it doesn't tell me where I am aiming at.
Well, to bad if it ain't possible.


Re: Get player aiming at - dice7 - 17.08.2009

Quote:
Originally Posted by Rickk
Yes I have seen that piece of code before, but it doesn't tell me where I am aiming at.
Well, to bad if it ain't possible.
pawn Code:
new Float:X,Float:Y,Float:Z,Float:A, string[40];
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
X += (5 * floatsin(-A, degrees));
Y += (5 * floatcos(-A, degrees));
format(string, sizeof(string), "You are aiming at X:%2.f, Y:%2.f", X, Y);
SendClientMessage(playerid, string);
CreateVehicle(411, X, Y, Z, 0.0, -1, -1, 600);