Teleport WITH a vehicle
#1

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!
Reply
#2

use GetPlayerVehicleID(); and SetVehiclePos();
Reply
#3

Код:
	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...
Reply
#4

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.
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)