local servername = string.Replace( game.GetIPAddress(), ":", " Port.") --Gets the IP of the server local numberofnetworkids = math.huge --Looks for network strings up to 2 to the power of 1024(i think?). You can change this if you're crashing when you run this or some shit. file.CreateDir("NetCheck") --the dictionary where it'll save the things. Will save in the data folder inside of the garrys mod folder.
for i = 1, numberofnetworkids, 1 do if util.NetworkIDToString(i) == nil then --If the NetworkID doesn't exist, it returns nil, so.. break --If the NetworkID doesn't exist, we just skip it. else if i == 1 then --Making sure we don't just write one line. file.Write( "NetCheck/"..servername..".txt", "\r\n".."Network String: "..util.NetworkIDToString(i).." | Network ID: "..i.."\r\n" ) else --Write the network strings and ids to a file. file.Append( "NetCheck/"..servername..".txt", "\r\n".."Network String: "..util.NetworkIDToString(i).." | Network ID: "..i.."\r\n") end end end
print( "\nSuccessfully saved network strings to data/NetCheck...\n" )