Ulysses Stuff > Releases

TempAdd (v2.4) - Add a user to another group for a set amount of time

<< < (3/28) > >>

lua_error:
[ERROR] addons/tempusers/lua/ulx/modules/sh/ulxtempuser.lua:49: attempt to call method 'IsConnected' (a nil value)
  1. unknown - addons/vip/lua/ulx/modules/sh/ulxtempuser.lua:49

Stickly Man!:

--- Quote from: delagious on January 25, 2013, 10:00:59 PM ---I am getting an error when I try to access this command from the XGUI:

--- End quote ---


No errors for me. Make sure you're running the most up-to-date versions of ULX/ULib.

Mr. President, I would highly recommend adding a hint parameter to your NumArg, something like "Time (minutes)". This will show up when entering the command in console and in XGUI (pictured) instead of "NumArg". Also, you may want to be a little more descriptive on your second group hint, as it may be initially confusing to some who haven't read your nice release post here :P

Lastly, there appears to be a bug where the autocompletes for the groups aren't being sent to the client (try comparing ulx adduser in the console to ulx tempadduser), and it's causing XGUI to not allow you to not be able to specify a group name. I'm looking into what's causing it, and will reply when I can find a fix.



--- Quote from: lua_error on January 27, 2013, 09:06:19 AM ---[ERROR] addons/tempusers/lua/ulx/modules/sh/ulxtempuser.lua:49: attempt to call method 'IsConnected' (a nil value)
  1. unknown - addons/vip/lua/ulx/modules/sh/ulxtempuser.lua:49

--- End quote ---

It appears that <player>:IsConnected() is only available serverside, so the code will have to be changed to adapt to that. :S

Stickly Man!:

--- Quote from: Stickly Man! on January 27, 2013, 09:26:42 AM ---there appears to be a bug where the autocompletes for the groups aren't being sent to the client
--- End quote ---

Okay, explanation time! You're using the ulx.group_names_no_user table (same would apply when using ulx.group_names) for your autocompletes. However, these tables don't get created until util.lua loads, which most likely happens AFTER your plugin is loaded (alphabetical order), thus, you're essentially passing nil for your autocompletes.

Two valid solutions are:
1) Create your own table of group names completely separate from ulx.group_names, using similar code found in until.lua:

--- Code: ---<...somewhere near top of file...>

ulx.tempuser_group_names = {}
local function updateNames()
table.Empty( ulx.tempuser_group_names ) -- Don't reassign so we don't lose our refs

for group_name, _ in pairs( ULib.ucl.groups ) do
table.insert( ulx.tempuser_group_names, group_name )
end
end
hook.Add( ULib.HOOK_UCLCHANGED, "ULXTempAddUesrGroupNamesUpdate", updateNames )
updateNames() -- Init

<...plugin code here...>

tempadduser:addParam{ type=ULib.cmds.StringArg, completes=ulx.tempuser_group_names, hint="group", error="invalid group \"%s\" specified", ULib.cmds.restrictToCompletes }

--- End code ---
*Note, this code will list all of the groups, including user. I did this mostly because A) You want to have user as a valid group for arg2 so they can be demoted to user and B) Why not be able to temporarily remove an admins access as well by setting group1 to user?

2) See if you can make a reference to the ulx.group_names table right after it's created, but before you register your command. Or something. I've been trying to play around with this and haven't been successful, but I think it's possible.

Anyways, hope that helps!

delagious:
Thanks stickly my server is currently running XGUI version v12.12.16
I am not sure why it isn't updating as it should :( but I'm sure this is the cause of the error.

<EDIT> Got my XGUI updated and it works fine now, thanks for the addon and the help.

JamminR:
Team collaboration FTW!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version