sAdmin v0.1b


Simple Admin (sAdmin)

  • version 0.4 Beta

This is a simple mod I made with which to administrate servers.
I made it to practice and learn Lua.

After using this mod and/or seeing pictures of it, you may want to call this mod “A sad Attempt at an admin mod”, “Failmin”, “sAdminge”, or other names.

http://www.garrysmod.org/img/?t=dll&id=71585

Before I fasten on my firesuit, let me tell you a few things:
[ul]
[li]I am not an expert/experienced/good/decent Lua coder (as you probably can tell by my posts here at FP). The code you will see is probably the worst you can imagine. This is about my 4th thing to make with Lua ever, and I wouldn’t know good code if it bit me in the… moving on.[/li][li]This mod is still in beta, so while I have done my best to find any bugs, I probably wont have found all of them. Also, some of the stuff needs improving still, such as the order of the items in the command menu and such.[/li][li]This mod does not have a long and ridiculous acronym for a name.[/li][li]This mod was not made to send the current admin mods to the depths.[/li][li]This mod does not have chat commands, except for the Admin chat.[/li][li]I do not have knowledge of Gmod hooks that other admin mod makers did not.[/li][li]This mod uses Valve’s banning system.[/li][li]This mod is definitely not revolutionary.[/li][/ul]
If you were looking for a mod with any of that, I’m sorry, you won’t find it here.

Now that I have gotten the bad things out of the way, let me list some of the good things about it:
[ul]
[li]It has an easy to use GUI, in which commands are executed on players by right-clicking their names and choosing a command from the menu. So you have neither a sea of buttons nor a never-ending chain of menus, but a winning combination of different GUI elements.[/li][li]This mod is very simple and easy to use, which is good for people new to running a server.[/li][li]There is a total of: 2 tabs, 2 lists, and a maximum of 3 buttons on the main Admin menu.[/li][li]It’s almost painfully easy to write plugins for this mod.[/li][li]And all the standard features of an Admin mod.[/li][/ul]
To install this mod, drop the sAdmin folder into the garrysmod/addons directory.

After restarting your server, join it (preferably when no-one else is on the server) and type in the console:

SA_setOwner


**WARNING: The first person to do this will be set as the Owner, a rank which cannot be revoked without file editing.**

After you have done so, you will be notified that you have been promoted to Owner.
To bring up the admin menu, type this into the console:

bind <key> SA_CP

Where <key> is a key such as ‘t’, ‘v’, ‘z’, or anything else.
Then when you hit the key, it will bring up the menu.

If you are an admin, you will not see the Server Command button at the bottom of the menu, or the Set Admin and Remove Admin items of the command menu. Only Owners see these things.

To talk via chat to all admins and owners, type the character ‘;’ before a message, and it will be displayed to all the owners and admins, e.g.:
;blah blah blah

To change the map, press the map button in the lower right corner, select a map, and press Change Map.

The playerlist and ban list are not updated automatically (except when you unban a player, the banlist is updated). To update it, hit the Refresh button.

To unban a player, right click the ban and click “Unban” in the menu. The ban list loads the bans from the banned_user.txt, and because any bans less than permanent are not written to the file, you won’t be able to view them from this list, and also you will only be able to see the SteamID of the banned player, not their name. In future versions of this mod, I will implement my own ban system to ‘upgrade’ this.

Setting an owner cannot be done by menu, only by the console command SA_setOwner <name>.

To change the colour of the GUI, change the variable SA_WindowColour near the top of SA_client.lua. It’s one of the first things near the top, right after about 5 lines of comments.

To change the colour of admin teams, edit the colours in SA_shared.lua.

Please post anything you don’t like or like here, or any improvements you want made. This mod is under constant development, so any ideas you have (if I can do them) will probably be quickly added.

[img_thumb]http://i272.photobucket.com/albums/jj197/Exchequer/sadpic1.jpg[/img_thumb] [img_thumb]http://i272.photobucket.com/albums/jj197/Exchequer/sadpic2-1.jpg[/img_thumb]

And the traditional show of gratitude. Thanks to:

  • The people on FacePunch for answering my stupid questions
  • Sadistic Slayer and Chrisaster for the same
  • Sadistic Slayer and X1L3D for letting me test the mod on their server
  • Galago for continually testing this mod
  • And the creators of the other admin mods for writing them and making them available to everyone to learn from.
    Without the above people, this mod wouldn’t have happened. So if you don’t like it, blame them.

Changelog:
v0.4b: Added CEXEC and VoiceMute, cleaned the code up a bit, made it use team colours instead of changing player teams, which now will not screw up gamemodes, made the GUI look prettier, and fixed a stupid glitch where you could open more than one menu at a time (like the map change window, ServerCMD window, etc.) and when you closed one of them, it would spam errors.
v0.3b: Added Ragdoll Player, and made the command menu items appear in alphabetical order.
v0.2b: Added Warp Player to You, Warp to Player, and Give Weapon.
v0.1b: Fixed the bug where users grow ridiculous amounts of armpit hair.

Nice admin mod, im gonna try it out.

Should I have posted this under the front page of the Lua section (like ASSmod and NewAdmin and stuff) or is the Releases section appropriate?

That NewAdmin thread was the WIP thread, so yes, releases.

Looks alright so far, but you’re missing a few key features:

  • ragdoll (c’mon, it’s a must :v:)
  • return weapons (if you can strip their weapons, why not give them back)
  • goto and bring (these are EXTREMELY important, and are used all the time)

Good job so far. I’ll be using this temporarily. The only way I’ll continue to use this mod is if the above features are added (sorry if I sound like a jackass or snob, just letting you know.)
Good luck.

You actually listed features you wanted included in the mod, thats not snobbish. I’ll get to work on those ASAP, thanks for the feedback. Like I said, this mod is under development, so comments like yours are extremely helpful.

EDIT: I got teleport to and bring working. Give weapons and ragdoll may come soon. I’ll upload the new version when/if those last two get done.

Sorry for the double post, v0.2b is out, with 3/4 of the features Galago requested. With the ragdoll, I can’t figure out how to get the eyes to view from the ragdolls eyes. But anyway… Can anyone help me figure out how to change the title of the thread? I tried editing it, then going to advanced edit, and changing the title, but that has no effect.

Wow, thanks for that! I just need the ragdoll feature and I’m set!

It needed it anyway. Also, thanks to Salads, the items in the menu (except for Give Weapons and the Set/Remove Admin commands) will be arranged alphabetically in the next version.

If you really want to be able to ragdoll people before I release a new version with that plugin, you can download RagMod. I’m not giving up on the ragdoll feature, just saying if you want it bad enough, you could try RagMod.

Yah, I know about RagMod, but I’d prefer just a basic ragdoll/unragdoll feature built into my admin mod. I’m in no hurry.

[editline]02:18PM[/editline]

Sorry for the double post, but sAdmin breaks SPP (Simple Prop Protection), and I won’t be using it until that gets fixed. When sAdmin is in my addons folder, SPP is pretty much void, and people can touch/pick up your stuff… all that happens is it spits out an error.

[editline]02:18PM[/editline]

Automerge is back?!!

I have no idea what Automerge is, but what error do you get when SPP breaks?

Also, I will try and add a simple prop protection system if I can figure out how to do it.

Automerge merges your 2 posts if there are no other posts by other people between them.

Also this should help with the ragdoll thing:

Also to change the title, I don’t know if this works but it occasionally does for me, go to the release section and look for your thread in the list of other threads and double click your title and it will turn into a text box where you can delete and edit it. If that doesn’t work double click about a space after your title and it might work.

Clicking the title takes you to the thread…

And that’s why I said double click, if it works it will not direct you to the thread and instead turn the title into a text box. And did you try clicking just after the title were nothing would happen even if you only clicked once? I also said I’m not entirely sure if it will work, I don’t know if it was something garry couldn’t decide to keep in or what but it has worked from time to time for me.

Also there are no collisions between your mod and the simple prop protection mod as far as I can see, it is probably just that other persons server filled with a bunch of other addons.

Before you click twice you have to click once, and it just takes me to the thread page, but thanks for trying. And yes, I tried clicking close after the end of the thread title, but nothing happens.

Yeah, I don’t know how this could be interfering with the SPP, I would like to see the error that the console gives.

EDIT: I just tested SPP + sAdmin on my Gmod, and everything worked fine. I really need to know what error you get.

It’s quite possible that my one of my other addons is screwed. I can’t give you the error atm (not at that computer), but I AM on a computer with a fairly fresh install of Garry’s Mod, and I’m installing all addons. I’ll give sAdmin another go, and see if I get any more errors. //Will update with results soon

Still getting an error:
Hook ‘SPropProtection.PhysgunPickup’ Failed: includes/extensions/table.lua:103: bad argument #1 to ‘pairs’ (table expected, got nil)

V0.3b Released, added Ragdoll and arranged the menu items in alphabetical order. Will a moderator please change the name of the thread to “sAdmin (Simple Admin Mod)” please? I can’t seem to do it.

Also, a new (and very important) bug… I can’t hear anyone talk through a microphone when sAdmin is installed. The mic. talk icon doesn’t even show.

[editline]01:22AM[/editline]

Another thing I suggest: make the menu only appear when the key bound to SA_CP is held.

You could use

[lua]
function DoStuff()
// Stuff to do when the key is pressed here
end
concommand.Add("+dostuff", DoStuff)

function StopDoingStuff()
// Stuff to do when the key is released here
end
concommand.Add("-dostuff", StopDoingStuff)

RunConsoleCommand(“bind”, “<key>”, “+dostuff”)
// Bind no longer works with ‘RunConsoleCommand’
// Use in-game console instead. ‘bind x +dostuff’. Replace ‘x’ with the wanted key.
[/lua]

Dude, your server is wierd, I can hear people fine over the mic.

Darastrix, it’s not that I don’t know how to make it come up on the hold of a key and go away on the release of it, it’s that I’ve tried it before and it screws stuff up. I’ll list two of the main bugs for you that come when I do that:

  • If you press and release the button really fast, you can double the amount of players you see, because the server is still sending usermessages from the last time you pressed it.
  • Derma doesn’t like it when it tries to reactivate a button and the panel that houses it doesn’t exist (and I don’t know how to check if a panel exists on the screen). <- Knowing this would solve a lot of problems.

So as for the menu, it has to stay like it is for now, and I’m not sure why you can’t hear people on the mics galago. Are you sure they’re talking?