Author Topic: Issue With Bans.txt  (Read 2354 times)

0 Members and 1 Guest are viewing this topic.

Offline Gabriel4321

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Issue With Bans.txt
« on: March 27, 2018, 02:09:46 PM »
My ULib/ULX versions (run "ulx version" in console):
ULib v2.63d (02/16/18)
ULX v3.73d (02/11/18)

Game mode(s) I am having this problem on:
DarkRP

Lua errors shown in console, if any:
"uniqueid "STEAM_1:1:110920747" not found" (not a Lua error, but I have noticed this happening)

Summary:
I expect to find a bans.txt file in my "garysmod/data/ulib" folder, but I don't. The only place my ULib bans are stored is in sv.db. I use an external ban site for appeals and whatnot, and that can copy information just fine. Also, my in-game ban menu displays all bans properly. I can also run "lua_run PrintTable(ULib.bans)" and get a successful return.

Should I have a bans.txt?

Also, I have added something to my banid command in util.lua:

Code: [Select]
    if ULib.bans[steamid] then
        ULib.tsayError( calling_ply, "SteamID already banned", true )
        return
    end

And THAT code doesn't successfully fetch bans consistently (again, there is NO bans.txt).

Please help!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Issue With Bans.txt
« Reply #1 on: March 27, 2018, 04:11:02 PM »
Should I have a bans.txt?

No.
https://github.com/TeamUlysses/ulib/CHANGELOG.md
ULib info for bans moved to SQLite in a recent commit.
Something we've been planning for a long time, and many people have been begging us to do for even longer.
Default Source/Gmod bans files should still exist, including a backup of your bans.txt as bans_backup##.txt

Code: [Select]
    if ULib.bans[steamid] then
        ULib.tsayError( calling_ply, "SteamID already banned", true )
        return
    end
You likely don't want to do that, even if you could get it working consistently.
Say you or someone with less permissions does a temporary ban. 10 minutes.
In that 10 minutes, you/someone with banid access finds troublemaker did enough bad things that you want to permaban.
You'd have to wait until temp ban was over.
Or vice versa. Someone permaban. You as admin find out friends account hacked and are working to fix. Find they were drinking and just need to sleep it off.
You have to go through trouble of removing ban totally, then rebanning temporarily.


« Last Edit: March 27, 2018, 04:28:30 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Gabriel4321

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Re: Issue With Bans.txt
« Reply #2 on: March 27, 2018, 05:02:02 PM »
I would much rather have to take the time to unban then reban a SteamID rather than filling up my ban site with tons of accidental duplicate bans.

So, in my "garrysmod/addons/ulx/lua/ulx/modules/sh/util.lua," my BanID looks like this:

Code: [Select]
------------------------------ BanID ------------------------------
function ulx.banid( calling_ply, steamid, minutes, reason )
steamid = steamid:upper()
if not ULib.isValidSteamID( steamid ) then
ULib.tsayError( calling_ply, "Invalid SteamID" )
return
end

    if ULib.bans[steamid] then
        ULib.tsayError( calling_ply, "SteamID already banned", true )
        return
    end

local name, target_ply
local plys = player.GetAll()
for i=1, #plys do
if plys[ i ]:SteamID() == steamid then
target_ply = plys[ i ]
name = target_ply:Nick()
break
end
end

if target_ply and (target_ply:IsSuperAdmin() or target_ply:IsAdmin()) then
ULib.tsayError( calling_ply, "This player is immune to banning", true )
return
end

local time = "for #s"
if minutes == 0 then time = "permanently" end
local str = "#A banned steamid #s "
displayid = steamid
if name then
displayid = displayid .. "(" .. name .. ") "
end
str = str .. time
if reason and reason ~= "" then str = str .. " (#4s)" end
ulx.fancyLogAdmin( calling_ply, str, displayid, minutes ~= 0 and ULib.secondsToStringTime( minutes * 60 ) or reason, reason )
-- Delay by 1 frame to ensure any chat hook finishes with player intact. Prevents a crash.
ULib.queueFunctionCall( ULib.addBan, steamid, minutes, reason, name, calling_ply )
end
local banid = ulx.command( CATEGORY_NAME, "ulx banid", ulx.banid, nil, false, false, true )
banid:addParam{ type=ULib.cmds.StringArg, hint="steamid" }
banid:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
banid:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
banid:defaultAccess( ULib.ACCESS_SUPERADMIN )
banid:help( "Bans steamid." )

That doesn't work, although I don't see why not. Could it be an issue with my ban system (https://www.gmodstore.com/scripts/view/3702/rubidium-ban-management)?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Issue With Bans.txt
« Reply #3 on: March 27, 2018, 08:49:45 PM »
Sorry, I really don't see issue with your code.
What do you mean doesn't work? Does our code even fully execute, storing your bans in ULib.bans, or does it get overwritten by Rubidum?
ULib.addbans, and by extension, ULib.banid, is intended to update current bans, and it works to do that.
If Rubidium creates duplicate rows rather than modify existing for the same table, that's not really a ULib or ULX issue, but instead a Rubidium duplicate issue.
I didn't study Rubidium page too closely, nor have access (or want to) it's codebase - does it have lua code that overwrites our functions? If so, that could be part of the issue. It's possible ULib.bans never sees new bans.

As for that "error" you're getting, any idea what's creating it?
It's this person's steam account.
http://steamcommunity.com/id/BeBilly

If it's not anyone you may know, perhaps you have exploit code running that command to unban that steamid every so often.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Gabriel4321

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Re: Issue With Bans.txt
« Reply #4 on: March 30, 2018, 09:56:39 PM »
That SteamID is a banned user's, but it turns out that's not an issue...

A friend of mine gave me this to try, with no success.

Any comments?

Code: [Select]
    local shittySQLResult = sql.Query("SELECT steamid FROM ulib_bans WHERE steamid = " .. util.SteamIDTo64(steamid) )
    if shittySQLResult == not false then
        ULib.tsayError( calling_ply, "SteamID already banned", true )
        return
    end

An Error Has Occurred!

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