CAT - Cats' Administration Tools

**C.A.T
**Cat’s Administration Tools

**What is it?
**- C.A.T is my administration tool , that took me about a week at first to make, and has grown into this. It functions like other admin-mods do like ASSMod, ULX, etc. I’m posting this here because I’d like to know how this functions on a bigger scale (provided anyone uses it). My sandbox server only gets so much traffic, and I can’t test every situation. I’d also like to hear other people’s input on it. It’s still a WIP, so be sure to check the Github for the latest version.

**Features
**
Screencap

– More common now a days, but still nice. “Grab” a player’s screen directly, and you can see everything that’s in their game window, even while you’re in game. If you accidently close the window, it’s still saved on the server’s data folder.

***An easy UI


***A (99% if your smart) unbreakable config


– Most, if not all, sections of the config for C.A.T is labeled. No confusions! No mistakes! Only goals!

***No Clutter!


– If there was one thing I didn’t like, it was the cluttered menu that ULX uses. This takes cue from a G12 admin mod ASSMod, with its simplistic menu.

**Okay, sounds good! Where can I get it?
**
http://i.imgur.com/eAleQSm.png

Remember to **READ THE README. **There’s stuff in there you need to know!

**Okay, I got it. But I have a few questions…
**
Q. I got it installed, but how do I open the menu?
A. In console (clientside) do “bind <key> +cat_menu” without the quotes, of course. And with your own keyboard key.

Q. I’m new to running servers. How do I install this?
A. Just drag the “catv1” folder into your addons.

Q. Help me! On my DarkRP/TTT normal people can fly!
A. By default, the config is set up for a classic sandbox server. If you’re running a DarkRP or something else that ISN’T SANDBOX, you’re going to want to go into the config and change some stuff (such as not allowing users and vip to noclip). All of the possible “cando” options are listed in the “CAT_Config.ownerCan” table.

Q. I got some questions that aren’t listed here (DarkRP VIP Jobs, finding ranks). Help me!
A. You can add me on steam here for help.

Q. How do I give myself my rank?
Q. Open your console/srcds depending on your host, and do “cat_setaccess userid owner”. To find your userid, type status in console on either server or client, and it will be the first number on the left.

**
Thanks to:**

Nano - Pushing me through my anxiety to post this, and making the first draft.
Dead - Guinea Pig/ “willing” tester.
ASSMod - Idea for the UI, code help.
ULX - Code help.

I’m really open to suggestions, since this is the first thing I’ve ever really finished. I know the whole thing about “never release your first project”, but as I said, I’m just looking for input on how to optimize this.

GUI looks like ASSMod. Also ASSMod have more features.

Looking through the code, it seems like a lot of things are hard-coded so it seems like it takes more effort to add new commands.

At least he isn’t over-writing hooks and shit like ULX does

it’s such a bitch

Because assmod uses default menus, just like this does.

Yeah, i see
[LUA]rightadminmenu = vgui.Create(“DMenu”)[/LUA]

It looks fantastic considering it’s your first project, hopefully you’ll keep on updating/working on it in the future.

One pet peeve of mine though:
Why are you highlighting an rcon command as a big selling feature? I’ve yet to see an administration mod that doesn’t have an rcon command. It’s pretty basic.

[lua]
concommand.Add( “rbreslow_rcon”, “RCon Command”, function( arg )
table.remove( arg[1] )
if ( table.concat( arg, " " ) != “” ) then
cmd = table.concat( arg, " " )
return game.ConsoleCommand( cmd … "
" )
end
return false
end )
– i didn’t test this so it probably won’t work
[/lua]

Hey guys, thanks for the responses. It took me a while to come and read them because I have an anxiety about these kinds of things. Fortunately, your replies weren’t as bad as I had thought. It’s an honor to have some of you guys reply.

The GUI does look like ASSMod, because I personally love ASSMod’s GUI. It’s easy to use, and there’s no menu clutter. I tried to get as many features into it as I could.

I wasn’t expecting people to necessarily be making new commands for this. Really, if you wanted to do so, I would hope you would have knowledge about how to create a DMenu suboption (although the icons might be annoying).

I didn’t write the OP (anxiety), although I changed it a bit from what a friend gave me. RCon is a pretty basic feature, so I guess it doesn’t really need to be there. (That’s quite an odd way to make an RCon concommand, though…)

Perhaps you could write an alternative for adding menus and options? That way it would be easier for people to add their own or whatever rather than them all being hardcoded into one function. Just a suggestion. Other than that, nice work. I like it :slight_smile:

for a first project, fantastic work :)!

