Topic: [Addon] Easy Admin

EASY ADMIN 1.8.0
Easily keeping you safe.

Easy Admin, a.k.a "EA Script" is a simplistic addon tailored specifically to replace unnecessary use of BF2CC in Sandbox Mod.  It is made with the average sandbox server owner in mind, and does not employ any unecessary commands nor does it require PB, so even PB-troubled servers can use EA Script.  Although, that's not to say PB isn't supported. wink

EA Script has been tested profusely to ensure it poses no danger to the server it is used on or any users that it may or may not deal with.  This makes EA Script the first, only and safest addon-based server administration utility.

Don't want to bother with BF2CC?  Choose Easy Admin today!

Noted Issues
Keeping you informed.

After every update of EA Script, please read this area so you can be aware of any known issues to ensure the least chance of unsafe use.

-Due to an issue with the Permissions tag, you are highly, highly, HIGHLY encouraged to manually add the Easy Admin commands to your server permissions instead of relying on the built in one.  There have been cases where the Permissions tagged had failed to work on some servers, allowing anyone to use the Easy Admin commands.  This poses a serious threat to your server!

NAME 	= "EasyAdmin"
VERSION = "1.8.0"
AUTHOR 	= "Andokool12"
WEBSITE = "www.cheetocommunity.co.cc"
COMMANDS = {
	"kick": ["Kicks the player via ID.  If PB is on, use @pbkick instead."],
	"ban": ["Bans the player via ID, for how long.  If PB is on, use @pbban instead."],
	"an": ["Announce something in the top chat."],
	"scream": ["Giant annoying green text version of announce."],
	"banlist": ["A list of banned IP addresses in the server's console.  Use @pbbanlist if PB is on."],
	"unban": ["Unban a user via IP address.  If PB is on, use @pbunban instead."],
	"nukebans": ["Unban everyone banned on the server.  Only works if PB is enabled."],
	"nextmap": ["Displays next map."],
	"reboot": ["Restart the current map."],
	"runnextmap": ["Run the next map."],
	"help": ["Get help."],
	"advert": ["Quickly advertise EA Script."],
	"maintenance": ["Does maintenance automatically.  DOES NOT REQUIRE A RESTART!"],
	"pbkick": ["Kicks players via Punkbuster.  MUCH more stable than @kick.  Only works if PB is enabled."],
	"pbban": ["Bans players via Punkbuster.  MUCH more stable than @ban.  Only works if PB is enabled."],
	"players": ["Shows a list of players in the server's console."],
	"pbbanlist": ["Works like @banlist, just more stable and uses PB."],
	"pbunban": ["Works like @unban, just uses PB instead and is obviously more stable because of this."]
	}

PERMISSIONS = {
    "chat": {
        "kick": 20,
        "ban": 20,
	"an": 20,
	"scream": 20,
	"banlist": 20,
	"unban": 20,
	"nukebans": 21,
	"nextmap": 20,
	"reboot": 20,
	"runextmap": 20,
	"ifail": 20,
	"help": 20,
	"advert": 20,
	"maintenance": 20
    }
}

import host

