SA-MP Forums Archive
Dynamic Checkpoints problem - 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: Dynamic Checkpoints problem (/showthread.php?tid=482263)



Dynamic Checkpoints problem - Gilbonzo - 20.12.2013

Hello everyone I am having problem with these checkpoints the thing is that whenever I am near a point I want that there will appear the checkpoint at the point where I am near to, but unfortunately it doesn't even appear. Okay so when the checkpoint should appear and whenever I go away from the checkpoint I want it to be deleted or destroyed however when I am coming to the point the server just start lagging as hell. here the code:




Код:
public OnPlayerUpdate(playerid)
{
	new Float:X, Float:Y, Float:Z;
	for(new o = 1; o<1000; o++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5, hInfo[o][hEx], hInfo[o][hEy], hInfo[o][hEz]) && AtHouse[playerid] == 0)
		{
			X = hInfo[o][hEx];
			Y = hInfo[o][hEy];
			Z = hInfo[o][hEz];
			AtHouse[playerid] = CreateDynamicCP(hInfo[o][hEx], hInfo[o][hEy], hInfo[o][hEz], 1, -1, -1, -1, 100);
		}
		if(!IsPlayerInRangeOfPoint(playerid, 5, X, Y, Z) && AtHouse[playerid] != 0)
		{
			DestroyDynamicCP(AtHouse[playerid]);
			DisablePlayerCheckpoint(playerid);
		}
	}
}
Any help is appreciated! If you need my code in OnPlayerEnterDynamicCP just tell me.


Re: Dynamic Checkpoints problem - HardRock - 20.12.2013

The server is creating for you 1000 CreateDynamicCP.


Re: Dynamic Checkpoints problem - Gilbonzo - 20.12.2013

Yea thats what I actually though, but I have tried other way but none of them worked so I ended up in this which still isn't working.


Re: Dynamic Checkpoints problem - Gilbonzo - 20.12.2013

Okey I have fixed this problem thank you HardRock for replying it helped me to fix the problem. Just had to do own variable for the CP so that it created only 1 CP instead of 1000.