'LinKin Posted May 18, 2014 Posted May 18, 2014 Hello, I want to check if the server that runs a script is allowed to use it. addEventHandler("onResourceStart", resourceRoot, function() local serverIP = getServerIP() -- If only this existed.. dbC = dbConnect( "mysql", "dbname=frank;host=1.2.3.4", "username", "password", "share=1" ) local query = dbPoll ( dbQuery ( dbC, "SELECT * FROM servers WHERE ip=?", serverIP ), -1 ) if ( query and type ( query ) == "table" ) then outputChatBox("This server can use this script!") else outputChatBox("This server cannot use this script!") end end) But, as far as I know, it's kinda impossible to get the server's IP.. So I'm looking for an alternative way, any suggestions? Thanks.
WASSIm. Posted May 18, 2014 Posted May 18, 2014 you can use this function --By MJNONFIK function getServerIp() callRemote("http://www.nub.hj.cx/getServerIp.php", function(value) if (value ~= "ERROR") then return value end end) return false end
xXMADEXx Posted May 19, 2014 Posted May 19, 2014 Oh..Have you tried it? Is it trustable? There isn't very much a person could do on the web-side with callRemote...
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