SA-MP Forums Archive
Teleporting to Custom Interior - 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: Teleporting to Custom Interior (/showthread.php?tid=176513)



Teleporting to Custom Interior - doo2002 - 13.09.2010

I created a Custom Interior and I want to be able to walk to a door and automatically teleport to that location. I just made an interior up in the sky somewhere and I want to teleport there. Help?


Re: Teleporting to Custom Interior - LarzI - 13.09.2010

IsPlayerInRangeOfPoint
SetPlayerPos
(SetPlayerInterior)


Re: Teleporting to Custom Interior - doo2002 - 13.09.2010

ok? care to show alittle more details?


Re: Teleporting to Custom Interior - LarzI - 13.09.2010

If you look up the syntax of those functions, you'll get your details.


Re: Teleporting to Custom Interior - doo2002 - 13.09.2010

Ok thanks


Re: Teleporting to Custom Interior - doo2002 - 14.09.2010

Ok, I tried to create this code but it didn't work. Can anyone help?

Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 2737.0888671875, -2799.9736328125, 23.703699111938))
    {
    SetPlayerPos(playerid, 2738.8181152344, -2875.5883789063, 308.98538208008);
    return 1;
	}
if(IsPlayerInRangeOfPoint(playerid, 1.0, 2738.8181152344, -2871.5883789063, 308.98538208008))
	{
	SetPlayerPos(playerid, 2737.0888671875, -2805.9736328125, 23.703699111938);
	return 1;
	}
return 1;
}



Re: Teleporting to Custom Interior - Rachael - 14.09.2010

OnPlayerSpawn is only called .. surprise surpsise .. when the player spawns.
You need to put your stuff somewhere else.
Maybe in a public function that is called, say every second.

look for SetTimer on the wiki to see how it works.

pawn Код:
public YourCustomFunctionForYourTeleport()
{
     if(IsPlayerInRangeOfPoint( ... ))
     {
        SetPlayerPos( ... );
        SetPlayerInterior( ... );
        SetPlayerVirtualWorld( ... );
        return 1;
      }
      return 1;
}
you could also use CreatePickup() and OnPlayerPickupPickup() to do this, again check the wiki.
Also, if you use an object streamer, remeber to update the streamer before teleporting the player.
Sometimes there are issues with objects created at high altitude, it might be better to add your objects to a pre-existing interior in an alternate vitrual world.

good luck.