class Addon:
	
	def __init__(self, core):
		self.core = core
		self.time = 0
		self.EAv = "1.8.0"
		self.PB = False
		self.AUB = False
		self.PBSS = False

	def chat_kick(self, p, params):
		host.rcon_invoke("admin.kickplayer " + str(params[0]))

	def chat_ban(self, p, params):
		host.rcon_invoke("admin.banplayer " + str(params[0]))

	def chat_an(self, p, params):
		self.core.sendMsg(" ".join(params))

	def chat_scream(self, p, params):
		self.core.sendMsg("§3" + " ".join(params))

	def chat_banlist(self, p, params):
		host.rcon_invoke("admin.listBannedAddresses ")

	def chat_unban(self, p, params):
		host.rcon_invoke("admin.removeAddressFromBanList " + str(params[0]))

	def chat_nukebans(self, p, params):
		host.rcon_invoke("PB_SV_BanEmpty ")
		self.core.sendMsg("The ban list has been cleared.")

	def chat_setnext(self, p, params):
		host.rcon_invoke("maplist.insert " + str(params[0]))

	def chat_reboot(self, p, params):
		host.rcon_invoke("admin.restartMap ")

	def chat_runnextmap(self, p, params):
		host.rcon_invoke("admin.runNextLevel ")

	def chat_help(self, p, params):
		p.sendMsg("Yo, I'm too lazy to update this command with every revision so just type @ainfo EasyAdmin or whatever it's saved as.")

	def chat_advert(self, p, params):
		self.core.sendMsg("This server is running EasyAdmin " + str(self.EAv) + ".  Who needs BF2CC!?")

	def chat_maintenance(self, p, params):
		host.rcon_invoke("PB_SV_Enable ")
		self.core.sendMsg("PB Re-enabled.")
		host.rcon_invoke("PB_SV_BanLoad ")
		self.core.sendMsg("Banlist reloaded.")
		host.rcon_invoke("PB_SV_UpdBanFile ")
		self.core.sendMsg("Banlist updated.")
		host.rcon_invoke("PB_SV_Update ")
		self.core.sendMsg("Updating client-side PB.")
		host.rcon_invoke("PB_SV_WriteCfg ")
		self.core.sendMsg("Updating config files - Current server settings saved.")
		
	def chat_pbkick(self, p, params):
		host.rcon_invoke("PB_SV_Kick " + str(params[0]))
		
	def chat_pbban(self, p, params):
		host.rcon_invoke("PB_SV_Ban " + str(params[0]))
		
	def chat_players(self, p, params):
		host.rcon_invoke("PB_SV_PList")
	
	def chat_pbbanlist(self, p, params):
		host.rcon_invoke("PB_SV_BanList ")

	def chat_pbunban(self, p, params):
		host.rcon_invoke("PB_SV_UnBan " + str(params[0]))

	def tickOneSec(self):
		self.time += 1
		time = 1440 - self.time
		if self.time == 0:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 60:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 120:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 180:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 240:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 300:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 360:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 420:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 480:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 540:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 600:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 660:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 720:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 780:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 840:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 900:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 960:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 1020:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 1080:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 1140:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 1200:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 1260:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 1320:
			self.core.sendMsg("§3" + "This server runs on Easy Admin " + str(self.EAv) + ".")
		if self.time == 1380:
			self.core.sendMsg("Easy Admin is written and developed by Andokool12.  www.cheetocommunity.co.cc")
		if self.time == 1440:
			self.time = 0

Last edited by Andokool12 (2010-04-21 14:48:05)

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

cool thanks this should work well for my friends lan partys. ty

REMEMBER THE SEARCH BUTTON!!!

Original Signature thought up by: Andokool12

Re: [Addon] Easy Admin

getting much better at coding ando smile btw you forgot the ifail command  big_smile

Re: [Addon] Easy Admin

What the heck...  That's actually quite odd, because @ifail works in game.

OOOOOPS!  Looks like I didn't copy the whole thing.  Fixed.

Last edited by Andokool12 (2009-09-17 01:09:29)

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

lol! that could be helpful. i will test both for syntax error again.

REMEMBER THE SEARCH BUTTON!!!

Original Signature thought up by: Andokool12

Re: [Addon] Easy Admin

Updated to version 1.5.  Now has permissions set to level 20, and announce and scream have been fixed.

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

OP Updated.  A proper introduction is now available that gives necessary info, and the code has been refined a little.

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

This is very usefull addon, thanks

