SA-MP Forums Archive
Vehicle teleport coords - 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: Vehicle teleport coords (/showthread.php?tid=657339)



Vehicle teleport coords - Zeus666 - 05.08.2018

Hi, My car is being teleported in this position https://i.imgur.com/XywLiRp.jpg


instead of this https://i.imgur.com/CaPEE8J.jpg

Why?

PHP код:
     new vehicle;
    
vehicle GetPlayerVehicleID(playerid);
      
SetPlayerPos(playerid58.9391,-134.7392,2.3367);
      
SetVehiclePos(vehicle58.9391,-134.7392,2.3367);
      
PutPlayerInVehicle(playeridvehicle0); 



Re: Vehicle teleport coords - Lokii - 05.08.2018

Cause you didnt set angle

Код:
SetVehicleZAngle(vehicleid, angle);



Re: Vehicle teleport coords - Zeus666 - 05.08.2018

Tried to do that, didn't work.


Re: Vehicle teleport coords - BornHuman - 05.08.2018

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
Tried to do that, didn't work.
Show the code with the SetVehicleZAngle


Re: Vehicle teleport coords - Zeus666 - 05.08.2018

Код:
 	new vehicle;
 	new Float:angle;
	vehicle = GetPlayerVehicleID(playerid);
  	SetPlayerPos(playerid, 58.9391,-134.7392,2.3367);
  	SetVehiclePos(vehicle, 58.9391,-134.7392,2.3367);
    GetVehicleZAngle(vehicle, angle);
    SetVehicleZAngle(vehicle, angle);
  	PutPlayerInVehicle(playerid, vehicle, 0);



Re: Vehicle teleport coords - BornHuman - 05.08.2018

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
Код:
 	new vehicle;
 	new Float:angle;
	vehicle = GetPlayerVehicleID(playerid);
  	SetPlayerPos(playerid, 58.9391,-134.7392,2.3367);
  	SetVehiclePos(vehicle, 58.9391,-134.7392,2.3367);
    GetVehicleZAngle(vehicle, angle);
    SetVehicleZAngle(vehicle, angle);
  	PutPlayerInVehicle(playerid, vehicle, 0);
You're setting the vehicle's angle to what it is when you exit the garage, which is why it isn't facing the right way. So if you're facing north when you exit the garage, the vehicle will come out facing north. You want to set it to the angle that is facing forward when you exit that garage. Angles are 0-360.

Here's an excerpt from the SA:MP Wiki:
pawn Код:
Angles are reversed in GTA:SA; 90 degrees would be East in the real world, but in GTA:SA 90 degrees is in fact West. North and South are still 0/360 and 180. To convert this, simply do 360 - angle.
So if you want it to face West when you exit, set the angle to 90.0.

Does that make sense?


Re: Vehicle teleport coords - RogueDrifter - 05.08.2018

Quick note:

This:
Код:
new vehicle; 
vehicle = GetPlayerVehicleID(playerid); 
SetPlayerPos(playerid, 58.9391,-134.7392,2.3367); 
SetVehiclePos(vehicle, 58.9391,-134.7392,2.3367); 
PutPlayerInVehicle(playerid, vehicle, 0);
Could've been done like this:
Код:
SetVehiclePos(GetPlayerVehicleID(playerid), 58.9391,-134.7392,2.3367);
And it would give the same results.