Author Topic: Sourcebans admin integration?  (Read 18137 times)

0 Members and 1 Guest are viewing this topic.

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Sourcebans admin integration?
« on: April 08, 2010, 12:07:45 PM »
As an addendum to my previous questions. I'm more or less wondering if there's anyway to get Ulx to track the admin output through the Sourcebans MySql databases. It'd be a lot easier if Ulx could set up admins from the admin list stored on Sourcebans.

A little background about this:
My current group recently started up our first Gmod server, a sandbox server. Initially, we had Ulx, but it started to become tedious manually installing admins to the users.txt file. We run several TF2 servers, so we already use Sourcebans to keep track of our admins and bans. Since Ulx doesn't, at least to my knowledge, have this support standard, I decided to try out Sourcemod instead. BIG MISTAKE! Sourcemod is basically bare-bones. I mean, it has a GUI derma menu, but it's pretty much completely terrible beyond that. There's no support for gamemode switching, automatic prop removal, or spawn restrictions, among other features it lacks. So I'd love to be able to use Ulx and it'd be completely awesome if it would support some form of Sourcebans admins. I can give you a sample of these files if absolutely necessary.

I can understand why this might be a challenge--Ulx runs independent of Sourcemod, and Sourcebans only supports Sourcemod. But if there's any way to load Sourceban's admin lists into Ulx, I'd appreciate it like you would not believe. Our admin list is quite large, so to manually install all of them would be a pretty big pain in the ass.

Another thought I just had. I don't know if it's possible, but after perusing the forums, I came across a few different threads talking about this. However, they only asked about ban integration, not admin integration, so I assume this hasn't been asked before. I apologize if it has. Anyways, I noticed that you have something called Uban(s). I haven't looked at it, but would this solve the problems I'm currently having? If this is deserving of its own thread, I'll repost it under suggestions/requests. Any help is greatly appreciated. Thanks,

Snowden
« Last Edit: April 08, 2010, 12:24:10 PM by Snowden42 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Sourcebans admin integration?
« Reply #1 on: April 08, 2010, 12:17:37 PM »
It wouldn't be difficult at all. This admin list is in a MySQL database? Just promote users to the appropriate user group when they connect.
Experiencing God's grace one day at a time.

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #2 on: April 08, 2010, 12:23:22 PM »
I'm confused. I understand I can promote in game, but I'd like to set up Ulx to set admins based upon the Sourcebans MySql database. The database is hosted on the same box, so access is pretty simple. I just need some instructions about how to get it to integrate properly. In addition, the Sourcebans admin list is probably not compatible with Ulx without some revision on the part of Ulx. Like I said, I'll pm you a copy of the Sourcebans admin list as output it outputs it as a .txt file.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Sourcebans admin integration?
« Reply #3 on: April 08, 2010, 12:27:06 PM »
By promote I meant programatically. Surely there's some form of groups or level or permissions in Sourcebans that you can translate to an appropriate group. Just decide what group they need to be in when they connect (via lua).
Experiencing God's grace one day at a time.

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #4 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.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Sourcebans admin integration?
« Reply #5 on: April 08, 2010, 12:42:17 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.

You don't have someone in your community that could do this for you?
Experiencing God's grace one day at a time.

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #6 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
« Last Edit: April 08, 2010, 12:58:38 PM by Snowden42 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Sourcebans admin integration?
« Reply #7 on: April 08, 2010, 01:07:49 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

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.
Experiencing God's grace one day at a time.

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #8 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.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Sourcebans admin integration?
« Reply #9 on: April 08, 2010, 01:25:01 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.

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
« Last Edit: April 08, 2010, 01:26:33 PM by Megiddo »
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Sourcebans admin integration?
« Reply #10 on: April 08, 2010, 05:44:24 PM »
Perhaps you could PM the author of this post.
He's mentioned interest in our UCL and SQL.
http://forums.ulyssesmod.net/index.php/topic,4442.msg17765.html
Somewhere around here is the code Megiddo once used to pull admin steamids from SMF database when we had a gmod server too, but I've long lost where the post was.

EDIT - Ah HA! I knew if I used search from the right forum area I'd find it.
http://forums.ulyssesmod.net/index.php/topic,3241.msg9622.html#msg9622
Now, again, that's only example Lua code, pulling from the SMF database.
However, with the links given above, experience with SQL combined with the example, shouldn't be impossible to find the proper Sourcebans admin tables and pull from those/promote the player using Megiddo's ideas.
« Last Edit: April 08, 2010, 05:49:17 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #11 on: April 08, 2010, 05:49:02 PM »
Whatever help you guys can give me is fine. Right now I'm looking through our community for a lua coder to help, and I don't think it's going to materialize.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Sourcebans admin integration?
« Reply #12 on: April 08, 2010, 05:49:41 PM »
See my edit. :)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #13 on: April 08, 2010, 05:58:01 PM »
I took a look, it's definitely a helpful start. I've also got MySql workbench running properly, so I can take a good look at the sourcebans tables.

Offline Snowden42

  • Newbie
  • *
  • Posts: 12
  • Karma: 2
Re: Sourcebans admin integration?
« Reply #14 on: April 10, 2010, 04:36:38 PM »
Well, I've taken this in a new direction. Since I'm much better at PHP, and, at least in my opinion, it's much easier to use, I'm in the process of writing a script that will be run through cron. It's gonna query the Sourcebans database and dump it in the proper format as a .txt file in garrysmod/data/ulib/users.txt

Comments or suggestions? I'm not 100% sure how Ulx works, but I do know this will override any changes made in game, which I'm fine with, as we can just use the database to continue making changes.

This isn't a perfect strategy, but for me it should work. If anyone is interested in the code when I'm finished, I'll gladly share it.