SA-MP Forums Archive
Question for SetPlayerPosEx - 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: Question for SetPlayerPosEx (/showthread.php?tid=401237)



Question for SetPlayerPosEx - karolis1478 - 22.12.2012

hello, i creating SetPlayerPosEx(playerid, x,y,z,vw);

and i have problem, code:

pawn Код:
stock SetPlayerPosEx(playerid, Float:x ,Float:y,Float:z,vw = 0)
{
    new cartype = GetPlayerVehicleID(playerid);
    new State=GetPlayerState(playerid);
    if(State!=PLAYER_STATE_DRIVER)
    {
        SetPlayerPos(playerid, x, y ,z);
        SetPlayerVirtualWorld(playerid, vw);
    }
    else if(IsPlayerInVehicle(playerid, cartype) == 1)
    {
        SetVehiclePos(cartype,x,y,z);
        SetVehicleVirtualWorld(cartype, vw);
        SetVehicleZAngle(cartype,91);
    }
    else
    {
        SetPlayerPos(playerid,x,y,z);
        SetPlayerVirtualWorld(playerid, vw);
    }
    return 1;
}
and when i first time teleport to sanfierro (virtualworld 0) its teleport with no vehicle, and in second time when teleport, then teleport with vehicle, and third time when i teleport in stunt (virtualworld 2) then teleport in 0 virtualworld ( and in this time teleport only vehicle in those virtualworld) and fourth time when teleport in stunt (vw 2) teleport in virtualworld, and i can see the vehicle when teleported in third time, help, where it's a bug?

sorry for bad english.


Re: Question for SetPlayerPosEx - Lapon - 22.12.2012

Set the virtual worlds manually to make it work i guess it should work.


Re: Question for SetPlayerPosEx - karolis1478 - 22.12.2012

yes, it works. but how to do in stock without having to write every time?

YSI, can you give example for no bugs?

Edit: Problem fixed