This is my way as Sandbox Engineer =SB(E=
"There are just lots of disturbing ideas that i cannot refuse..."

Re: [Addon] Easy Admin

No problem :3

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

Hey ando, that advert thing, i think you should make it auto say

maybe like ever 5 minutes or something

something like

	def __init__(self, core):
		self.core = core
		self.advert = 0
		self.EAv = "1.5"
	def tickOneSec(self):
		self.advert += 1
		if self.advert == 300:
			self.core.sendMsg("This server is running EasyAdmin " + str(self.EAv) + ".  Who needs BF2CC!?")

Last edited by mikemrm (2009-11-17 00:04:12)

http://serenity-clan.com/serenity/downloads/logorp.png
http://www.speedtest.net/result/877330355.png
^^^ LEGIT look at the image location^^^

Re: [Addon] Easy Admin

Ah, not bad, thanks!  big_smile  I was just thinking of that earlier today.

I will update the script with that now, giving you credit.

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

kwl

http://serenity-clan.com/serenity/downloads/logorp.png
http://www.speedtest.net/result/877330355.png
^^^ LEGIT look at the image location^^^

Re: [Addon] Easy Admin

I like this script, if only you could choose the map you want... roll

Re: [Addon] Easy Admin

meur1234 wrote:

I like this script, if only you could choose the map you want... roll

You probably could with just a little extra lines of code, i think i could edit it to make that work dunno ill look into it


hmm i guess not cannot find it, i thought there was an admin.changemap mapname or something, try looking at the bf2cc codes see how they do it

i was thinking if there was a way to set the next map to something then you could do something like
remove next map
add next map

or something like that

Last edited by mikemrm (2009-11-17 02:20:02)

http://serenity-clan.com/serenity/downloads/logorp.png
http://www.speedtest.net/result/877330355.png
^^^ LEGIT look at the image location^^^

Re: [Addon] Easy Admin

You need to alter the

host.rcon_invoke("maplist.list")

and put the new map in the ID slot after the

host.rcon_invoke("maplist.currentMap") / host.rcon_invoke("admin.currentMap") (one of these two is the right command),

with

host.rcon_invoke("maplist.insert")

then run

host.rcon_invoke("admin.runNextLevel")

and remove the map from the maplist with

host.rcon_invoke("maplist.remove").

Re: [Addon] Easy Admin

admin.changemap is broken, take a look at the clear addon.

Bullace: *******
Freeze-18: i read that as triggers
Bullace: lol

Re: [Addon] Easy Admin

Andokool12 wrote:
	def tickOneSec(self):
		self.advert += 1
		if self.advert == 300:
			self.core.sendMsg("This server is running EasyAdmin " + str(self.EAv) + ".  Who needs BF2CC!?")

Doesn't it have to reset the counter when it is at 300? Something like this:

	def tickOneSec(self):
		self.advert += 1
		if self.advert == 300:
			self.core.sendMsg("This server is running EasyAdmin " + str(self.EAv) + ".  Who needs BF2CC!?")
			self.advert = 0

Or am I just wrong?

Re: [Addon] Easy Admin

Although I haven't tinkered with tickOneSec much I think it measures by how many seconds have gone by since the last time it registered an amount.

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

terminator is right, also Ando check the mutiny addon.

Bullace: *******
Freeze-18: i read that as triggers
Bullace: lol

Re: [Addon] Easy Admin

Alright

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

In the coming days, slight patches will be applied and will hopefully end up in the release on 1.7 by either Saturday or Sunday.

Updates include switching many commands over to PB instead of the built in rcon, an added auto-maintenance command for more technical administrators (@maintenance) and many fixes for dead commands/messed up code.

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

Make sure you throw in a check to see if the person has spawned at least once, no spawn = pb kick not working (dunno what happens to ban, I guess that one will work).

Sandbox has one for that already btw which is playerObject.firstSpawn
(returns True if player has not spawned once)

so something like

if not p.firstspawn: (guessing you are using p for the player)
<sometab>pb kick here
else:
<sometab>sv.kickplayer blabla

Bullace: *******
Freeze-18: i read that as triggers
Bullace: lol

Re: [Addon] Easy Admin

Updated.  It's not 1.7, but it's a little stability update, along with @maintenance added.

Last edited by Andokool12 (2010-02-07 20:11:15)

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

[s]Updated.  Still not 1.7, but now also has a small manual maintenance code.  Is now 1.6.8.[/s]

Manual maintenance removed due to problematic nature.

Last edited by Andokool12 (2010-03-02 23:24:17)

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png

Re: [Addon] Easy Admin

Updated to 1.6.9.  Server crashing problem that occurs on a kick has been addressed and fixed, and manual maintenance fully removed.

Apologies to any administrators experiencing issues with EA Script over the past few hectic weeks as I have been lazily updating it.  If any problems still occur, please report them and I will fix them ASAP.

Last edited by Andokool12 (2010-03-08 15:31:34)

http://cheetocommunity.xsjefkex.com/upload/users/Andokool12/searchbuttonsbx.jpg <-- Click it, it works.
http://i296.photobucket.com/albums/mm166/drentrix/CheetoCLogo2-Copy.png