vehicle facing angle - 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: vehicle facing angle (
/showthread.php?tid=187410)
vehicle facing angle -
dark_clown - 02.11.2010
how can i make simsort of setvehiclefacingagle?
like setplayerfacingangle
i cant find it on sa-mp wiki
and i dont want setvehicleZangle
Re: vehicle facing angle -
dark_clown - 02.11.2010
zangle = ex: /flip rotation i dont want it
Re: vehicle facing angle -
Sascha - 02.11.2010
the ZAngle is the SAME as the FACING ANGLE!
it is just used for /flip as if you change the position of a vehicle it flips it around automatically... and as
Code:
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
SetVehiclePos(vehicleid, x, y, z);
would stop the speed, everyone uses the facing angle of the vehicle.
Re: vehicle facing angle -
boelie - 02.11.2010
Sascha is correct check these 2 differences;
Code:
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));
}
GetXYInFrontOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetVehiclePos(vehicleid,x,y,a);
GetVehicleZAngle(vehicleid,a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
The part where in the angle should be checked is GetVehicleZAngle(vehicleid,a);
for the vehicle and GetPlayerFacingAngle for player.
Just try it out and you'll see