SA-MP Forums Archive
OnPlayerEnterDynamicCP - 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: OnPlayerEnterDynamicCP (/showthread.php?tid=612543)



OnPlayerEnterDynamicCP - Penguin1997 - 19.07.2016

Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 100
new PizzaCheckpointP[MAX_PLAYERS][2];
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	if(checkpointid == PizzaCheckpointP[playerid][0])
	{
         DestroyDynamicCP(PizzaCheckpointP[playerid][0]);
         SCM(playerid,-1,"Welcome");
		return 1;

	}
	if(checkpointid == PizzaCheckpointP[playerid][1])
	{
         DestroyDynamicCP(PizzaCheckpointP[playerid][1]);
         SCM(playerid,-1,"Welcome again.");
         }
		return 1;

	}
CMD:pizza(playerid)
{
switch(random(2))
{
case 0:
{
PizzaCheckpointP[playerid][0] = CreateDynamicCP(1830.7069,-1842.7400,13.5781,4,5,0,playerid,100);
SetPlayerMapIcon(playerid, 1, 1830.7069,-1842.7400,13.5781, 19, 0, MAPICON_GLOBAL);
}
case 1:
{
PizzaCheckpointP[playerid][1] = CreateDynamicCP(1135.1553,-2035.6575,69.0078,4,5,0,playerid,100);
SetPlayerMapIcon(playerid, 1, 1135.1553,-2035.6575,69.0078, 19, 0, MAPICON_GLOBAL);
}
}
return 1;
}
Anyone knows what's wrong in this code, it usually work fine but later when people start going in and out of checkpoint for minutes, it becomes unusable and disappears.