SA-MP Forums Archive
TP'ing vehicle problem. - 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: TP'ing vehicle problem. (/showthread.php?tid=511752)



TP'ing vehicle problem. - Laure - 07.05.2014

Hey there, i made a feature for vip in my server in which they can tp their vehicle to their position after chosen from a dialog box, but it is not working it all says you have tped vehicle with id 0 to your position and not tping the car at all. Here is my code.
pawn Код:
else if(dialogid == 30)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    new veh, string[128];
                    if(!PlayerInfo[playerid][pVeh]) return SendClientMessage(playerid, COLOR_GREY, "You dont have a car in this slot.");
                    veh = PlayerInfo[playerid][pVeh];
                    new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                    SetVehiclePos(veh, pos[0], pos[1], pos[2]);
                    LinkVehicleToInterior(veh, GetPlayerInterior(playerid));
                    format(string, sizeof(string), "You have teleported your %d id vehicle to you.", veh);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                case 1:
                {
                    new veh, string[128];
                    if(!PlayerInfo[playerid][pVVeh]) return SendClientMessage(playerid, COLOR_GREY, "You dont have a car in this slot.");
                    veh = PlayerInfo[playerid][pVVeh];
                    new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                    SetVehiclePos(veh, pos[0], pos[1], pos[2]);
                    LinkVehicleToInterior(veh, GetPlayerInterior(playerid));
                    format(string, sizeof(string), "You have teleported your %d id vehicle to you.", veh);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
            }
           
        }
    }



Re: TP'ing vehicle problem. - Smileys - 07.05.2014

hmm, perhaps the worlds are still different.

add this to your code:

pawn Код:
SetVehicleVirtualWorld( veh, GetPlayerVirtualWorld( playerid ) );



Re: TP'ing vehicle problem. - Laure - 07.05.2014

worked thanks. repped


Re: TP'ing vehicle problem. - Smileys - 07.05.2014

anytime.