Vehicle Teleporting help please?
#1

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
Reply
#2

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.
Reply
#3

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);
}
Reply
#4

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;
    }
Reply
#5

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.
Reply
#6

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"
Reply
#7

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

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+
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)