Hi there,
Apologies for first post being a help request, I'll try and make it as complete as possible.
I'm currently looking at adding chat commands and hinting to Lexi's sourcebans script. The problem I'm having is that the console command is not being listed in client consoles for autocomplete options. The command isn't even being listed as valid (showing up in the list of commands hint below when typing), however you can still call it as a valid function. Couple of screenshots from console showing my problem.
Showing the autocomplete for the function names -> Does not show sm_banNo Autocomplete options for command on first argNo Autocomplete on second argProof that the command does workFor reference, the relevant functions being used (in the load order as defined by ULib/ulx):
\lua\ulib\modules\sourcebans_shfunc.lua [Shared]function sourcebans.addCommand( command, fn, say_cmd, hide_say, nospace )
local obj = ULib.cmds.TranslateCommand(command, fn, say_cmd, hide_say);
obj:addParam{ type=ULib.cmds.CallingPlayerArg };
return obj;
end
\lua\ulx\modules\sourcebans.lua [Serverside]
function sourcebans.ban( ply, pl, time, reason )
if (not checkConnection()) then
return complain(ply, "The database is not active at the moment. Your command could not be completed.");
elseif (not authorised(ply, FLAG_BAN)) then
return complain(ply, "You do not have access to this command!");
end
--local pl, time, reason = table.remove(args,1), table.remove(args,1), table.concat(args, " "):Trim();
--pl = playerGet(pl);
--Time chat suffixes
local suffix = string.Right( time, 1 )
if suffix == "h" then
time = tonumber( string.sub( time, 1, string.len( time ) - 1 ) ) * 60
elseif suffix == "d" then
time = tonumber( string.sub( time, 1, string.len( time ) - 1 ) ) * 1440
elseif suffix == "w" then
time = tonumber( string.sub( time, 1, string.len( time ) - 1 ) ) * 10080
elseif suffix == "m" then
time = tonumber( string.sub( time, 1, string.len( time ) - 1 ) ) * 1440 * 30
elseif suffix == "y" then
time = tonumber( string.sub( time, 1, string.len( time ) - 1 ) ) * 1440 * 365
else
time = tonumber( time )
end
if (not complainer(ply, pl, time, reason, usage)) then
return;
end
local name = pl:Name();
local function callback(res, err)
if (res) then
complain(ply, "sm_ban: " .. name .. " has been banned successfully.")
else
complain(ply, "sm_ban: " .. name .. " has not been banned. " .. err);
end
end
sourcebans.BanPlayer(pl, time * 60, reason, ply, callback);
complain(ply, "sm_ban: Your ban request has been sent to the database.");
end
local sm_ban = sourcebans.addCommand("sm_ban", sourcebans.ban, { "!sban" }, true);
sm_ban:addParam{ type=ULib.cmds.PlayerArg };
sm_ban:addParam { type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 };
sm_ban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine };
sm_ban:defaultAccess( ULib.ACCESS_ADMIN );
I feel like this is a really simple issue that is probably me being stupid and overlooking something. I have also tried using the ulx functions which also worked, however did not show any autocompletes/hints. (Exactly like this issue)
Any help would be greatly appreciated. If you need anything else, let us know
EDIT: Just for clarification, there are no errors pushed either serverside or clientside on use of the functions, or on load. Cheers!