[HELP] Teleports - Read before posting
#3

You are best checking the players state first and then dealing with what you are going to teleport (vehicle, player), this can also be used to stop passengers being able to teleport your vehicle when you don't want to be teleported. It is best to load the interior before setting the position also so you don't fall through the floor in certain interiors.

pawn Code:
if ( !strcmp( "/teleport", cmdtext, true ) )
{
  switch ( GetPlayerState( playerid ) )
  {
    case 2 :
    {
      SetPlayerInterior( playerid, interior );
      LinkVehicleToInterior( GetPlayerVehicleID( playerid ), interior );
      SetVehiclePos( GetPlayerVehicleID( playerid ), x, y, z );
      SetVehicleZAngle( GetPlayerVehicleID( playerid ), angle )
    }
    case 1,3 :
    {
      SetPlayerInterior( playerid, interior );
      SetPlayerPos( playerid, x, y, z );
      SetPlayerFacingAngle( playerid, angle );
    }
    default : return SendClientMessage( playerid, 0xafafafff, "Invalid action" ); //grey
  }
  SendClientMessage( playerid, 0xffffffff, "Welcome to the BLAH teleport" ); //white
  return 1;
}
Reply


Messages In This Thread
[HELP] Teleports - Read before posting - by Zezombia - 25.06.2008, 13:32
Re: [HELP] Teleports - Read before posting - by bFe - 27.07.2008, 12:09
Re: [HELP] Teleports - Read before posting - by Donny_k - 27.07.2008, 12:43
Re: [HELP] Teleports - Read before posting - by AiVAMAN - 27.11.2008, 16:30
Re: [HELP] Teleports - Read before posting - by fff - 27.03.2009, 20:38
Re: [HELP] Teleports - Read before posting - by kevin13 - 30.04.2009, 17:51
Re: [HELP] Teleports - Read before posting - by Weirdosport - 30.04.2009, 17:55
Re: [HELP] Teleports - Read before posting - by MenaceX^ - 30.04.2009, 17:56
Re: [HELP] Teleports - Read before posting - by (LifeStealeR) - 29.08.2010, 11:52
Re: [HELP] Teleports - Read before posting - by megamind2067 - 10.04.2012, 14:48

Forum Jump:


Users browsing this thread: 1 Guest(s)