Ip address check?

Is there a way to modify an addon or lua script so that it will only work when being executed by a certain IP address or server? I have made some things for DarkRP and to prevent them being stolen or make them harder to be stolen want them to be only able to run on my server.

If anyone is smart enough to steal it they’ll be smart enough to bypass IP Address checks.

This is true, but you could alternatively, if you really wanted, do something like:

[lua]local bFeatureIsEnabled = false
local ValidIP = “98.165.167.157”
local UserIP = “127.0.0.1”

local function callback(contents)
UserIP = contents
if (UserIP == ValidIP)
bFeatureIsEnabled = true
end
end

http.Get(“http://whatismyip.org”, “”, callback)
[/lua]

Require a dll which acts as a wrapper around your Lua code and requires a user/password or IP check or something before it’ll work.

This is pretty the only surefire way.

[editline]05:28PM[/editline]

You can alternatively create some hacky type of algorithm which checks out ONLY to a key that represents your IP address, some type of hash or something. Then again, you’d have to hack up your code pretty badly for it to be thoroughly secure using this hacky method.

Hacky.

Hacky Sack.

Sack.

Would this do, I mean I Don’t want it to be too secure, but just something that would disable the lua script from working on an IP address other than that which the addon is intended for. Would I just put this in the LUA file? Thanks

Well, actually, you’d have to include something like,

[lua]if ( !bFeatureIsEnabled ) then return end[/lua]

, in some/all of your functions.

You’d also have to call the http.Get during something like an Initialize hook. Do your research on the case.