ULX

Author Topic: Sourcebans & ULX/ULib  (Read 113521 times)

0 Members and 2 Guests are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Sourcebans & ULX/ULib
« Reply #105 on: September 19, 2013, 02:48:19 PM »
TrulyRazor, my apologies, I've never used either of these projects, but my guess would be - do you have a functioning sourcebans database that this can connect to, with admins in it?
From my understanding, this won't create new database/admins, it only adds bans to an already existing.
Someone more experienced can hopefully help.

Storm,
It's my understanding sourcebans won't run on Gmod, this only connects to a database created by sourcebans.
I'd experienced guestimate that the local Gmod bans file would still remain, as long as you didn't use the (2nd/replace) method from the first post.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline TrulyRazor

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Sourcebans & ULX/ULib
« Reply #106 on: September 23, 2013, 11:28:58 AM »
TrulyRazor, my apologies, I've never used either of these projects, but my guess would be - do you have a functioning sourcebans database that this can connect to, with admins in it?
From my understanding, this won't create new database/admins, it only adds bans to an already existing.
Someone more experienced can hopefully help.

Storm,
It's my understanding sourcebans won't run on Gmod, this only connects to a database created by sourcebans.
I'd experienced guestimate that the local Gmod bans file would still remain, as long as you didn't use the (2nd/replace) method from the first post.

I fixed the issue!

For anyone encountering the Lua Error: [ERROR] addons/ulx/lua/includes/modules/sourcebans.lua:247: attempt to index field 'Select Admin Groups' (a nil value) error,
the thread is misleading. You actually need to replace the code he specified for line 178, not 177. AKA right below this line:
Quote
    ["Select Admin Groups"] = "SELECT flags, immunity, name FROM %s_srvgroups";

So for instance, your code should look like this after you replace line 178:

Quote
local queries = {
    -- BanChkr
    ["Check for Bans"] = "SELECT bid, name, ends, authid, ip FROM %s_bans WHERE (length = 0 OR ends > UNIX_TIMESTAMP()) AND removetype IS NULL AND (authid = '%s' OR ip = '%s') LIMIT 1";
    ["Check for Bans by IP"] = "SELECT bid, name, ends, authid, ip FROM %s_bans WHERE (length = 0 OR ends > UNIX_TIMESTAMP()) AND removetype IS NULL AND ip = '%s' LIMIT 1";
    ["Check for Bans by SteamID"] = "SELECT bid, name, ends, authid, ip FROM %s_bans WHERE (length = 0 OR ends > UNIX_TIMESTAMP()) AND removetype IS NULL AND authid = '%s' LIMIT 1";
    ["Get All Active Bans"] = "SELECT ip, authid, name, created, ends, length, reason, aid  FROM %s_bans WHERE (length = 0 OR ends > UNIX_TIMESTAMP()) AND removetype IS NULL;";
   
    ["Log Join Attempt"] = "INSERT INTO %s_banlog (sid, time, name, bid) VALUES( %i, %i, '%s', %i)";
   
    -- Admins
    ["Select Admin Groups"] = "SELECT flags, immunity, name FROM %s_srvgroups";
--    ["Select Admins"] = "SELECT a.aid, a.user, a.authid, a.srv_group, a.srv_flags, a.immunity FROM %s_admins a, %s_admins_servers_groups g WHERE g.server_id = %i AND g.admin_id = a.aid";
["Select Admins"] = "SELECT a.aid, a.user, a.authid, a.srv_group, a.srv_flags, a.immunity FROM %s_admins a";
   
    -- Bannin
    ["Ban Player"] = "INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid, country) VALUES('%s', '%s', '%s', %i, %i, %i, '%s', %i, '%s', %i, ' ')";
    -- Unbannin
    ["Unban SteamID"] = "UPDATE %s_bans SET RemovedBy = %i, RemoveType = 'U', RemovedOn = UNIX_TIMESTAMP(), ureason = '%s' WHERE (length = 0 OR ends > UNIX_TIMESTAMP()) AND removetype IS NULL AND authid = '%s'";
    ["Unban IPAddress"] = "UPDATE %s_bans SET RemovedBy = %i, RemoveType = 'U', RemovedOn = UNIX_TIMESTAMP(), ureason = '%s' WHERE (length = 0 OR ends > UNIX_TIMESTAMP()) AND removetype IS NULL AND ip = '%s'";
};

Thanks for the help, JamminR!

Offline rainbow Dash

  • Newbie
  • *
  • Posts: 35
  • Karma: -2
  • Owner of Friendship is Gaming Servers
    • Friendship is Gaming
Re: Sourcebans & ULX/ULib
« Reply #107 on: October 02, 2013, 02:37:27 AM »
Storm,
It's my understanding sourcebans won't run on Gmod, this only connects to a database created by sourcebans.
I'd experienced guestimate that the local Gmod bans file would still remain, as long as you didn't use the (2nd/replace) method from the first post.

You are kind of right and wrong here.

