#1

How to tele the cars example

im in the car if i tele the car will never tele

I want my car tele
Reply
#2

wiki.sa-mp.com/wiki/SetVehiclePos

Example:
pawn Код:
if(strcmp(cmdtext, "/myteleport", true) == 0)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //They are driving a vehicle
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
    }
    else //They are on-foot or a passenger
    {
        SetPlayerPos(playerid, X, Y, Z);
    }
    return 1;
}
Reply
#3

Use my function:
pawn Код:
stock TeleportPlayerTo(playerid, interior, Float:x, Float:y, Float:z, Float:angle)
{
    SetPlayerInterior(playerid, interior);
    if(IsPlayerInAnyVehicle(playerid)){
    new vehicle = GetPlayerVehicleID(playerid);
    SetVehicleVirtualWorld(vehicle, vworld);
    LinkVehicleToInterior(vehicle, interior);
    SetVehiclePos(vehicle, x, y, z);
    SetVehicleZAngle(vehicle, angle);
    SetCameraBehindPlayer(playerid);}else{
    SetPlayerPos(playerid, x, y, z);
    SetPlayerFacingAngle(playerid, angle);
    SetCameraBehindPlayer(playerid);}
}
Reply
#4

Quote:
Originally Posted by lamarr007
Посмотреть сообщение
Use my function:
pawn Код:
stock TeleportPlayerTo(playerid, interior, Float:x, Float:y, Float:z, Float:angle)
{
    SetPlayerInterior(playerid, interior);
    if(IsPlayerInAnyVehicle(playerid)){
    new vehicle = GetPlayerVehicleID(playerid);
    SetVehicleVirtualWorld(vehicle, vworld);
    LinkVehicleToInterior(vehicle, interior);
    SetVehiclePos(vehicle, x, y, z);
    SetVehicleZAngle(vehicle, angle);
    SetCameraBehindPlayer(playerid);}else{
    SetPlayerPos(playerid, x, y, z);
    SetPlayerFacingAngle(playerid, angle);
    SetCameraBehindPlayer(playerid);}
}
Wrong.
if(IsPlayerInAnyVehicle(playerid)) would still detect passengers as well. So if they are driving along with somebody and decide to teleport, the driver of the vehicle will be teleported with them... not very convenient.
Reply
#5

Hm, if you driving with friend and want to teleport to anywhere with him.. I think itґs not wrong
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)