Prologue
Give me the script goddamnit
How the hell do I use this piece of brainfuck?
Prologue
It all started when I found a random server link in #buildandshoot, and I thought that it was just one of those faggots who advertise for their own servers. Turns out it was actually a league match. ohgodwhy.png
Yeah.
That was unfortunate.
So I got an idea! What if there were a script which prevented certain players from joining specific teams? That way I no one would ever get in such awkward situations again!
Give me the script goddamnit
Okay, okay! Easy on! Here's the code:
Code: Select all
#organiser.py
#by VladVP
from commands import add, admin, name
on_by_default = True
@name('to')
@admin
def toggleorganisation(connection):
global on_by_default
if on_by_default is True:
on_by_default = False
connection.protocol.send_chat("Team organisation disabled!")
else:
on_by_default = True
connection.protocol.send_chat("Team organisation enabled!")
add(toggleorganisation)
def apply_script(protocol, connection, config):
class orgConnection(connection):
def spawn(self):
if on_by_default:
protocol = self.protocol
name = self.name
blue = config.get("team_preset", []).get("blue", [])
green = config.get("team_preset", []).get("green", [])
blueclan = config.get("team_preset", []).get("blueclan", [])
greenclan = config.get("team_preset", []).get("greenclan", [])
if name in blue:
self.team = protocol.blue_team
elif name in green:
self.team = protocol.green_team
else:
for clan in blueclan:
if name.find(clan) + 1:
self.team = protocol.blue_team
return connection.spawn(self)
for clan in greenclan:
if name.find(clan) + 1:
self.team = protocol.green_team
return connection.spawn(self)
self.team = protocol.spectator_team
return connection.spawn(self)
return protocol, orgConnection
How the hell do I use this piece of brainfuck?
Pretty damn simple! Just add this to config.txt:
Code: Select all
By looking at that, you should already have found out how this works. Basically, whenever someone spawns, they will be forced onto the team that their player name is associated with. And if they're not in either list, they will be forced into spectator mode. Plain and simple! "team_preset" : {
"blueclan" : ["{RoT}", "[AK]"],
"blue" : [
"Deuce",
"xXxX1337snipz0r[PRO]XxXx",
"Blueman"
],
"greenclan" : ["[CFKS]", "Ohh|"],
"greenish" : [
"Polak",
"Vlad",
"Greenman"
]
}
I was about to add a /login functonality, but thought that it was probably unneeded, as I've designed this primarily for events and league matches.
UPDATE: Now you can also associate clan tags with teams! Check the above to see how to do that. Also, all JSON objects related to this script are now optional to specify.