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.
[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) local target = player.GetByUniqueID(args) local admin = pl if ValidEntity(target) then for k,v in pairs(player.GetAll()) do v:SendLua("player.GetByUniqueID('" .. args .. "'):SetMuted(" .. tostring(muteToggle) .. ")") end end end concommand.Add("sv_kontrol_mute", Mute)
if CLIENT then
function MuteMenu(pl, cmd, args)
local id = args
local menu = vgui.Create("KFrame2") menu:SetSize(120, 92) menu:SetPos(ScrW() / 2 - 60, ScrH() / 2 - 46) menu:SetTitle("Mute Options") menu:SetDraggable(true) menu:ShowCloseButton(true) menu:SetSizable(false) menu:MakePopup() local mute = vgui.Create("KButton", menu) mute:SetSize(100, 20) mute:SetPos(10, 32) mute:SetText("Mute") mute.DoClick = function() RunConsoleCommand("sv_kontrol_mute", id, "1") end local unmute = vgui.Create("KButton", menu) unmute:SetSize(100, 20) unmute:SetPos(10, 62) unmute:SetText("Unmute") unmute.DoClick = function() RunConsoleCommand("sv_kontrol_mute", id, "0") end end 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]
Make a folder in your addons folder named “kontrol”, and checkout using the following URL:
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: