JeViCo Posted May 21, 2018 Posted May 21, 2018 Hello everyone! Why getServerIp() returns 127.0.0.1 even on dedicated server?
Moderators IIYAMA Posted May 21, 2018 Moderators Posted May 21, 2018 Debug the: response variable. https://wiki.multitheftauto.com/wiki/GetServerIp Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ALw7sH Posted May 21, 2018 Posted May 21, 2018 Did you give your script admin rights? in order for fetchRemote to work
JeViCo Posted July 4, 2018 Author Posted July 4, 2018 solved. SERVER_IP = "127.0.0.1" function getServerIp() return SERVER_IP end fetchRemote("http://checkip.dyndns.com/", function (response) if response ~= "ERROR" then SERVER_IP = response:match("<body>Current IP Address: (.-)</body>") or "127.0.0.1" end end ) i used SERVER_IP variable after fetchRemote function. I used it inside of function and it solved my problem
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now