SA-MP Forums Archive
Teleport with car - 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: Teleport with car (/showthread.php?tid=251826)



Teleport with car - Panormitis - 28.04.2011

When my players do teleport when they are in a car they teleport to their destination without their car, how i can make when someone is in a vehicle and to teleport command to teleport with the vehicle together


Re: Teleport with car - Joe Staff - 28.04.2011

Well you have to change the command to only teleport the player when he's not in a car, otherwise teleport just the car.

pawn Код:
//command
new Float:x,Float:y,Float:z;
GetPlayerPos(GOTOPLAYER,x,y,z);
if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
else SetPlayerPos(playerid,x,y,z);



Re: Teleport with car - Panormitis - 28.04.2011

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
Well you have to change the command to only teleport the player when he's not in a car, otherwise teleport just the car.

pawn Код:
//command
new Float:x,Float:y,Float:z;
GetPlayerPos(GOTOPLAYER,x,y,z);
if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
else SetPlayerPos(playerid,x,y,z);
i don't understand :/ where i must put this?


Re: Teleport with car - aircombat - 28.04.2011

under your /teleport command use :

Код:
if(IsPlayerInAnyVehicle(playerid)) return SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
else return SetPlayerPos(playerid,X,Y,Z);



Re: Teleport with car - Panormitis - 29.04.2011

Quote:
Originally Posted by aircombat
Посмотреть сообщение
under your /teleport command use :

Код:
if(IsPlayerInAnyVehicle(playerid)) return SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
else return SetPlayerPos(playerid,X,Y,Z);
How can I add and interior for the vehicle teleport?


Re: Teleport with car - leong124 - 29.04.2011

Quote:
Originally Posted by aircombat
Посмотреть сообщение
under your /teleport command use :

Код:
if(IsPlayerInAnyVehicle(playerid)) return SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
else return SetPlayerPos(playerid,X,Y,Z);
Probably not correct.
When the player is passenger this would teleport the whole car...

Quote:
Originally Posted by Panormitis
Посмотреть сообщение
How can I add and interior for the vehicle teleport?
Replace:
pawn Код:
SetPlayerPos(playerid,....);
as:
pawn Код:
SetPlayerInterior(playerid,interior ID);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
    SetVehiclePos(player's vehicle ID,x_coord,y_coord,z_coord);
    LinkVehicleToInterior(player'
s vehicle ID,interior ID);
}
else SetPlayerPos(playerid,x_coord,y_coord,z_coord);



Re: Teleport with car - Max_Coldheart - 29.04.2011

pawn Код:
LinkVehicleToInterior(vehicleid, interiorid); // This should help ya out