Can't use SetVehiclePos and SetVehicleVirtualWorld together -
roym899 - 10.02.2013
Hey,
I have a problem with SetVehiclePos and SetVehicleVirtualWorld.
I want to move a vehicle, change its VirtualWorld for 10 seconds to something else and the let it reappear in the standardworld (id=0)
I've tried both Linking to another interior and setting another virtual world. Both doesn't work. I could fix the problem by moving the car to an invisible place without any problem but I'm kinda curious why it doesn't work.
The car which shall be moved is attached as a trailer beforehand and it gets detached before moving/changing the virtual world.
So here is the code (the public funciton is forwarded):
Код:
public BringBackRepairedCar(vehicleid)
{
SetVehicleVirtualWorld(vehicleid, 0);
}
RepairAndDisappearTrailer(vehicleid)
{
new towedcar = GetVehicleTrailer(GetPlayerVehicleID(playerid));
towedcarplace[i][VEHICLEID] = towedcar;
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
SetVehicleVirtualWorld(towedcar, 10);
RepairVehicle(towedcar);
SetVehiclePos(towedcar, coordx, coordy, coordz);
SetTimerEx("BringBackRepairedCar", 10000, false , "i", towedcar);
}
coordx,y,z are any coordinates. it doesn't matter which I use.
Re: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
Misiur - 10.02.2013
Your SetTimerEx has wrong order of arguments. Switch false and 10000 (
https://sampwiki.blast.hk/wiki/SetTimerEx)
AW: Re: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
roym899 - 10.02.2013
Quote:
Originally Posted by Misiur
|
Wow didn't noticed that. I'll try it out but wouldn't it be strange if that's the problem? Because the car actually gets moved and putted into the other vw before this functions gets called. But I'll try it.+
Edit: Yea, the reappearing works now, but still the car only is the virtual world but doesn't get moved.
Re: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
Misiur - 10.02.2013
Where do you store coords in coordx, coordy, coordz variables?
AW: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
roym899 - 10.02.2013
Normally they are in an array. But right now I'm testing with constants.
Код:
SetVehiclePos(towedcar, 2318.0681,-2364.0303,13.3784);
SetVehicleZAngle(towedcar, 44.6877);
AW: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
roym899 - 11.02.2013
Push, I've got it done by using a timer on setting the virtual world. So first I set the position and then I wait 100ms and set the VW.
But that's pretty bad style imho. No way to fixing that?
Re: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
denNorske - 11.02.2013
Apparently not, if that worked.
AW: Can't use SetVehiclePos and SetVehicleVirtualWorld together -
roym899 - 11.02.2013
Hm ok. But can someone explain please why it doesn't work in the different order? So first setting the VW and then setting the position a little time after?