Vehicle stuck in the air on SetVehiclePos -
polygxn - 13.03.2019
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(playerid, params[]) {
static vid;
static Float:x, Float:y, Float:z;
if(admin1) return EmTag(playerid, YOU_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(playerid, Float:x, Float:y, Float:z);
SetVehiclePos(vid, Float:x+2, Float:y+2, Float:z);
return 1;
}
Re: Vehicle stuck in the air on SetVehiclePos -
v1k1nG - 13.03.2019
Try with PutPlayerInVehicle
Re: Vehicle stuck in the air on SetVehiclePos -
polygxn - 13.03.2019
Quote:
Originally Posted by v1k1nG
Try with PutPlayerInVehicle
|
Well thats a ghetto fix, Im sure with PutPlayerInVehicle its working. There is need to be another fix for this.
Re: Vehicle stuck in the air on SetVehiclePos -
v1k1nG - 13.03.2019
PHP Code:
SetVehiclePos(vid, Float:x+2, Float:y+2, Float: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.
Re: Vehicle stuck in the air on SetVehiclePos -
polygxn - 13.03.2019
Quote:
Originally Posted by v1k1nG
PHP Code:
SetVehiclePos(vid, Float:x+2, Float:y+2, Float: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.
Re: Vehicle stuck in the air on SetVehiclePos -
Kaliber - 14.03.2019
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(playerid, params[]) {
new vid, Float:x, Float:y, Float:z, Float:a;
if(admin1) return EmTag(playerid, YOU_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(playerid, x, y, z), GetPlayerFacingAngle(playerid, a);
x += 2.0 * floatsin(-a + 90.0, degrees);
y += 2.0 * floatcos(-a + 90.0, degrees);
SetVehiclePos(vid, x,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...
Re: Vehicle stuck in the air on SetVehiclePos -
raydx - 14.03.2019
Just use colandreas/mapandres FindZ to set in on the ground. It won't be stuck after collision.
Re: Vehicle stuck in the air on SetVehiclePos -
antixgaming - 14.03.2019
Check the wiki. It says that if you set vehicles position it mostly will just be floating.