Author Topic: Commands in _Uncategorized Cmds  (Read 202 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 677
  • Karma: 34
    • View Profile
    • iViscosity Gaming
Commands in _Uncategorized Cmds
« on: July 31, 2017, 06:38:15 PM »
So I've been staring at this code for about half an hour now, and I just can't figure out why they are not showing up properly in the correct category. Can someone look at this with some new eyes to see what I could be missing?

Code: Lua
  1. function DSR.CallAdmin( ply, text, force )
  2.         if not force then force = false end
  3.         for _, player in pairs( player.GetAll() ) do
  4.                 if player:CheckGroup( "trial" ) then
  5.                         if force then
  6.                                 DSR.SendToDiscord( ply, ply:Nick() .. " is asking for help from " .. DSR.ServerName .. " (" .. DSR.ServerIP .. "). Their message: " .. text .. " <@&245039887709896704>" )
  7.                                 return
  8.                         else
  9.                                 ULib.tsayError( ply, "There is already an admin online: " .. player:Nick() )
  10.                                 ULib.tsayError( ply, "If the Admin is AFK, use !calladminforce to send the message anyways." )
  11.                                 return
  12.                         end
  13.                 end
  14.         end
  15.         if timer.Exists( "calladmin_delay" ) then
  16.                 ULib.tsayError( ply, "Call Admin has already been used recently, try again in " .. tostring( ( last_call + DSR.CallAdminDelay ) - CurTime() ) .. " seconds." )
  17.                 return
  18.         end
  19.         last_call = last_call or CurTime()
  20.         timer.Create( "calladmin_delay", DSR.CallAdminDelay, 1, function()
  21.                 timer.Remove( "calladmin_delay" )
  22.                 last_call = nil
  23.         end )
  24.         ulx.fancyLogAdmin( ply, "#A has called for an Admin!" )
  25.         DSR.ActiveCall = DSR.ActiveCall + 1
  26.         DSR.Active = true
  27.         DSR.SendToDiscord( ply, ply:Nick() .. " is asking for help from " .. DSR.ServerName .. " (" .. DSR.ServerIP .. "). Their message: \"" .. text .. "\". Case number: " .. tostring( DSR.ActiveCall ) .. " <@&245039887709896704>" )
  28. end
  29. local calladmin = ulx.command( "Utility", "ulx calladmin", DSR.CallAdmin, { "!calladmin", "!call" }, true, true )
  30. calladmin:addParam{ type=ULib.cmds.StringArg, ULib.cmds.takeRestOfLine, hint="your message here" }
  31. calladmin:defaultAccess( ULib.ACCESS_ALL )
  32. calladmin:help( "If you need help and there are no admins online, use this command to notify one." )
  33.  
  34. function DSR.CallAdminForce( ply, text )
  35.         DSR.CallAdmin( ply, text, true )
  36. end
  37. local calladminforce = ulx.command( "Utility", "ulx calladminforce", DSR.CallAdminForce, { "!calladminforce", "!callforce" }, true, true )
  38. calladminforce:addParam{ type=ULib.cmds.StringArg, ULib.cmds.takeRestOfLine, hint="your message here" }
  39. calladminforce:defaultAccess( ULib.ACCESS_ALL )
  40. calladminforce:help( "If you need help and there are no admins online, use this command to notify one." )
  41.  
  42. function DSR.HandleCall( ply )
  43.         if not DSR.Active then
  44.                 ULib.tsayError( ply, "There is no current Admin call to handle!", true )
  45.                 return
  46.         end
  47.         DSR.SendToDiscord( ply, "Most recent admin call was handled by " .. ply:Nick() .. " <@&245039887709896704>" )
  48.         DSR.Active = false
  49.         if timer.Exists( "calladmin_delay" ) then timer.Remove( "calladmin_delay" ) end
  50. end
  51. local handle = ulx.command( "Utility", "ulx handlecall", DSR.HandleCall, { "!handlecall", "!handle" }, true, true )
  52. handle:defaultAccess( ULib.ACCESS_OPERATOR )
  53. handle:help( "If you have come to handle an admin call, use this to let the other Admins know." )
  54.  

Everything in the code is defined are there are no errors being thrown on server startup, map change, or usage. The only issue I'm having is the commands are not showing up under the correct category. What this code is supposed to do is send a message to my Discord server using a webhook I've created, and that all works properly, just they aren't showing up under Utility.
« Last Edit: July 31, 2017, 06:41:52 PM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Forums
Public Discord
Teamspeak

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1251
  • Karma: 162
  • open(my $file, "<README") or die;
    • View Profile
    • XGUI
Re: Commands in _Uncategorized Cmds
« Reply #1 on: August 01, 2017, 07:22:04 AM »
Hmm, interesting. Have you tried clearing out or modifying the ulib\misc_registered.txt file? Do that and restart your server and see if that fixes anything.
"The stupidity of an individual on the Internet is generally matched only the by size of their ego, unless the individual in question is unaware of both." - Me

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 677
  • Karma: 34
    • View Profile
    • iViscosity Gaming
Re: Commands in _Uncategorized Cmds
« Reply #2 on: August 01, 2017, 10:13:24 AM »
I always forget to try that. I'll do it in a few and report back
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Forums
Public Discord
Teamspeak

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 677
  • Karma: 34
    • View Profile
    • iViscosity Gaming
Re: Commands in _Uncategorized Cmds
« Reply #3 on: August 07, 2017, 10:04:40 PM »
Sorry I completely forgot about this, but I was adding permissions to a new group I made and I realized they were still showing under _Uncategorized. I deleted the misc_registered.txt and restarted (server has been restarted several times since then) and it still doesn't work properly. Any ideas?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Forums
Public Discord
Teamspeak

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1251
  • Karma: 162
  • open(my $file, "<README") or die;
    • View Profile
    • XGUI
Re: Commands in _Uncategorized Cmds
« Reply #4 on: August 08, 2017, 10:27:53 AM »
Hmm.. my next guess might be to check how and when this file is being loaded. Ideally, you'll want to stick this code in a file in your addon's lua\ulx\modules\sh folder.

Additionally, try finding your command in the translatedCmds array and see what ULX reports the category as being. Could be a bug in XGUI. Something like this *should* work:
Code: Lua
  1. print(ULib.cmds.translatedCmds["ulx calladmin"].category)
"The stupidity of an individual on the Internet is generally matched only the by size of their ego, unless the individual in question is unaware of both." - Me

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 677
  • Karma: 34
    • View Profile
    • iViscosity Gaming
Re: Commands in _Uncategorized Cmds
« Reply #5 on: August 08, 2017, 01:00:24 PM »
Hmm.. my next guess might be to check how and when this file is being loaded. Ideally, you'll want to stick this code in a file in your addon's lua\ulx\modules\sh folder.

Additionally, try finding your command in the translatedCmds array and see what ULX reports the category as being. Could be a bug in XGUI. Something like this *should* work:
Code: Lua
  1. print(ULib.cmds.translatedCmds["ulx calladmin"].category)

First of all, that first suggestion there was correct. Completely forgot about making that 'sh' folder to put them in. They show under the correct "Utility" tab, now. I had it under
Code: [Select]
/garrysmod/addons/discord_relay/lua/ulx/modules/dsr_relay.lua
:P

Also when tried the other thing, it showed up correctly:
Code: [Select]
> print(ULib.cmds.translatedCmds["ulx calladmin"].category)...
Utility

Anyways, thanks.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Forums
Public Discord
Teamspeak

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.