Vehicle stuck in the air on SetVehiclePos
#1

Pretty simple, when I do /getcar the car is teleported successfully but it just stucks in the air until I jump at it, touch it. I've searched some old threads and I tried to start the vehicle engine on-off on teleport since someone said its a fix for it but its doing nothing. Any tips?

PHP Code:
CMD:getcar(playeridparams[]) {
  static 
vid;
  static 
Float:xFloat:yFloat:z;
  if(
admin1) return EmTag(playeridYOU_HAVE_NO_PERMISSION);
  if(
sscanf(params"i"vid)) return UsageTag(playerid"/getcar[ID]");
  if(!
IsValidVehicle(vid)) return EmTag(playerid"The specified vehicle ID is invalid!");
  
GetPlayerPos(playeridFloat:xFloat:yFloat:z);
  
SetVehiclePos(vidFloat:x+2Float:y+2Float:z);
  return 
1;

Reply
#2

Try with PutPlayerInVehicle
Reply
#3

Quote:
Originally Posted by v1k1nG
View Post
Try with PutPlayerInVehicle
Well thats a ghetto fix, Im sure with PutPlayerInVehicle its working. There is need to be another fix for this.
Reply
#4

PHP Code:
SetVehiclePos(vidFloat:x+2Float:y+2Float:z); 
those +2 are a ghetto fix too, even if I don't think that's related to your problem since your car gets moved in height (z axys, the one you didn't alterate). Try to /getcar while not too far from the vehicle, check how it behaves.
Reply
#5

Quote:
Originally Posted by v1k1nG
View Post
PHP Code:
SetVehiclePos(vidFloat:x+2Float:y+2Float:z); 
those +2 are a ghetto fix too, even if I don't think that's related to your problem since your car gets moved in height (z axys, the one you didn't alterate). Try to /getcar while not too far from the vehicle, check how it behaves.
Well its right next to me so still idk.
Reply
#6

This x+2 and y+2 will not work everytime.

That depends on, where you are look and standing.

The correct way, would to use it like this:

PHP Code:
CMD:getcar(playeridparams[]) { 
  new 
vidFloat:xFloat:yFloat:zFloat:a;
  if(
admin1) return EmTag(playeridYOU_HAVE_NO_PERMISSION); 
  if(
sscanf(params"i"vid)) return UsageTag(playerid"/getcar[ID]"); 
  if(!
IsValidVehicle(vid)) return EmTag(playerid"The specified vehicle ID is invalid!"); 
  
GetPlayerPos(playeridxyz), GetPlayerFacingAngle(playerida);
  
+= 2.0 floatsin(-90.0degrees);
  
+= 2.0 floatcos(-90.0degrees);
  
SetVehiclePos(vidx,y,z-1.0); 
  return 
1

Besides, dont use static like that.
You dont need to reserve continous space...


Anyway the veh should sync better, if it touches the ground.
So set the z Axis a bit down, that should work.
But its a sync Problem...
Reply
#7

Just use colandreas/mapandres FindZ to set in on the ground. It won't be stuck after collision.
Reply
#8

Check the wiki. It says that if you set vehicles position it mostly will just be floating.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)