kontrol - Administration in Moderation


kontrol is an admin mod for Garry’s Mod that was designed with stupidly simplistic ideals in mind.
I felt like some of the current leaders in the admin mod market were missing their target when they advertised how simple it all was. I liked the idea of a plugin system, because really when you think about it, what’s simpler than letting the user code the mod for himself, or just download plug and play plugins from a well sorted list of user-submitted plugins? What I didn’t like was the obsession with using object oriented programming while making these plugins, it didn’t, and still doesn’t, seem necessary. Plugins are really just small scripts to be installed and removed with ease, so the fact that programming and even installing these plugins was so bothersome was a major flaw in most systems that used plugins. With that in mind, kontrol is designed with one of the simplest plugin systems, so simple in fact that I feel pretty silly for even bothering to let them be called plugins, after looking at what extravagant masterpieces the other admin mods had crafted to handle these little scripts.

Plugins in kontrol are what a plugin should be, a script. You write a script that will be run as a shared file, register the console command for a player to run when he clicks the automatically generated button for your plugin, and throw it in the plugins folder. Voila, you’ve made a plugin! It may seem silly, even I thought so when I was first working on kontrol, but once it was all brought together and ready to use, I began to realize that, well, simplicity worked. :v:

[ul]Dynamic Plugins means install, restart, and play.[/ul]
[ul]Simple yet powerful plugin architecture gives developers nothing to learn and everything to do.[/ul]
[ul]Simple and clean user interface, so banning a naughty player doesn’t require the aid of a map.[/ul]
[ul]All plugins have external SQL access, but if you don’t have SQL or don’t want to use it, it will default to internal SQLLite.[/ul]
[ul]Database configuration is as simple as editing a text file.[/ul]
[ul]Comes pre-loaded with essential administration plugins like Kick, Ban, Unban, Mute, Slay and Respawn.[/ul]

The Kontrol Panel

View of Multiple Plugins opened.

Jail - Loures

:siren: It’s about to get nerdy up in this bitch, so look away if you’re not interested in Lua :siren:
Here’s how plugins are loaded via kontrol:

[ul]You write your plugin like any other Lua script, but it must be in one file, and it will be run shared.[/ul]
[ul]If you want your plugin to be one that affects a certain player, then at the top of your script, you define the plugin via one simple line: plugins[“Name”] = “command”[/ul]
[ul]Put the plugin in the plugins directory within the kontrol/lua folder, and they will automatically be sent to the client and run both on the client and the server.[/ul]
[ul]When a user opens the Kontrol Panel, they will see an auto-generated list of plugins, including yours if you defined it as explained in step 2.[/ul]
[ul]When the player clicks the button corresponding to your plugin, they will run the command you defined, sending in the unique ID of the player they have selected in their player list. If your plugin is not a user-specific plugin, it will just run like any other script.[/ul]

As an example, here is a mute plugin I wrote:
plugins[“Mute”] = “kontrol_mute”

if SERVER then
function Mute(pl, cmd, args)
if !pl:KAdmin() && !pl:KModerator() then return end

	local muteToggle = tobool(args[2])
	local target = player.GetByUniqueID(args[1])
	local admin = pl
	if ValidEntity(target) then
		for k,v in pairs(player.GetAll()) do
			v:SendLua("player.GetByUniqueID('" .. args[1] .. "'):SetMuted(" .. tostring(muteToggle) .. ")")
concommand.Add("sv_kontrol_mute", Mute)


if CLIENT then
function MuteMenu(pl, cmd, args)
local id = args[1]

	local menu = vgui.Create("KFrame2")
	menu:SetSize(120, 92)
	menu:SetPos(ScrW() / 2 - 60, ScrH() / 2 - 46)
	menu:SetTitle("Mute Options")
	local mute = vgui.Create("KButton", menu)
	mute:SetSize(100, 20)
	mute:SetPos(10, 32)
	mute.DoClick = function()
		RunConsoleCommand("sv_kontrol_mute", id, "1")
	local unmute = vgui.Create("KButton", menu)
	unmute:SetSize(100, 20)
	unmute:SetPos(10, 62)
	unmute.DoClick = function()
		RunConsoleCommand("sv_kontrol_mute", id, "0")
concommand.Add("kontrol_mute", MuteMenu)


