I'm using this code:
function ulx.undercover( calling_ply, name, should_revoke )
local ply_name = calling_ply:GetName()
local rank = calling_ply:GetUserGroup()
id = calling_ply:SteamID()
ULib.ucl.userAllow(id,"ulx uncover",false)
if not should_revoke then
calling_ply:setRPName(name)
else
calling_ply:setRPName(ply_name)
end
if not should_revoke then
calling_ply:SetUserGroup("user")
else
calling_ply:SetUserGroup(rank)
end
end
local undercover = ulx.command( CATEGORY_NAME, "ulx undercover", ulx.undercover, "!undercover", true )
undercover:addParam{ type=ULib.cmds.StringArg, hint="Name to change", ULib.cmds.takeRestOfLine }
undercover:defaultAccess( ULib.ACCESS_ADMIN )
undercover:help( "Makes you go undercover" )
undercover:setOpposite( "ulx uncover", { _, true }, "!uncover", true )
Starting it works fine, but when I try to revoke I get an error. The error is 17 lines in a batch file so I'm not gonna type the whole thing out unless you need it. The first part says: [ERROR] gamemodes/darkrp/gamemode/modules/base/sv_data.lua:226: bad argument #1 to 'len' (string expected, got boolean)
I know what this means, it's trying to set my name to true or false, but I don't know why. In the code I used 1 =, not 2, so it should be setting the variable.