Jump to content

Search the Community

Showing results for tags 'getserverip'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. I'm having problems trying to use getServerIp() and it returns the default 127.0.0.1, because the function it's requesting is apparently starting before fetchRemote gets the IP, I tested it in a separate resource and it works fine, but I wanted to use everything in just one resource. Example like this return the default 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) function ipTesting() if connection then --local serverIp = getServerConfigSetting("serverip") // I don't understand why it doesn't return the real IP when the ip in mtaserver is set to auto (it would be less stressful getServerConfigSetting("serverip") to return the IP of the server even though it is set to auto) local serverIp = getServerIp() if serverIp then print(serverIp) --[[ Result 127.0.0.1 ]]-- end end When I add a SetTimer to wait for fetchRemote to return the value I get the server IP without any problems Does anyone know of a way to resolve this? I specifically need to receive the IP when starting the resource and I was only able to do it through an external resource, I wanted to do everything in just one file, help me
×
×
  • Create New...