Teleporting cars with the player to interiors...
#1

Okay well I've successfully made the teleport work but my car turns invisible when I get there? I made this:

Код:
 if(!strcmp(cmdtext,"/teleport4",true))
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
      SetVehiclePos(GetPlayerVehicleID(playerid), -1394.20, 987.62, 1023.96);
      SetPlayerInterior(playerid, 15);
    }
    else
      {
      SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
      SetPlayerInterior(playerid, 15);
      return 1;
      }
  }
  else
    {
      SetPlayerPos(playerid, -1394.20, 987.62, 1023.96);
    }
  return 1;
}
Is there like a SetVehicleInterior or something?

Thanks, Anthony.
Reply
#2

https://sampwiki.blast.hk/wiki/LinkVehicleToInterior
Reply
#3

Heres a piece of what i use

above ongamemodeinit;
Код:
new bloodring1;
then where you put all vehicles..
Код:
	bloodring1 = AddStaticVehicle(502,-2175.7319,-382.5894,35.3296,179.9471,6,8); // carstadium2
	LinkVehicleToInterior(bloodring1, 15);
Reply
#4

Quote:
Originally Posted by еddy
Thank you I finished it and it works.
Reply
#5

if you want to add cars to an interior from the startup of your script:

Код:
forward LinkCars();
//put here all your car defines:Example new Car1;

//then put them on the specified car " Car1 = AddStaticVehcile(.......

OnGameModeInit();
{
//all your stuff here then this
LinkCars();
return 1;
}

public LinkCars()
{
	//here put the links EXAPMPLE: LinkVehicleToInterior(Car1, 15);
	return 1;
}
The command you asked for:


Код:
if(!strcmp(cmdtext,"/teleport4",true))
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
      new Car;
      Car = GetPlayerVehicleID(playerid);
      LinkVehicleToInterior(Car,15);
      SetVehiclePos(GetPlayerVehicleID(playerid), -1394.20, 987.62, 1023.96);
      SetPlayerInterior(playerid, 15);
    }
    else
      {
      SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
      SetPlayerInterior(playerid, 15);
      return 1;
      }
  }
  else
    {
      SetPlayerPos(playerid, -1394.20, 987.62, 1023.96);
    }
  return 1;
}
The Addition of:
Код:
new Car;
Car = GetPlayerVehicleId(playerid);
will detect the car the player is in at the time.
boeile's version can only allow THAT car to be TP'ed into the arena with the player.

Not sure if it works...... but you could try


EDIT: Tested, works
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)