SA-MP Forums Archive
Could I detect... - 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 I detect... (/showthread.php?tid=433409)



Could I detect... - Youice - 27.04.2013

Hello,

Could I detect the vehicle's looking at?
(ex: GetVehicleLookingAt(vehicleid, x, y, z) ) ?


Re: Could I detect... - verlaj - 27.04.2013

maybe you can use, if(IsplayerInAnyVehicle....... and https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector


Re: Could I detect... - Youice - 27.04.2013

what if I want to move an object toward the vehicle looking at?


Re: Could I detect... - DanLore - 27.04.2013

Refer to https://sampforum.blast.hk/showthread.php?tid=413556


Re: Could I detect... - verlaj - 27.04.2013

use this code as a stock

pawn Код:
stock GetVehiclePos(playerid, vehicleid)
{
 if(IsPlayerInAnyVehicle(playerid))
{
new Float:x,Float:y,Float:z,Float:a,Float:X,Float:y;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
X = x + (8 * floatsin(a,degrees));
Y = y + (8 * floatcos(a,degrees));
CreateObject(00000,X,Y,z,0,0,0);
}
return 1;
}



Re: Could I detect... - Youice - 27.04.2013

Quote:
Originally Posted by DanLore
Посмотреть сообщение
I'm not asking for a script.
I'm saying that could I detect so...


Re: Could I detect... - MP2 - 27.04.2013

You'll need to get camera vectors (GetPlayerCameraPos + GetPlayerCameraFrontVector).

https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector

https://sampforum.blast.hk/showthread.php?tid=140765


Re: Could I detect... - Baboon - 27.04.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
You'll need to get camera vectors (GetPlayerCameraPos + GetPlayerCameraFrontVector).

https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector

https://sampforum.blast.hk/showthread.php?tid=140765
No, he asks for the vehicle lookat...
Simply use: GetVehicleZAngle


Re: Could I detect... - MP2 - 27.04.2013

Vehicles don't have eyes so they can't 'look' at a place, so I assumed he meant the player's camera.