General > Developers Corner
Sourcebans admin integration?
Megiddo:
--- Quote from: Snowden42 on April 08, 2010, 12:31:55 PM ---Alright, I'm sure what you've said has been very helpful, but I should have prefaced what I asked by saying, I barely understand lua at all. I mean, if I'm given a script, sure I might understand a little of what it's doing, but not to any necessary extent. I presume you're saying that I should keep Sourcemods, so that I can call the admins from it, but beyond that I have no idea how to do this.
--- End quote ---
You don't have someone in your community that could do this for you?
Snowden42:
I don't know, maybe. Since this is our first move into Gmod, most of the people are just regular players. I suppose I could try, but I doubt I'll get anywhere. Where/how does Ulx load admins?
Edit: Nevermind, realized it uses data/ulib/users.txt
Megiddo:
--- Quote from: Snowden42 on April 08, 2010, 12:50:48 PM ---I don't know, maybe. Since this is our first move into Gmod, most of the people are just regular players. I suppose I could try, but I doubt I'll get anywhere. Where/how does Ulx load admins?
Edit: Nevermind, realized it uses data/ulib/users.txt
--- End quote ---
The easiest thing for you would be to just use player:SetUserGroup(). IE, you get a ply object when someone connects... if they belong to superadmin group, do ply:SetUserGroup( "superadmin" ). ULib/ULX will take care of the rest and any other third party mods will recognize the user as a superadmin as well.
Snowden42:
Ugh I'm still really confused. I kind of understand what you're saying, but I don't understand how to use it. The php coder in me is telling me I have to require certain files to make this run properly, but I'm not sure. Furthermore, I don't even know how to execute lua code on join, or how to convert a text document to a file readable by ulx. I apologize again for being so unhelpful.
Megiddo:
--- Quote from: Snowden42 on April 08, 2010, 01:10:30 PM ---Ugh I'm still really confused. I kind of understand what you're saying, but I don't understand how to use it. The php coder in me is telling me I have to require certain files to make this run properly, but I'm not sure. Furthermore, I don't even know how to execute lua code on join, or how to convert a text document to a file readable by ulx. I apologize again for being so unhelpful.
--- End quote ---
You wouldn't want ULX to read the file dump, you'd want to read directly from the SQL database. You can do this by using the sql lib here. To get something to run on player connect using this hook here. Use hook.Add to add your own PlayerConnect hook.
You can think of lua kind of like a huge conglomerate of scripts that are running and working together (in gmod's case though, only on one thread), so there's no need to include or require something if it's already running (IE, don't include ulx/ulib, but DO include mysql since it might not be running elsewhere).
You could try poking around to see if anyone would be willing to make the script for you (either pro bono or for a fee) if you don't want to do it yourself. If you want to try taking it on yourself, I recommend reading up on the following resources (listed in order of importance):
http://www.lua.org/pil/ -- Lua tutorial (written for Lua 5.0, but still works find for 5.1)
http://www.lua.org/manual/5.1/ -- Lua reference manual for looking up specific functions
http://ulyssesmod.net/docs/ -- The ULib documentation
http://wiki.garrysmod.com/?title=Lua -- The Gmod lua documetation
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version