There are actually a few methods for doing this
Code:
local Messages = {}
-- Method 1
local i = 1
local NetworkString = true
while NetworkString do
NetworkString = util.NetworkIDToString(i)
Messages[NetworkString] = true
i = i + 1
end
-- Method 2
for i = 1, math.huge do
local str = util.NetworkIDToString(i)
if not str then break end
Messages[str] = true
end
-- Method 3
local i = 1
local NetworkString = true
repeat
NetworkString = util.NetworkIDToString(i)
Messages[NetworkString] = true
i = i + 1
until not NetworkString
Personally I'd use the second method but all three do the same thing.
Also there's no need to use the server's IP in the created file's name, use GetHostName. It'll make it way easier to find if you join a shit ton of servers.