Dynamic Checkpoints problem
#1

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.
Reply
#2

The server is creating for you 1000 CreateDynamicCP.
Reply
#3

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.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)