Hi guys,
I'm pretty new to rust modding, and I'm not planning on cooking anything hardcore either, just trying to get a quick basic feature done.
I got a neat hook: CanClientLogin, in which I run a webrequest.
The only problem is, the webrequest is async, and regardless of what I do in that scope, any player will be auto allowed in. (Since the main scope ends and therefore allows the connection.)
Any idea on how to solve this issue?
Any help would be much appreciated!Code:function PLUGIN:CanClientLogin(connection) local steamId = rust.UserIDFromConnection(connection) if debug then print(connection.username .. " (" .. steamId .. ") connected") end local flag = false // get to my web based whitelist solution webrequests.EnqueueGet(("fancy nice url" .. steamId), function(code, response) //unnecessary debug stuff print(code) if code == 200 then flag = true end if flag then return else return self.Config.Messages.Rejected end end, self.Plugin) end
Cheers!
Lua, Sync Webrequest?
Discussion in 'Rust Development' started by Mancs, Feb 16, 2015.
-
Wulf Community Admin
That code looks familiar...
The problem with your situation is that the webrequest response happens after they already are logged in, therefore returning anything is pointless. You'd need to kick the player instead once the response is received. -
Hmm, alright let me see if I can solve this.
Another question if I may?
xml parsing by any chance?
If I can get my hands on that, off we go and I can release an experimental compatible steamgroup whitelist plugin -
Wulf Community Admin
Any parsing would need to be done either using regex or whatever libraries/modules/etc that are available in the language you are writing the plugin in.