• Print

Author Topic: Own ULX Command is marked as _Uncategorized Cmds  (Read 4464 times)

0 Members and 1 Guest are viewing this topic.

Offline MajorPain931

  • Newbie
  • *
  • Posts: 5
  • Karma: -1
Own ULX Command is marked as _Uncategorized Cmds
« on: October 15, 2014, 03:19:00 am »
Hey, I wrote two commands to make a player swap teams and for making some1 spectate. I want them to be displayed in XGUI, but when I want to manage the rights, they're located in "_Uncategorized Cmds" and they don't appear in the command list, although they should?  At first, I wanted an own category for them, but it didn't work, so I tried "Teleport".

Code: [Select]
function ulx.forceswap( calling_ply, target_ply )
        if target_ply:Team() == 2 then
                if target_ply:Alive() then
                        target_ply:Kill()
                end
                target_ply:SetTeam(1)
        elseif target_ply:Team() == 1 then
                if target_ply:Alive() then
                        target_ply:Kill()
                end
                target_ply:SetTeam(2)
        end
        ulx.fancyLogAdmin( calling_ply, "#A has forced #T to switch teams.", target_ply )
end

function ulx.forcespec( calling_ply, target_ply )
        if target_ply:Alive() then
                target_ply:Kill()
        end
        target_ply:SetTeam(1002)
        ulx.fancyLogAdmin( calling_ply, "#A has forded #T to spectate.", target_ply )
end

local forceswap = ulx.command( "Teleport", "ulx forceswap", ulx.forceswap, "!swap" )
local forcespec = ulx.command( "Teleport", "ulx forcespec", ulx.forcespec, "!spec" )
forceswap:defaultAccess( ULib.ACCESS_ADMIN )
forceswap:addParam{ type=ULib.cmds.PlayerArg }
forceswap:help( "Swaps a players team" )
forcespec:defaultAccess( ULib.ACCESS_ADMIN )
forcespec:addParam{ type=ULib.cmds.PlayerArg }
forcespec:help( "Forces a player to spectate (If AFK) " )

Interesting to mention, the commands appear in the right category when using "ulx help". Just saw it.
Code: [Select]
Category: Teleport
o ulx bring <player> - Brings target to you. (say: !bring)
o ulx forcespec <player> - Forces a player to spectate (If AFK)  (say: !spec)
o ulx forceswap <player> - Swaps a player's team (say: !swap)
o ulx goto <player> - Goto target. (say: !goto)
o ulx return [<player, defaults to self>] - Returns target to last position before a teleport. (say: !return)
o ulx send <player> <player> - Goto target. (say: !send)
o ulx teleport [<player, defaults to self>] - Teleports target. (say: !tp)
« Last Edit: October 15, 2014, 03:27:37 am by MajorPain931 »

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: Own ULX Command is marked as _Uncategorized Cmds
« Reply #1 on: October 15, 2014, 02:35:10 pm »
Not 100% sure but i think your structure was the issue,

Try using this and see if it works.

Code: Lua
  1. local CATEGORY_NAME  = "Catogory"
  2.  
  3. function ulx.forceswap( calling_ply, target_ply )
  4.         if target_ply:Team() == 2 then
  5.                 if target_ply:Alive() then
  6.                         target_ply:Kill()
  7.                 end
  8.                 target_ply:SetTeam(1)
  9.         elseif target_ply:Team() == 1 then
  10.                 if target_ply:Alive() then
  11.                         target_ply:Kill()
  12.                 end
  13.                 target_ply:SetTeam(2)
  14.         end
  15.         ulx.fancyLogAdmin( calling_ply, "#A has forced #T to switch teams.", target_ply )
  16. end
  17. local forceswap = ulx.command( CATEGORY_NAME, "ulx forceswap", ulx.forceswap, "!swap" )
  18. forceswap:defaultAccess( ULib.ACCESS_ADMIN )
  19. forceswap:addParam{ type=ULib.cmds.PlayerArg }
  20. forceswap:help( "Swaps a players team" )
  21.  
  22. function ulx.forcespec( calling_ply, target_ply )
  23.         if target_ply:Alive() then
  24.                 target_ply:Kill()
  25.         end
  26.         target_ply:SetTeam(1002)
  27.         ulx.fancyLogAdmin( calling_ply, "#A has forded #T to spectate.", target_ply )
  28. end
  29.  
  30. local forcespec = ulx.command( CATEGORY_NAME, "ulx forcespec", ulx.forcespec, "!spec" )
  31. forcespec:defaultAccess( ULib.ACCESS_ADMIN )
  32. forcespec:addParam{ type=ULib.cmds.PlayerArg }
  33. forcespec:help( "Forces a player to spectate (If AFK) " )
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Own ULX Command is marked as _Uncategorized Cmds
« Reply #2 on: October 15, 2014, 05:46:15 pm »
This is a shot in the dark (it's been a long time since I've looked at this), but try removing your command from your server's /data/ulib/misc_registered.txt file, if it shows up there.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

  • Print