When use the keyword break, it jumps from:
for i, p in ipairs(players) do
if getElementData(p, "Player.ID") == tonumber(ID) then
local x, y, z = getElementPosition(player)
setElementPosition(p, x, y, z)
break -- FROM HERE
else
outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff Rossz ID-t adtál meg.", player, 255, 255, 255, true)
end
end
-- TO HERE
The following code prints: A, D
for i=1, 10 do
if true then
print("A")
break
print("B")
else
print("C")
end
end
print("D")
Run here to test: https://onecompiler.com/lua/42zdspdkb
Not sure what exactly the problem is that you are facing, but in your current code you could also use the return keyword to immediately stop the function.