Existing bans will still remain, as ULX will still pertain to its bans. When a new ban takes place, ULX does not ban the player (unless the database wont connect) but rather remembers they were banned, and tells the database to add it to the ban list, and then bans them through the banid method.

Web based bans, on the other hand, do not log into ulx at all from what I have seen, they appear to just get added to the ban list on all servers.
Uhm, whats a signature?

Offline rainbow Dash

  • Newbie
  • *
  • Posts: 35
  • Karma: -2
  • Owner of Friendship is Gaming Servers
    • Friendship is Gaming
Re: Sourcebans & ULX/ULib
« Reply #108 on: October 05, 2013, 06:24:07 PM »
There is a serious issue with this addon.

When the addon fails to connect to the database, all bans are forgotten. Players who have been banned can rejoin.

A suggestion to resolve this: Every time the database synchronizes, it saves a local copy of all bans, from which it reads its bans from. Every 30 minutes, it drops its MySQL connection to sourcebans and retries it from scratch to synchronize this database. This way, if the database cannot be retrieved, we still have bans that take effect.
Uhm, whats a signature?

Offline V-Rico

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Sourcebans & ULX/ULib
« Reply #109 on: October 11, 2013, 09:45:08 PM »
So, guys. If you got problems with incorrect symbols in base (like СЛОВО), just add:
Code: [Select]
local query_names = self:query("SET NAMES utf8");
query_names:start();
after
Code: [Select]
function databaseOnConnected(self)

Offline V-Rico

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Sourcebans & ULX/ULib
« Reply #110 on: October 11, 2013, 10:18:45 PM »
And what's about removeing admins from group when admin removes them from sourcebans?

Offline rainbow Dash

  • Newbie
  • *
  • Posts: 35
  • Karma: -2
  • Owner of Friendship is Gaming Servers
    • Friendship is Gaming
Re: Sourcebans & ULX/ULib
« Reply #111 on: November 04, 2013, 11:52:17 PM »
I take it ya ment line 270 as it is the line that says
Code: [Select]
local adminID, adminIP = getAdminDetails(admin);
I changed that to
Code: [Select]
local adminID, adminIP = getAdminDetails(admin) or "";
And done a voteban against myself, I was banned from the server (Lan one), however it still gave the error.
The server did not crash, however as I said it was just a lan based one so it was only me on it, so the lack of 23 other players might have had something to do with that.
It also did not write the ban to sourcebans (it writes them fine using !ban)

This issue is still occuring, but wouldn't it make more sense to be...

Code: [Select]
local adminID, adminIP = getAdminDetails(admin) or "", "";
... I mean, its setting two variables here, not 1, so getAdminDetails(admin) must be returning two values, meaning if you added
Code: [Select]
or ""; you'd be just setting adminID to "" and leaving adminIP undefined.
Uhm, whats a signature?

Offline PAL-18

  • Full Member
  • ***
  • Posts: 142
  • Karma: 1
Re: Sourcebans & ULX/ULib
« Reply #112 on: November 17, 2013, 12:32:47 AM »
I finally got this module working.  After trying some stuff with mysqloo i figured out why it wasnt working for me and this should help others:

Mysqloo asks you to install a lib file (libmysql.dll or libmysql.lib) that you stick in same directory as srcds executable.  My MySQL server version was newer which is why it wasnt working.  You need to install the lib file from the same version of the MySQL server you're using.  Once you figure out the version number, you can download it at http://downloads.mysql.com/archives/community/  The file will be located in the lib folder of the archive.

Offline BlueGhostHD

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: Sourcebans & ULX/ULib
« Reply #113 on: November 18, 2013, 02:00:55 PM »
Is there a way to add the player/user to a specific group on Sourcebans automatically when a player's group is changed in ULX?

Offline PAL-18

  • Full Member
  • ***
  • Posts: 142
  • Karma: 1
Re: Sourcebans & ULX/ULib
« Reply #114 on: November 18, 2013, 03:36:06 PM »
Can this plugin populate the ban tab with bans from sourcebans?
« Last Edit: November 18, 2013, 05:00:26 PM by PAL-18 »

Offline benjanmin112

  • Newbie
  • *
  • Posts: 16
  • Karma: -4
Re: Sourcebans & ULX/ULib
« Reply #115 on: December 22, 2013, 04:14:59 PM »
Can someone help me do this like make a video or something I am really bad at coding and recoding even tho I got the codes or can someone just send sourcebans to me where it is already done thanks :D

Offline Majora

  • Newbie
  • *
  • Posts: 2
  • Karma: 1
Re: Sourcebans & ULX/ULib
« Reply #116 on: December 31, 2013, 09:08:09 AM »
Can someone help me do this like make a video or something I am really bad at coding and recoding even tho I got the codes or can someone just send sourcebans to me where it is already done thanks :D

https://www.youtube.com/watch?v=_b1mHn9OQ0A

It's actually a really handy tutorial someone posted in this thread (Way earlier, I believe). It's what I used to install Sourcebans on my Gmod server, and it works just fine.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given