Loops
#1
i'm currently making a Away-From-Keyboard plugin but i need to check if the player moves. i made this loop:
   PlayerMoved = 0
	repeat
		if not( X == Player:GetPosX() ) and ( Y == Player:GetPosY() ) and ( Z == Player:GetPosZ()) then
			PlayerMoved = 1
			Player:SetName( Name[Player:GetName()] )
			Server:SendMessage( Player:GetColor() .. Player:GetName() .. cChatColor.White .. " is back")
		end
		LOG("TEST")
	until PlayerMoved == 1
but once it starts it never stops. even if i walk. and it kind of destroys the server becouse the server is only working on the loop. does anyone know how to fix it?
btw the X and Y and Z are coordinates that are put in once the player uses /afk

I also used:
while not( X == Player:GetPosX() ) and ( Y == Player:GetPosY() ) and ( Z == Player:GetPosZ()) do
			Player:SetName( Name[Player:GetName()] )
			Server:SendMessage( Player:GetColor() .. Player:GetName() .. cChatColor.White .. " is back")
end
Reply
Thanks given by:


Messages In This Thread
Loops - by NiLSPACE - 02-18-2013, 04:54 AM
RE: Loops - by FakeTruth - 02-18-2013, 06:44 AM
RE: Loops - by NiLSPACE - 02-18-2013, 06:50 AM
RE: Loops - by FakeTruth - 02-18-2013, 07:06 AM
RE: Loops - by xoft - 02-18-2013, 08:20 AM



Users browsing this thread: 1 Guest(s)