Listen 'ere, kiddo. Your scripting sucks something awful, and I'll explain why, so hang tight.
[list][*] This does not need to be a shared file, none of your so-called "plugins" do, all you're achieving with this structure is that you're sending all the serverside code to a client that doesn't need it, and forcing the serverside lua instance to parse (though not execute) your clientside code.[*] You're repeating code like this was an essay with a minimum word count that you couldn't figure out how to live up to. Throw the shit from SQL_ACTIVE outside of it, and keep the SQL query itself inside it. This goes for pretty much all(read: all) of your SQL code.[*] Globals, globals everywhere (Thanks CapsAdmin). It's pretty na´ve to think that no other addon, gamemode or lua file will ever use the global variable "Ban", "plugins" or "Kick". Use globals for crying out loud! You're not accessing them anywhere else but in this file! Better yet, skip the variable bit and feed the function straight into the call to concommand.Add.
[*] On line 159 through 185, you seem to have caught a bad case of the Nullsquared. Use a table, this will make your life so much easier, and you can even reuse it when filling your menu on line 139![/list]
concommand.Add( "I'm a lousy coder", function(pl, cmd, args ) print( "It's true!" ) end )
[list][*] Throw all your functions, variables, whatnots and haveswhats in a global table, because
[list] [*] Nested lists, whatcha gonna do, bitch?[*] Lua doesn't have to look through a million Ban, BanMenu, kontrolMenu, MAIN_FRAME, etc. variables to find the one it's actually looking for[*] Makes your code neater[*] Safer, safer, safer, safer.[*] They're like locals, only they don't disappear when you turn your back.[/list][*] Create your menu once and then use the fancy-cool function "SetVisible" to make it seemingly fade in and out of existence, it's like magic with less bunnies.[/list]
[list][*] Do you have any idea what string.Explode does to the poor processor, not to what mention file.Read does to your harddrive?[*] And secondly, I- I'm just kidding bro, apart from the complete disinterest in minimizing the impact of your script on Gmod's performance, it's cool bro.[/list]
[list][*] Don't[*] Send[*] Lua[*] "But it's just one string, no harm, right?" - Wrong. One string is 'kay, but there's more than one script running on a Gmod server or client at any given time, see. And if each of those wants to SendLua just one tiny string, it all adds up pretty fucking fast. If everyone stopped thinking "Just one string, it won't hurt" and started thinking "YES I CAN SAVE 100 BYTES BY NOT BEING A QUEER" Gmod would run noticeably faster (Won't get rid of Sleep(30000) though).[/list]
- If you absolutely must notify everyone of your adminmods existence.
hook.Add("Initialize", "InitKontrol", function()
print("\n< kontrol initialized " .. (CLIENT && "client" || "server") .. "side >\n")
Just because your adminmod was designed with "stupidly simplistic ideals in mind", doesn't mean it has to be simplistically stupid.