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".
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.
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)