SA-MP Forums Archive
[HELP] Teleport Vehicles? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Teleport Vehicles? (/showthread.php?tid=194027)



[HELP] Teleport Vehicles? - Fredden1993 - 28.11.2010

Hello,

Is there any way to create a command that will teleport you plus the vehicle? For example, I got my own garage interior with an icon at the garage door, if I drive into the icon and type /exit it should teleport me back to the world.

Thanks for your support!


Re: [HELP] Teleport Vehicles? - knackworst - 28.11.2010

of course it is,

here is mine with some explanation:

pawn Код:
if(strcmp(cmdtext, "/stunt1", true)==0) //It is on a command, if you want to do it on a pickup, simply //change all thise strcmp and stuff to if(pickup...)
    {
        new vehicleid=GetPlayerVehicleID(playerid);
        if(vehicleid){
        SetVehiclePos(vehicleid, x,y,z);
                         GameTextForPlayer(playerid," you teleported in a vehicle",5000,3);
        }
        else
        {
        SetPlayerPos(playerid, x,y,z); //If the player is not in a vehicle and he teleports:
        GameTextForPlayer(playerid,"You teleported onfoot",5000,3);
        }
        return 1;
        }



Re: [HELP] Teleport Vehicles? - Abraham2nd - 28.11.2010

Or this one..this works.i tested:
Код:
if(!strcmp(cmdtext, "/entrance", true))
        {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetVehiclePos(GetPlayerVehicleID(playerid), 2857.31,-1960.78,10.9376); //i have my own coordinates but u can change!
            SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
            SetPlayerPos(playerid, 2857.31,-1960.78,10.9376); //same goes here
            SetPlayerFacingAngle(playerid, 0.0);
        }
        SetPlayerInterior(playerid, 0);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, " Welcome to blah blah!");
        return 1;