SA-MP Forums Archive
Vehicle Teleporting help please? - 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: Vehicle Teleporting help please? (/showthread.php?tid=349442)



Vehicle Teleporting help please? - NeymarJr - 09.06.2012

Hey guys can someone help me to make this command:

When a player is in a vehicle and he teleported somewhere, is there a way that i can keep the player in the vehicle when he teleport? so he doesnt need to load his car again?

someone help please?

Thankyou


Re: Vehicle Teleporting help please? - JhnzRep - 09.06.2012

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
    SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
}
Put this under your teleport command. And change the X, Y, Z to your coords.


Re: Vehicle Teleporting help please? - [KHK]Khalid - 09.06.2012

here you go
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
    new vx, vy, vz;
    new px, py, pz;
    new seat = GetPlayerVehicleSeat(playerid);
    new vehid = GetPlayerVehicleID(playerid);
    GetVehiclePos(vehid, vx, vy, vz);
    GetPlayerPos(playerid, px, py, pz);
    SetVehiclePos(vehid, vx, vy, vz);
    SetPlayerPos(playerid, px, py, pz);
    PutPlayerInVehicle(playerid, vehid, seat);
}



Re: Vehicle Teleporting help please? - NeymarJr - 09.06.2012

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{

    SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
}
Put this under your teleport command. And change the X, Y, Z to your coords.
So would it look like this:

Код:
if(!strcmp(cmdtext,"/lv",true)) {
    	SetPlayerPos(playerid, 2025.075, 1627.977, 15);
    	SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] You have been teleported to Las Venturas.");
    	if(IsPlayerInAnyVehicle(playerid))
	{
    	SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
	}
    	return 1;
    }



- JhnzRep - 09.06.2012

PutPlayerInVehicle(playerid, vehid, seat); and SetPlayerPos is not needed.

*Facepalm*...

Just use SetVehiclePos, and if you are in the car, it will teleport you with it.

pawn Код:
if(!strcmp(cmdtext,"/lv",true))
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
            SetPlayerPos(playerid, 2025.075, 1627.977, 15);
    }
        SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] You have been teleported to Las Venturas.");
        if(IsPlayerInAnyVehicle(playerid))
    {
            SetVehiclePos(GetPlayerVehicleID(playerid), 2025.075, 1627.977, 15);
    }
        return 1;
}
Like this.

EDIT:Sorry for double post...Gahh..Idiot me.


Re: Vehicle Teleporting help please? - NeymarJr - 09.06.2012

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
PutPlayerInVehicle(playerid, vehid, seat); and SetPlayerPos is not needed.

*Facepalm*...

Just use SetVehiclePos, and if you are in the car, it will teleport you with it.
C:\Users\Jr\Desktop\SAMP Server\gamemodes\alpha.pwn(1293) : error 017: undefined symbol "X"


Re: Vehicle Teleporting help please? - JhnzRep - 09.06.2012

Use the new code I posted, and it should work. If it doesn't post the errors, and error lines.


Re: Vehicle Teleporting help please? - NeymarJr - 09.06.2012

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Use the new code I posted, and it should work. If it doesn't post the errors, and error lines.
Thankyou! REP+


Re: Vehicle Teleporting help please? - JhnzRep - 09.06.2012

You welcome! If you need anymore help, or explaining on how this works, PM me!