SA-MP Forums Archive
Teleport vehicle to player. - 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)
+--- Thread: Teleport vehicle to player. (/showthread.php?tid=522738)



Teleport vehicle to player. - Kratory - 29.06.2014

Im trying to make a command that brings a car (by giving its id) to the player.
їAny idea?


Re: Teleport vehicle to player. - luis_mendoza - 29.06.2014

Example:

pawn Код:
new Float:X, Float:Y, Float:Z, carid;
GetPlayerPos(playerid, X, Y, Z);
SetVehiclePos(carid, X,Y,Z);
So with the carid maybe you can already do it by yourself .


Respuesta: Teleport vehicle to player. - Leon9741 - 29.06.2014

ZCMD:
pawn Код:
CMD:car(playerid, params[])
{
        new vehicleID;
        if(!sscanf(params, "i", vehicleID))          // ask for vehicle ID
        {
              new Float:x, Float:y, Float:z;
              GetPlayerPos(playerid, x, y, z);         // Get player Pos
              SetVehiclePos(vehicleID, x+15, y, z);   // Set vehicle pos
              LinkVehicleToInterior(vehicleID, GetPlayerInterior(playerid));  // Set vehicle interior
              SetVehicleVirtualWorld(vehicleID, GetPlayerVirtualWorld(playerid));  // Set VW
              SendClientMessage(playerid, -1, "Here is your car!");       // Msg
        }
        return 1;
}



Re: Teleport vehicle to player. - Kratory - 29.06.2014

I have a .ini system to save and load vehicle data.
So... їHow can i get the vehicle pos from there?

Thanks!