• Remove the port part of the ip ?
    2 replies, posted
Hi, for the moment I use this : [CODE] local IPAddress = string.Explode(":", ply:IPAddress()) IPAddress = IPAddress[1] [/CODE] But I think that thje result is this : 1.0151345.165.1 port I just want this 1.0151345.165.1 [editline]30th July 2015[/editline] Is that good ?
Why don't you just try it? It should work though
[QUOTE=DJlive34;48331040]Hi, for the moment I use this : [CODE] local IPAddress = string.Explode(":", ply:IPAddress()) IPAddress = IPAddress[1] [/CODE] But I think that thje result is this : 1.0151345.165.1 port I just want this 1.0151345.165.1 [editline]30th July 2015[/editline] Is that good ?[/QUOTE] You're trying to assign a string value to an array. [CODE] local tblIPAddress = string.Explode(":", ply:IPAddress()); local strIPAddress = IPAddress[1]; [/CODE] Other than that it should work perfectly: [CODE]] lua_run PrintTable(string.Explode(':', '192.168.0.1:8080')) > PrintTable(string.Explode(':', '192.168.0.1:8080'))... 1 = 192.168.0.1 2 = 8080 ] lua_run print(string.Explode(':', '192.168.0.1:8080')[1]) > print(string.Explode(':', '192.168.0.1:8080')[1])... 192.168.0.1 [/CODE] You might also want to check if the IP isn't 'loopback'
Sorry, you need to Log In to post a reply to this thread.