i took a look at the menu code and do you know you can do
[LUA]local option = menu:AddOption( “option” )
option:SetIcon( “icon16/tick.png” )[/LUA]
?

instead of stuff like this here. plus, you should use the icon16/ path instead of gui/silkicons, as they are shipped with gmod in the materials/icon16 folder now. also try to use localized variables instead of global (unless you need to, then you should probably just make a global table)

just nitpicking :v:

Maybe that will help you.

I used the icons like that because I couldn’t find a function to draw an icon on a submenu. If there is one, be sure to tell me. I didnt know if icon16 had all the icons I was going to use, so I used my own. Also, i tried to keep , my variables localized when I could, but if you see one standing out, tell me!

Also, AirBlack, I wasnt asking anything about Submenus. I actually think I would be pretty good at making Dmenus after making this :v:

hopefully with all these admin mods coming out ulx will take a hike

To set the icon of a sub menu, you have to do it a little differently as AddSubMenu returns 2 values rather than one, and you need to use the second value for doing that. For example:



local menu = DermaMenu()
local submenu, pnl = menu:AddSubMenu( "Test" )
pnl:SetIcon( "icon16/add.png" )


Just in case you need it, here’s all the icon16 silkicons: http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png

This might be slightly off-topic, but you should check out the 4th parameter given to concommand callbacks. It’s surprisingly under-used.

[lua]
concommand.Add(“rbreslow_rcon”, “”, function(ply, _, _, cmd)
if ply has permissions then
game.ConsoleCommand(cmd … "
")
end
end)
[/lua]

Okay, I was playing about with this for a while on my testing server and I found a few things

  • I don’t have access to unban as the owner.
  • I can’t pick up props or other players.
  • A lot of this is hard coded - Manually adding menu entries? Not a good idea.
  • You’re not using the built in silkicons, but including a pack which comes with GMod anyway. Use the icon16/ folder.
  • It would be better to make your own function which adds a menu item and run commands, than defining a console command each time.
  • Perhaps add pre-defined options (just like assmod’s) for things like health and armour.
  • Add an unban menu, rather than telling the user to input the SteamID. This would allow people to view existing bans with their reasons and lengths.
  • Prop cleanup is not working.
  • A basic plugin system would be ideal for a mod like this.

All in all though, it’s nice to see another person making an admin mod for GMod. One day perhaps, the variety will bury ULX.

Thanks for the stuff guys. A lot of the issues that Mors posted have been fixed, (1, 2, 4, 7), and I took ShadowRanger’s suggestion. No more dumb icons. I’ll probably be working on the unban menu next, then seeing what I can do to make this a little more mod friendly.

You would just need a table of commands.

[lua]
– The following is shared.
CAT_Commands = {}

– Perhaps somewhere else in another file (e.g. your plugins)
CAT_Commands.kick = {
name = “Kick Player”,
icon = “icon16/door_open.png”,
onRun = function(client, command, arguments)
– Implement something here when ran.
– Probably accomplish this by making a console command.
end
}

– On the server, you can loop through the commands and make a new console command:
for command, info in pairs(CAT_Commands) do
concommand.Add(“cat_”…command, info.onRun)
end

– This is clientside. For your menu:
local menu = DermaMenu() – You can use DermaMenu() to create a DMenu for convenience.

for k, v in SortedPairs(CAT_Commands) do
menu:AddOption(v.name, function()
RunConsoleCommand(“cat_”…k)
end):SetImage(v.icon)
end

menu:Open()
[/lua]

Hope this helps.

We’re happy with Evolve so I won’t personally use this but I think it’s great to see people making more admin mods and I am completely supportive of it!

Like, there’s so many people who think ULX is the only admin mod.

If most GSPs are like NFOServers, then there’s a very good reason for that.

http://ss.infd.us/linux/2014-04-28@16-28-25.png