how to make teleport checkpoint ? - 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)
+--- Thread: how to make teleport checkpoint ? (
/showthread.php?tid=439394)
how to make teleport checkpoint ? -
Craker - 25.05.2013
how to make teleport like enter the police station by pressing "enter" ?
Re: how to make teleport checkpoint ? -
Knappen - 25.05.2013
You will have to get the coords of the place you want them to use it, and then use OnPlayerKeyStateChange to detect what keys the player is pressing. I would recommend F though, instead of enter. That would be "KEY_SECONDARY" in pawn.
Re: how to make teleport checkpoint ? -
Guest123 - 25.05.2013
dude what you want
how to make teleport checkpoint ?
or
how to make teleport like enter the police station by pressing "enter" ?
Re: how to make teleport checkpoint ? -
Mattakil - 25.05.2013
One thing I would suggest would be to use 3dlabels as markers instead of checkpoints. Put the setplayerpos under OnPlayerKeyStateChange
Re: how to make teleport checkpoint ? -
Pottus - 25.05.2013
I would suggest using Incognito`s streamer located here
https://sampforum.blast.hk/showthread.php?tid=102865 and my sub-streamer include here
https://sampforum.blast.hk/showthread.php?tid=423622
Simply do this for any number of areas.
Please note this is intended if you plan on using a lot of teleports which won't really affect performance even with hundreds.
pawn Код:
#include <dynamiccp>
#define POLICE_STATION 0
new CurrCP[MAX_PLAYERS] = { INVALID_CP_ID, ... };
public OnGameModeInit()
{
AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "PoliceStation");
}
OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(CurrCP[playerid] != INVALID_CP_ID)
{
switch(CurrCP[playerid])
{
// Teleport code for each check point goes in here
case POLICE_STATION:
{
SetPlayerPos(playerid, 100.0, 100.0, 100.0);
SetPlayerFacingAngle(playerid, 90);
}
}
}
}
}
OnCheckPoint:PoliceStation(playerid, cpid, cpindex)
{
CurrCP[playerid] = POLICE_STATION;
}
ExitCheckPoint:PoliceStation(playerid, cpid, cpindex)
{
CurrCP[playerid] = INVALID_CP_ID;
}
public OnPlayerDisconnect(playerid)
{
CurrCP[playerid] = INVALID_CP_ID;
}