ULX

Author Topic: Broken compatability with uban  (Read 2859 times)

0 Members and 1 Guest are viewing this topic.

Offline trab

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • ICannt.org
Broken compatability with uban
« on: December 28, 2009, 09:33:19 AM »
Hello,

It appears that the uban console commands [gban, gbanid etc.] are refusing to work with ULib r94 / ULX r80 on a test server that I am running.

I would have no idea if the module is even loading due to console buffer overflows that our servers get when loading ULib / ULX so I can not see the module load output.

Is it compatible at all or broken with the above mentioned SVN revisions?
|IC| Sub-Zero - ICannt.org Senior Admin

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Broken compatability with uban
« Reply #1 on: December 28, 2009, 10:03:22 AM »
Could be broken, I'll check into it.
Experiencing God's grace one day at a time.

Offline trab

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • ICannt.org
Re: Broken compatability with uban
« Reply #2 on: December 29, 2009, 12:15:08 AM »
Thanks man!

On testing I think it is actually more to do with the ulx.concommand function.

I made a quick copy of the command named ulxgban done with the internal concommand.Add() function:

Code: [Select]
ulx.concommand( "gban", cc_gban, "<user(s)> [<time>] [<comment>] - Globally bans a user, time is in minutes. 0 or blank for perma.", ULib.ACCESS_SUPERADMIN, "!gban", _, ulx.ID_PLAYER_HELP )
concommand.Add( "ulxgban" , cc_gban )

The result:

Code: [Select]
] ulx gban sub
Invalid command entered. If you need help, please type "ulx help" in your console.
] ulxgban sub
Global ban successful
|IC| Sub-Zero global banned |IC| Sub-Zero<STEAM_0:1:2220981> for time 0 ()
Disconnect: Kicked by Console :  Banned on global ban list.

So the code is loading but commands are not working.

Any ideas?

EDIT:

I compared the function from ULX r80 to ULX r38 [The version our servers currently run].

I could only spot one difference on the first line of the function in r80 is this additional line:

ULX r80:
Code: [Select]
function ulx.concommand( command, fn_call, help, access, say_cmd, hide_say, autocomplete_type, autocomplete_fn, nospace )
if true then return end
access = access or ULib.ACCESS_ALL

ULX r38:
Code: [Select]
function ulx.concommand( command, fn_call, help, access, say_cmd, hide_say, autocomplete_type, autocomplete_fn, nospace )
access = access or ULib.ACCESS_ALL

Commenting that line out led to an error on line 70 where it adds the command to the table for the help command text.

Commenting THAT line out led to this: Warning! Called deprecated function ULib.add_subconcommand. Use the functions under ULib.cmds.* now

I sure wish that error came up MUCH earlier!
« Last Edit: December 29, 2009, 01:01:37 AM by trab »
|IC| Sub-Zero - ICannt.org Senior Admin

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Broken compatability with uban
« Reply #3 on: December 29, 2009, 09:19:14 AM »
Ah, I got rid of that function so I could concentrate on the ULX move-over. It should now be removed... I'll see if I can't make some time today to bring it all up to speed.

Sorry this was so much trouble for you, but please remember that SVN comes with no guarantees to be in even beta status. We usually keep SVN pretty clean but there's been a lot of changes and not a lot of time to work on fixing everything recently.
Experiencing God's grace one day at a time.

Offline trab

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • ICannt.org
Re: Broken compatability with uban
« Reply #4 on: December 29, 2009, 09:42:28 AM »
Ah, I got rid of that function so I could concentrate on the ULX move-over. It should now be removed... I'll see if I can't make some time today to bring it all up to speed.

Sorry this was so much trouble for you, but please remember that SVN comes with no guarantees to be in even beta status. We usually keep SVN pretty clean but there's been a lot of changes and not a lot of time to work on fixing everything recently.

It is all good, I know SVN is in a constant state of development.

We have one of our own custom modules that needed updating to work properply.

Our own coder tackled Uban and it is all working now:

uban_ulx.lua
Code: [Select]
if CLIENT then return end

hook.Add( "Initialize", "UBanULXInit", function() -- Wait for ULX to be loaded

local CATEGORY_NAME = "Utility"

local function cc_gban( ply, targets, time, comment )
   for _, target in pairs(targets) do
  local b, e = pcall( UBan.BanUser, ply, target, time * 60, comment or "")
  if !b then
Msg( "UBan failure. Error is: " .. tostring( e ) .. "\n" )
ULib.tsay( ply, "Global ban failed! See server console for error." )
return false
  end
   end
   return true
end

local gban = ulx.command( CATEGORY_NAME, "ulx gban", cc_gban, "!gban")
gban:defaultAccess(ULib.ACCESS_SUPERADMIN)
gban:help("<user(s)> [<time>] [<comment>] - Globally bans a user, time is in minutes. 0 or blank for perma.")
gban:addParam{ type=ULib.cmds.PlayersArg }
gban:addParam{ type=ULib.cmds.NumArg, min=0, max=50000, default=1440 }
gban:addParam{ type=ULib.cmds.StringArg, ULib.cmds.optional, ULib.cmds.takeRestOfLine }
gban:logString( "#1s global banned #2s for #3i with the reason #4s" )

local function cc_gbanid( ply, steamid, time, comment )
   local b, e = pcall( UBan.ManualBan, ply, steamid, nil, time * 60, comment or "" )
   if !b then
  Msg( "UBan failure. Error is: " .. tostring( e ) .. "\n" )
  ULib.tsay( ply, "Global ban failed! See server console for error." )
return false
   end
   return true
end

local gbanid = ulx.command( CATEGORY_NAME, "ulx gbanid", cc_gbanid, "!gbanid")
gbanid:defaultAccess(ULib.ACCESS_SUPERADMIN)
gbanid:help("Globally bans a steamid, time is in minutes. 0 or blank for perma.")
gbanid:addParam{ type=ULib.cmds.StringArg }
gbanid:addParam{ type=ULib.cmds.NumArg, min=0, max=50000, default=1440 }
gbanid:addParam{ type=ULib.cmds.StringArg, ULib.cmds.optional, ULib.cmds.takeRestOfLine }
gbanid:logString( "#1s global banned #2s for #3i with the reason #4s" )

local function cc_gunbanid( ply, steamid )
   UBan.ClearBan( steamid )
   return true
end

local gunbanid = ulx.command( CATEGORY_NAME, "ulx gunbanid", cc_gunbanid, "!gunbanid")
gunbanid:defaultAccess(ULib.ACCESS_SUPERADMIN)
gunbanid:help("<steamid> - Globally unbans a user's steamid.")
gunbanid:addParam{ type=ULib.cmds.StringArg }
gunbanid:logString( "#1s global unbanned #2s" )

end )

It would be nice of some of the custom modules themselves were apart of the SVN as compatible extras.
« Last Edit: December 29, 2009, 09:44:08 AM by trab »
|IC| Sub-Zero - ICannt.org Senior Admin

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Broken compatability with uban
« Reply #5 on: December 29, 2009, 12:12:43 PM »
We like to keep things as tidy as possible so don't include all modules.
I and others have posted in some of the releases posts additional converted code for SVN. (ulx explode) for example)
Once SVN goes release, I intend to contact some of the authors asking they convert if needed.
If no response, I just may take it upon myself to do what I think are some popular ones..perhaps take requests.

As your coder would probably agree, the new command structure may seem longer at first, but requires much less error checking and duplicated code within each function used.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming