Vehicle teleport coords
#1

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); 
Reply
#2

Cause you didnt set angle

Код:
SetVehicleZAngle(vehicleid, angle);
Reply
#3

Tried to do that, didn't work.
Reply
#4

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

Код:
 	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);
Reply
#6

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?
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)