Help with teleporting in vehicle
#1

pawn Код:
CMD:sfdrift(playerid,params[])
{
    SetPlayerPos(playerid,-1265.1564,-529.1177,13.8084);
}
else
{
    SetVehiclePos(playerid,-1265.1564,-529.1177,13.8084);
}
I want to make it so if the player is on foot, they can teleport there, but if they're in a vehicle they'll also be teleported there with the vehicle, please give me the correct way to put this.
Reply
#2

Search , https://sampforum.blast.hk/showthread.php?tid=195753
Reply
#3

@Kitten Thank you, I'll search first next time.
Reply
#4

i think that this function is better and easier
just use SetPlayerPosWithVehicle(playerid, X, Y, Z);
pawn Код:
stock SetPlayerPosWithVehicle(playerid, Float:X, Float:Y, Float:Z)
{
    new cartype = GetPlayerVehicleID(playerid);
    SetPlayerPos(playerid, X, Y, Z);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        LinkVehicleToInterior(cartype, GetPlayerInterior(playerid));
        SetVehiclePos(cartype,X,Y,Z);
        PutPlayerInVehicle(playerid,cartype,0);
    }
}
Reply
#5

Thank you so much System 64, this works VERY well!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)