28.04.2011, 20:53
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

//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);
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 Код:
|
if(IsPlayerInAnyVehicle(playerid)) return SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z); else return SetPlayerPos(playerid,X,Y,Z);
under your /teleport command use :
Код:
if(IsPlayerInAnyVehicle(playerid)) return SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z); else return SetPlayerPos(playerid,X,Y,Z); |
SetPlayerPos(playerid,....);
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);
LinkVehicleToInterior(vehicleid, interiorid); // This should help ya out