SA-MP Forums Archive
Veh Teleport with 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Veh Teleport with player (/showthread.php?tid=236836)



Veh Teleport with player - wheelman_WM - 08.03.2011

Hey I WANT that when player teleport if he is in vehicle than vehicle must be teleported with him.

Код:
  				if(listitem == 1)
				{
				SetPlayerPos(playerid,2779.6001,-2010.7078,13.5547);
				SendClientMessage(playerid, COLOR_GREEN, "You Have Been Teleported To Los Santos");
				dm1[playerid]=1;
				dm1[playerid]=1;
				}



Re: Veh Teleport with player - yoan103 - 08.03.2011

here's my script

pawn Код:
if (strcmp("/test", cmdtext, true, 5) == 0)
    {
    if (IsPlayerInAnyVehicle(playerid)) {
    SetVehiclePos(GetPlayerVehicleID(playerid), 242.5267, 5267.5267, 6178.6327);
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(string, sizeof(string), "%s has gone to /test.", pname);
  SendClientMessageToAll(COLOR_GREEN, string);
    }
    return 1;
    }
just change the coordinates to yours


Re: Veh Teleport with player - tuuker - 08.03.2011

Easy
pawn Код:
if(listitem == 1)
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            SetVehiclePos(GetPlayerVehicleID(playerid),242.5267, 5267.5267, 6178.6327);
        }
        else
        {
            SetPlayerPos(playerid,242.5267, 5267.5267, 6178.6327);
            SendClientMessage(playerid, COLOR_GREEN, "You Have Been Teleported To Los Santos");
            dm1[playerid]=1;
            dm1[playerid]=1;

        }
        return 1;
    }



Re: Veh Teleport with player - yoan103 - 08.03.2011

yeah, just like that


Re: Veh Teleport with player - Davz*|*Criss - 08.03.2011

Right like that wheelman.


Re: Veh Teleport with player - HyperZ - 08.03.2011

No need for spam in the script.
I suggest you to use this:
pawn Код:
SetPlayerPosVeh(playerid,Float:x,Float:y,Float:z,interior)
{
    new VehicleID = GetPlayerVehicleID(playerid);
    new gState= GetPlayerState(playerid);
    SetPlayerInterior(playerid,interior);
    if(gState== PLAYER_STATE_DRIVER) return SetVehiclePos(VehicleID,x,y,z);
    SetPlayerPos(playerid,x,y,z);
    return 1;
}
Example:
pawn Код:
SetPlayerPosVeh(playerid,x,y,z,interior);
pawn Код:
SetPlayerPosVeh(playerid,2779.6001,-2010.7078,13.5547,/*interior*/0)