SA-MP Forums Archive
Teleport WITH a vehicle - 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: Teleport WITH a vehicle (/showthread.php?tid=143077)



Teleport WITH a vehicle - Pawno_Master - 21.04.2010

Hello..
I made a script..

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/enter", cmdtext, true, 10) == 0)
	{
	  if(IsPlayerInRangeOfPoint(playerid,2.0,135.2182,1950.1426,19.3887))
		{
	  GetPlayerVehicleID(playerid);
	  SetPlayerPos(playerid,134.6227,1934.9200,19.2617);
		}
		return 1;
	}
	if (strcmp("/exit", cmdtext, true, 10) == 0)
	{
	  if(IsPlayerInRangeOfPoint(playerid,2.0,134.6227,1934.9200,19.2617))
	  {
	  GetPlayerVehicleID(playerid);
	  SetPlayerPos(playerid,135.2182,1950.1426,19.3887);
	  SetTimerEx("omgomg",1000,false,"i",4);
	  }
	  return 1;
	}
	if (strcmp("/tp", cmdtext, true, 10) == 0)
	{
	  GetPlayerVehicleID(playerid);
	  SetPlayerPos(playerid,135.2182,1950.1426,19.3887);
    SetTimerEx("omgomg",1000,false,"i",4);
	  return 1;
	}
	return 0;
}
public omgomg(playerid, vehicleid)
{
	PutPlayerInVehicle(playerid, vehicleid, 0);
	return 1;
}
It works alright, but this is what I want..
If the player is in a vehicle then he'll teleport to the place with his old vehicle, not leaving it there and tp there on foot.
The script needs to check in wich vehicle he is and then put him in it, but I can't do it.
Could any of you tell me how to do it?
Thank you!


Re: Teleport WITH a vehicle - Goobiiify - 21.04.2010

use GetPlayerVehicleID(); and SetVehiclePos();


Re: Teleport WITH a vehicle - fishnutslol - 21.04.2010

Код:
	if(!strcmp(cmdtext,"/teleport",true))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
	      SetVehiclePos(GetPlayerVehicleID(playerid), -239.2781,132.0149,1.3720);
	      SetVehicleZAngle(GetPlayerVehicleID(playerid),285.4021);
	    }
	    else
	      {
	        SendClientMessage(playerid, 0xFF000FF, "ERROR: You need to be the driver!");
	        return 1;
	      }
	  }
	  else
	    {
	      SetPlayerPos(playerid, -239.2781,132.0149,1.3720);
	      SetPlayerFacingAngle(playerid, 285.4021);
	    }
	  return 1;
	}
Do not know if this will help you, it is what I have in one of my random scripts I make to fuck around...


Re: Teleport WITH a vehicle - Pawno_Master - 21.04.2010

It's more that I need a /enter command for everyone in the vehicle.
if they /enter, they'll get IN area 51, WITH their vehicle.
Not without it.
/exit the same.


Re: Teleport WITH a vehicle - Pawno_Master - 21.04.2010

Nevermind, I did it with your example script, thanks!