I'm trying to, when ulx adduser(id)/removeuser(id) is run, to auto-add them to the co-responding FAdmin group when the command is successfully run.
The format for fadmin setaccess is: Fadmin setaccess "nick/steamid" "group"
The functions adduser, adduserid, removeuser, and removeuserid have been modified
It adds them to the ulx group but it returns this (something similar each time)
[addons\ulx\lua\ulx\modules\sh\user.lua:79] attempt to perform arithmetic on a string value
function ulx.adduser( calling_ply, target_ply, group_name )
group_name = group_name:lower()
local userInfo = ULib.ucl.authed[ target_ply:UniqueID() ]
local id = ULib.ucl.getUserRegisteredID( target_ply )
if not id then id = target_ply:SteamID() end
ULib.ucl.addUser( id, userInfo.allow, userInfo.deny, group_name )
calling_ply:ConCommand("fadmin", "setaccess " + id + group_name)
ulx.fancyLogAdmin( calling_ply, "#A added #T to group #s", target_ply, group_name )
end
local adduser = ulx.command( CATEGORY_NAME, "ulx adduser", ulx.adduser )
adduser:addParam{ type=ULib.cmds.PlayerArg }
adduser:addParam{ type=ULib.cmds.StringArg, completes=ulx.group_names_no_user, hint="group", error="invalid group \"%s\" specified", ULib.cmds.restrictToCompletes }
adduser:defaultAccess( ULib.ACCESS_SUPERADMIN )
adduser:help( "Add a user to specified group." )
function ulx.adduserid( calling_ply, id, group_name )
id = id:upper() -- Steam id needs to be upper
group_name = group_name:lower()
-- Check for valid and properly formatted ID
if not checkForValidId( calling_ply, id ) then return false end
-- Now add the fool!
ULib.ucl.addUser( id, allows, denies, group_name )
calling_ply:ConCommand("fadmin", "setaccess " + id + " " + group_name)
if ULib.ucl.users[ id ] and ULib.ucl.users[ id ].name then
ulx.fancyLogAdmin( calling_ply, "#A added #s to group #s", ULib.ucl.users[ id ].name, group_name )
else
ulx.fancyLogAdmin( calling_ply, "#A added userid #s to group #s", id, group_name )
end
end
local adduserid = ulx.command( CATEGORY_NAME, "ulx adduserid", ulx.adduserid )
adduserid:addParam{ type=ULib.cmds.StringArg, hint="SteamID, IP, or UniqueID" }
adduserid:addParam{ type=ULib.cmds.StringArg, completes=ulx.group_names_no_user, hint="group", error="invalid group \"%s\" specified", ULib.cmds.restrictToCompletes }
adduserid:defaultAccess( ULib.ACCESS_SUPERADMIN )
adduserid:help( "Add a user by ID to specified group." )
function ulx.removeuser( calling_ply, target_ply )
ULib.ucl.removeUser( target_ply:UniqueID() )
calling_ply:ConCommand("fadmin", "setaccess " + tostring(target_ply:SteamID()) + " user")
ulx.fancyLogAdmin( calling_ply, "#A removed all access rights from #T", target_ply )
end
local removeuser = ulx.command( CATEGORY_NAME, "ulx removeuser", ulx.removeuser )
removeuser:addParam{ type=ULib.cmds.PlayerArg }
removeuser:defaultAccess( ULib.ACCESS_SUPERADMIN )
removeuser:help( "Permanently removes a user's access." )
function ulx.removeuserid( calling_ply, id )
id = id:upper() -- Steam id needs to be upper
-- Check for valid and properly formatted ID
if not checkForValidId( calling_ply, id ) then return false end
if not ULib.ucl.authed[ id ] and not ULib.ucl.users[ id ] then
ULib.tsayError( calling_ply, "No player with id \"" .. id .. "\" exists in the ULib user list", true )
return false
end
local name = (ULib.ucl.authed[ id ] and ULib.ucl.authed[ id ].name) or (ULib.ucl.users[ id ] and ULib.ucl.users[ id ].name)
ULib.ucl.removeUser( id )
calling_ply:ConCommand("fadmin", "setaccess " + id + " user")
if name then
ulx.fancyLogAdmin( calling_ply, "#A removed all access rights from #s", name )
else
ulx.fancyLogAdmin( calling_ply, "#A removed all access rights from #s", id )
end
end
local removeuserid = ulx.command( CATEGORY_NAME, "ulx removeuserid", ulx.removeuserid )
removeuserid:addParam{ type=ULib.cmds.StringArg, hint="SteamID, IP, or UniqueID" }
removeuserid:defaultAccess( ULib.ACCESS_SUPERADMIN )
removeuserid:help( "Permanently removes a user's access by ID." )