ULX

Author Topic: ULX Unban  (Read 13040 times)

0 Members and 1 Guest 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]
ULX Unban
« on: July 18, 2006, 03:45:19 PM »
From a post made in General Help and Support, I realised ULX 1.13 had no 'unban' command.
Either place the following code into a file such as gmod9/lua/ulx/modules/ulx_unban.lua (Recommended)
or, place this in your gmod9/lua/ulx/ulx_utils.lua file (NOT recommended, ULX v1 updates/re-installs would overwrite)

Code: [Select]
-- cc_ulxUnBan - responds to ulx_unban <user> or <steamid>, unbans the specified player/steamid
function cc_ulxUnBan( userid, args, argv, argc )
    if argv[1] == nil then
        return
    end
    if (string.find (argv[ 1 ],"STEAM",1,true) ~= nil) then
    local unbanid = argv[1]
    end
    if unbanid == nil then
      local target = getUser( userid, argv[1] )
        if target == nil then -- something really went wrong. Panic out.
        _PrintMessage(userid, HUD_PRINTCONSOLE, "Incorrect user or parameters. Make sure proper user, or STEAM is all caps.")
        return
        else
            if _PlayerInfo( target, "connected" ) then
             _ServerCommand( "removeid " .. _PlayerInfo( target, "networkid" ) .. ";writeid\n" )
             ulx_log( "Admin " .. ulx_playerString( userid ) .. " unbanned player " .. ulx_playerString( target ) )
            end
        end
    else
        _ServerCommand( "removeid " .. unbanid .. ";writeid\n" )
ulx_log( "Admin " .. ulx_playerString( userid ) .. " unbanned steamid " .. ulx_playerString( unbanid ) )
     end

end

ULX_CONCOMMAND( "ulx_unban", cc_ulxUnBan, ACCESS_BAN, "[user] or [STEAM:ID:BLAH] - unbans the specified player ", 1, "!unban" )

If the person isn't currently on your server (either you've kicked or they've left), you MUST know the SteamID of the user to remove.
Change the 'ACCESS_BAN' in the last line to something requiring higher access if you want.

This is untested code. Let me know if it doesn't work. Please, not "This doesn't work"
Let me know exact errors/details if any.

Edit 1: Removed ulx_PlayerString per Megiddo's reply. Thanks!
« Last Edit: July 18, 2006, 07:25:18 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: ULX Unban
« Reply #1 on: July 18, 2006, 06:26:06 PM »
Very good!

One thing I noticed, though, you need to remove ulx_playerString() from "_ServerCommand( "removeid " .. ulx_playerString( unbanid ) .. ";writeid\n" )". ulx_playerString is used for logging, it won't work on commands.
Experiencing God's grace one day at a time.

Offline JINX

  • Newbie
  • *
  • Posts: 11
  • Karma: -2
Re: ULX Unban
« Reply #2 on: August 04, 2006, 12:24:01 PM »
this is the last thing i want,when i have a deathmatcher in the server ive got ban,and i use it without hesitation

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Unban
« Reply #3 on: August 04, 2006, 02:41:33 PM »
Heh, I'm pretty much the same way, but I've seen one or two here, and one or two in FP forums, ask how to unban using ULX, so I threw it together.

As for DMers, why don't you "gm_sv_pvpdamage 0" in your server.cfg?
This still allows player damage (I forget, gm_sv_playerdamage I think) for self mutilation/builds to kill, etc, but doesn't allow other players to use weapons/projectiles to cause damage.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline The Jeff

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: ULX Unban
« Reply #4 on: August 11, 2006, 02:39:14 PM »
For me it doesnt work, I type the steam id perfectly, and it doesnt unban. could you please tell me how to unban the manuel way?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Unban
« Reply #5 on: October 29, 2006, 12:01:20 PM »
Got a private message today. Also didn't see Jeff's post from months ago.
Sorry.

Quote from: maaarten
hi jammir,

your unban plugin for ULX doesn't work. When I use the command i get this message:

Quote
Sorry, I couldn't find the user you wanted to perform that action on!
Incorrect user or parameters. Make sure proper user, or STEAM is all caps.
does this plugin read from the cfg/banned_user.cfg file?

I hope you can fix this,

 thanks :)


First of all, what version of ULX are you using? This script was meant and, in its current variables code form, would only work in ULX 1.13 (and probably some versions lower. This will not work with ULX => 2

Second, what did you type to unban someone? Exactly as you typed it, please.
Did you use a player name? If so, were they connected to your server at the time?
This script won't look up playernames who have left/been kicked.
If you used steamid, did you capitalize STEAM:#:#####.
I didn't write in error checking to make sure whoever uses it did, and it must be in caps.

This script doesn't read any particular file, it reads whatever is in your ban list memory at the time...once it removes someone from the list, it writes to your default banned id list, which, yes, is normally banned_user.cfg

So, quick summary...
what version of ULX are you using?
Did you use a player name?
If so, were they connected to your server at the time?
If you used steamid, did you capitalize STEAM:#:##### ?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline maaarten

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
Re: ULX Unban
« Reply #6 on: October 29, 2006, 02:39:54 PM »
I have ULX 1.13
used both !unban STEAM_#:#:##### and ulx_unban STEAM #:#:#####. They both din't work,
I get that message: sorry, I couldn't find that user ....