[SOLVED]Teleport's. -
Sledgehammer - 23.11.2013
Teleport's Help
Hello, I'm just wondering instead off using command's to enter a building such as:
Код:
COMMAND:enter(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, 2045.4803,-1907.7728,13.5469))//DMV
{
SetPlayerPos(playerid, -2029.7825,-119.6237,1035.1719);
SetPlayerInterior(playerid, 3);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
}
}
You go to a certain area then it teleport's you there with out clicking a key or with out using a command.
P.S- I have been looking over for SA-MP but nothing seems to work.
Thanks in advanced!
Re: Teleports. -
DarkLored - 23.11.2013
Use
OnPlayerEnterCheckpoint callback
here is a link that can help you
https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint
Re: Teleports. -
Sledgehammer - 23.11.2013
Thanks, I'll test this out right now.
Re: Teleports. -
Konstantinos - 23.11.2013
That would work if you used a timer and you checked if the player is in range so you would teleport that player but.. it's better not to use many timers.
I believe that either with a command or a key is fine.
EDIT: What DarkLored suggested is also nice. Streamed checkpoints* though so it won't show in the minimap if you're not streamed to the checkpoint.
*By Incognito's streamer
Re: Teleports. -
Sledgehammer - 23.11.2013
Help:
Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 2, 2045.4803,-1907.7728,13.5469))
{
SetPlayerPos(playerid, -2029.7825,-119.6237,1035.1719);
SetPlayerInterior(playerid, 3);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
}
}
How would 2045.4803,-1907.7728,13.5469 this location TP them to this location -2029.7825,-119.6237,1035.1719
Please help
P.S- OnPlayerEnterCheckPoint didn't TP me no were.
Re: Teleports. -
DarkLored - 23.11.2013
i recommend using streamer plugin
Re: Teleports. -
Spydah - 23.11.2013
you have to create a checkpoint..
Copied from Wiki SA:MP.
pawn Код:
//In this example, a checkpoint is created for the player when spawning,
//which creates a vehicle and disables the checkpoint.
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 2045.4803,-1907.7728,13.5469, 3.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 2, 2045.4803,-1907.7728,13.5469))
{
SetPlayerPos(playerid, -2029.7825,-119.6237,1035.1719);
SetPlayerInterior(playerid, 3);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
}
return 1;
}
Re: Teleports. -
Sledgehammer - 23.11.2013
-I've installed the streamer plugin but it doesn't still work.
EDIT: Ill try it now, one min.
Re: Teleports. -
Konstantinos - 23.11.2013
Quote:
Originally Posted by Death1300
-I've installed the streamer plugin but it doesn't still work.
EDIT: Ill try it now, one min.
|
Include streamer.inc to your script. Use CreateDymanicCP to create the checkpoint.
pawn Код:
CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
When a player enters any dynamic checkpoint, OnPlayerEnterDynamicCP will be called.
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
Note that you should get the checkpointid while creating the dynamic checkpoint and in the callback to check if the checkpointid is the one you created, so teleport the player.
Re: Teleports. -
Spydah - 23.11.2013
Let know if it worked.