Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: darlan on Mar 01, 2019, 04:19 AM

Title: Angle of vehicles
Post by: darlan on Mar 01, 2019, 04:19 AM

I can not change the angle of the cars, everyone is heading north.
Title: Re: Angle of vehicles
Post by: dracc on Mar 01, 2019, 06:41 AM
What does your current vehicle creation line look like?
Also, angle is probably supposed to be in Radians and not Degrees.
Title: Re: Angle of vehicles
Post by: rww on Mar 01, 2019, 04:00 PM
U can get correct vehicle angle by this script

function CVehicle::GetRadiansAngle() //by Gudio
{
local angle = ::asin(this.Rotation.z) * -2;
return this.Rotation.w < 0 ? 3.14159 - angle : 6.28319 - angle;
}

I never get problems with values from this code ;)

Example, how to get correct angle by /pos command

onPlayerCommands event:
local veh = player.Vehicle;

if (cmd == "pos")
{
if (!veh) ClientMessage("* Your Cords:[#ffffff] "+player.Pos.x+", "+player.Pos.y+", "+player.Pos.z+", "+player.Angle,player,128,255,0,255);
else ClientMessage("* Your Vehicle Cords:[#ffffff] "+player.Pos.x+", "+player.Pos.y+", "+player.Pos.z+", "+veh.GetRadiansAngle(),player,128,255,0,255);
ClientMessage("* Virtual World:[#ffffff] "+player.World+" [#80ff00]/ Sec World:[#ffffff] "+player.SecWorld+" [#80ff00]/ Unique World: [#ffffff]"+player.UniqueWorld,player,128,255,0,255);
}