Won't Spawn back to CP - 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: Won't Spawn back to CP (
/showthread.php?tid=594494)
Won't Spawn back to CP -
CrazyChoco - 18.11.2015
Hello, I made a CP where you spawn in a new pos, and then can get TP'ed back but I probably made an error which i can't find.. Any help?
pawn Код:
new SpawnCP[MAX_PLAYERS][2];
new EnterCheckpoint[80];
new ExitCheckpoint[80];
//OnGameModeInit
EnterCheckpoint[0] = CreateDynamicCP(2194.9414,1991.0286,12.2969, 1.0, 0, 0, -1, 25.0); //24/7 Shop enter
ExitCheckpoint[0] = CreateDynamicCP(-25.8452,-188.2372,1003.5469, 1.0, 1, 17, -1, 25.0); //24/7 Shop Exit
public OnPlayerSpawn(playerid)
{
SpawnCP[playerid][0] = 0;
SpawnCP[playerid][1] = 0;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
/*Enters*/
if(checkpointid == EnterCheckpoint[0]) //24/7
{
if(SpawnCP[playerid][0] == 0)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid, 17);
SetPlayerPos(playerid, -25.8452,-188.2372,1003.5469);
SetCameraBehindPlayer(playerid);
SpawnCP[playerid][1] = 1;
return 1;
}
}
if(checkpointid == ExitCheckpoint[0]) //24/7
{
if(SpawnCP[playerid][1] == 0)
{
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2194.9414,1991.0286,12.2969);
SetCameraBehindPlayer(playerid);
SpawnCP[playerid][0] = 0;
return 1;
}
}
}
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == EnterCheckpoint[0])
{
SpawnCP[playerid][0] = 0;
return 1;
}
if(checkpointid == ExitCheckpoint[0])
{
SpawnCP[playerid][1] = 0;
return 1;
}
return 1;
}
Re: Won't Spawn back to CP -
vassilis - 18.11.2015
i would like to learn what is this?
SpawnCP[playerid][0] = 0;
are you trying to use a boolean?
Re: Won't Spawn back to CP -
CrazyChoco - 18.11.2015
Well more like a variable, so it wouldn't loop me in the checkpoints, when i enter it at the beginning..
EDIT: Kinda like a boolean i suppose..
Re: Won't Spawn back to CP -
CrazyChoco - 19.11.2015
Any ideas.. anybode?