Developers can also use the custom derma elements I’ve defined, to make their plugins fit the theme.
[ul]KFrame2 - Replacement for a regular DFrame, (KFrame is the element for the Kontrol Panel), the title bar is 22 pixels tall, and there is a panel drawn within the frame that is 5 pixels inward. In short, have your elements positioned at at LEAST 10 pixels from the left and 32 pixels from the top.[/ul]
[ul]KButton - Simple reskin of DButton[/ul]
[ul]KListButton - Another reskin of the DButton, has a 15 pixel dark spot on the left side, positioned 5 pixels inward.[/ul]

SVN Checkout
Make a folder in your addons folder named “kontrol”, and checkout using the following URL:

Fast Download

Use: If playing singleplayer, you’re already an admin, type ! in chat to open the menu.

If you’re playing on a dedicated server, run the command “kontrol_owner <NAME>” in your server console to make
yourself admin, replacing “<NAME>” with your in-game username of course.

Plugins that affect single players will show up automatically in the plugin list to the right of the playerlist. Plugin buttons wont do anything unless
you select a player in the player list. To refresh the player list (Useful for making sure a naughty player is still on the server), click on the magnifying glass
in the bottom left corner of the playerlist. Your current selection will not be undone.

To install plugins, simply drop them into the “plugins” folder located at kontrol/lua/plugins, restart your server to load the addon again, and voila!
Uninstallation is just as simple, you need only remove the plugins you dont want.

Read the included readme.txt for information on configuring SQL.
Please PM me over Facepunch (I will probably not accept random Steam invites) if you’d like your plugin to be listed here in the OP.

:siren:Thanks to Loures for helping develop kontrol!:siren:

I guess I will be the first to say nice work, looks great!

[editline]25th February 2011[/editline]

also the menu is quite clean, this would be very useful for servers with less players, however big build servers would probably be better off with evolve due to its outstanding sandbox functionality. With a bit more work I can honestly say this will probably be a very useful and used admin mod.

Yeah, I plan on releasing a sandbox plugin pack (Hopefully this weekend) so its more of a major contender. I was really just antsy to make the thread since I had the time :v:

The whole reason I made this was because I needed a more serious admin mod for my servers, I was tired of dealing with permissions where I had to make sure certain ranks couldn’t do a whole list of stupid things I didn’t want ANYONE doing, and so I made this for myself. But then I figured I may as well release it and hopefully help out people are are in the same spot as me.

You spelled control wrong.

Well then best of luck to you and the future development on this project. Can’t wait to see its more serious side.

How do I open the menu? :colbert:

Type ! in chat

Dont rate him dumb, that is completely my bad.
Use the command “kontrol_owner <NAME>” in console, to set a player as the owner, by his name. Then type ! in chat to access the menu.

[editline]25th February 2011[/editline]

Also, please update to use the “kontrol_owner” command. I released this in a hurry after slowpunching the thread like 3 times and didn’t bother to realize that I had been using lua_run commands to make myself owner.

It all works now though, pardon my stupid :v:

I like this, good work kopimi, but those list buttons are ugly with that dark blue border.

But, is the huge influx of admin mod coming again?

Look good!

Well it’s really just me and Merz, this I wasn’t even planning on releasing, and Merz’s AIDS mod was released a long time ago, so he’s really just reposting his thread.

I think we just have to wait, anyway coding some plugins for this.

Help,SRCDS.exe is missing

Are you running this on a dedicated server or on your regular Garry’s Mod client?

Oh,I do not know what it is you need to do.

You left strings about pirate-servers in some files. (ban.lua)
Also I’ve finished a jail plugin (conctact me if you want it)

Ah right, I’ll update the SVN so that the kick/ban messages are just plain.
Though I suppose this may have served for some nice accidental advertising :v:

[editline]25th February 2011[/editline]

And as far as the plugin goes, I don’t personally need it, but if you posted a link to it here I’d be happy to put it up on the OP. I’m planning on writing a quick PHP page so that people can view/download/submit scripts later.

[editline]25th February 2011[/editline]

Problem has been fixed, banning a player now sets the kick message to "Banned: " followed by the length in minutes.

Good job, it looks great.

I suggest you to make wrapper function for SQL querying, so you don’t have to do huge if loops everytime you work with the database.

There would be no real way to do that, if a plugin writer needs SQL access he’ll have to at least know some basics about SQL. I’m not sure how I could make tmysql or the default Garry’s Mod SQL library any simpler than they already are.