Teleporting a vehicle with me
#1

Hi, I want wondering how I could tp to a certain location and if I was in a vehicle it teleports that to?
Reply
#2

Quote:
Originally Posted by Lee_Percox
Посмотреть сообщение
Check before setting the position if a player is in a vehicle.
use: https://sampwiki.blast.hk/wiki/Function:...erInAnyVehicle

If he is, then set the vehicle position with: https://sampwiki.blast.hk/wiki/SetVehiclePos

Simples.
https://sampforum.blast.hk/showthread.php?tid=269555
Reply
#3

It's not a vehicle with an ID though, it's one I've spawned
Reply
#4

Every car have ID.
This is the simple code:
pawn Код:
CMD:goto(playerid,params[])
{
    new toplayerid;
    if(sscanf(params,"r ",toplayerid)) return SendClientMessage(playerid,SYellow,"Usage: /goto <playerid/name> ~To teleport to certain player.");
    else
    {
        new Float:Pos[3];
        GetPlayerPos(toplayerid,Pos[0],Pos[1],Pos[2]);
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vid = GetPlayerVehicleID(playerid);
            SetVehiclePos(vid,Pos[0],Pos[1],Pos[2]);
            PutPlayerInVehicle(playerid,vid);
        }
        else SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)