improve forfeitplayer

This commit is contained in:
Fabian Dill 2020-01-24 00:12:23 +01:00
parent d608689d73
commit 94759fd1c4
2 changed files with 5 additions and 5 deletions

View File

@ -323,11 +323,10 @@ async def console(ctx : Context):
slot = int(command[1]) slot = int(command[1])
forfeit_player(ctx, team, slot) forfeit_player(ctx, team, slot)
if command[0] == '/forfeitplayer' and len(command) > 1: if command[0] == '/forfeitplayer' and len(command) > 1:
team = int(command[2]) - 1 if len(command) > 2 and command[2].isdigit() else None seeked_player = command[1].lower()
for client in ctx.clients: for (team, slot), name in ctx.player_names.items():
if client.auth and client.name.lower() == command[1].lower() and (team is None or team == client.team): if name.lower() == seeked_player:
if client.socket and not client.socket.closed: forfeit_player(ctx, team, slot)
forfeit_player(ctx, client.team, client.slot)
if command[0] == '/senditem' and len(command) > 2: if command[0] == '/senditem' and len(command) > 2:
[(player, item)] = re.findall(r'\S* (\S*) (.*)', input) [(player, item)] = re.findall(r'\S* (\S*) (.*)', input)
if item in Items.item_table: if item in Items.item_table:

View File

@ -21,6 +21,7 @@ Basis is a .yaml file that sets these weights. You can find an easy.yaml in this
MultiServer.py MultiServer.py
* Added a try/except to prevent malformed console commands from crashing the entire server * Added a try/except to prevent malformed console commands from crashing the entire server
* /forfeitplayer Playername now works when the player is not currently connected
* Added /hint command on the server (use just /hint for help on command) * Added /hint command on the server (use just /hint for help on command)
can be used as /hint Playername Itemname can be used as /hint Playername Itemname
All Itemnames can be found in Items.py starting at line 25 All Itemnames can be found in Items.py starting at line 25