• timers/think hook/http doesnt work on startup
    13 replies, posted
I am trying to use[B] http.fetch [/B]to check[I] "is current server allowed to use my addon"[/I] on server startup but normally, [B]http.fetch[/B] doesn't work before[B] ISteamHTTP [/B] initialization. I tried using it with [B]think hook[/B] but think hook doesn't work when there is no players in server. Then, I tried it with [B]timer.create[/B] to check it every 1secs, it didn't work too. Also, there is a problem with [B]"game.getipaddress"[/B]. It turns [B]0.0.0.0:27015[/B] on startup. I tried it with like "if not string.explode(":",game.GetIpAddress())[1]=='0.0.0.0' then" but as I said, it didn't work in [B]initialize[/B], in [B]timer[/B] and in [B]think hook[/B]. I need help with this thing, thanks. [B]Initialize hook[/B] [CODE]hook.Add("Initialize", "drmsystem", function() print(game.GetIPAddress()) timer.Simple(5,function() print(game.GetIPAddress()) end) end)[/CODE] The problem with this is, it prints "0.0.0.0:27015" on startup and 5s delayed timer doesnt work at all. [B]Timer[/B] [CODE]timer.Create("drmsystem",1,0,function() print(game.GetIPAddress()) end) [/CODE] This also doesn't work at all.
If you can't even get http.Fetch to work then you really shouldn't be trying to make a DRM system.
[QUOTE=Sean Bean;52348248]If you can't even get http.Fetch to work then you really shouldn't be trying to make a DRM system.[/QUOTE] I can get it work, the problem is I can't get the needs to check if current server is allowed to use. I can't get the servers ip on startup so I can't check if it is allowed to use or not. Also, what you say is not helping me at all.
[QUOTE=gmoddertr;52348260]I can get it work, the problem is I can't get the needs to check if current server is allowed to use. I can't get the servers ip on startup so I can't check if it is allowed to use or not.[/QUOTE] You shouldn't be using an IP to verify a script in the first place.
[QUOTE=Sean Bean;52348305]You shouldn't be using an IP to verify a script in the first place.[/QUOTE] What else do you suggest? Something like authkey? If I use authkey, they can give the authkey to their friends or they can leak it. I need to check how many IPs using this authkey too. As a result, I'll always need to get the IP on startup.
[QUOTE=gmoddertr;52348323]What else do you suggest? Something like authkey? If I use authkey, they can give the authkey to their friends or they can leak it. I need to check how many IPs using this authkey too. As a result, I'll always need to get the IP on startup.[/QUOTE] I suggest not making a DRM system. From the looks of things it's going to be even worse than ScriptEnforcer, and with SecureGmod just around the corner you'll lose business real fast.
[QUOTE=Sean Bean;52348392]I suggest not making a DRM system. From the looks of things it's going to be even worse than ScriptEnforcer, and with SecureGmod just around the corner you'll lose business real fast.[/QUOTE] I'm sorry but you are so dumb to help. Simply, I write something like "HOW CAN I DO IT?", you answer from all other unneccessary subjects. Did you see anything like "I am doing this for bussiness"?. As I can see from ratings of posts, you got some dumb friends too. I hope there is not so many like you on this forum. Please answer if you have some ideas about the subject.
[QUOTE=gmoddertr;52348464]I hope there is not so many like you on this forum.[/QUOTE] There are actually quite a few people with a brain here. You already know TFA and Moku.
[QUOTE=Sean Bean;52348485]There are actually quite a few people with a brain here. You already know TFA and Moku.[/QUOTE] If I'll be like you with a brain, I am glad to not have it. You kids fucked up my subject.
Use a Tick hook. Just make sure to remove it when you're done.
[QUOTE=code_gs;52348795]Use a Tick hook. Just make sure to remove it when you're done.[/QUOTE] Tick hook doesn't work when there is no players too.
It's not working because when SRCDS starts the game runs for a single tick then the main thread sleeps (SRCDS hibernates) until a player / bot joins. There is no native functionality AFAIK to prevent hibernation. A workaround is you can have a bot join in that first tick then kick it after you get the HTTP response.
sv_hibernate_think 1 - Forces the server to think even when hibernating
securegmod killer
Sorry, you need to Log In to post a reply to this thread.