25.05.2013, 10:36
how to make teleport like enter the police station by pressing "enter" ?
#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;
}