it actualy works without any complaints
however, if you change your name and join the server with a second client , the server suddenly crashes and i canot think of any reason why that happens therefore i would ask if someone knows a solution to this problem or means to avoid it from occuring
here is the script:
Code: Select all
and the full error:
from commands import name, get_player, add, admin, alias, add
from pyspades.server import *
@alias('nick')
def ingamenamechange(self, *args):
if self.hp == None and self.team.id != -1: return 'You canot change your name while being dead.'
dat_name = ''
old_name = self.name
for kitten in range(len(args)):
if kitten == len(args)-1: dat_name += str(args[kitten])
else: dat_name += (str(args[kitten]) + ' ')
if len(dat_name) > 15 : return 'Your name must contain less than 15 characters!'
elif len(dat_name) <= 0: return 'Your name must consist of at least one character!'
self.name = dat_name
self.world_object.name = dat_name
self.printable_name = dat_name
player_left.player_id = self.player_id
self.protocol.send_contained(player_left)
create_player.player_id = self.player_id
create_player.weapon = self.weapon
create_player.team = self.team.id
create_player.name = dat_name
self.protocol.send_contained(create_player)
self.kill()
self.protocol.irc_say(old_name + " has been renamed to " + dat_name)
return old_name + " has been renamed to " + dat_name
add(ingamenamechange)
def apply_script(protocol, connection, config):
return protocol, connection
Code: Select all
anyone got an idea? (i know its not something of great use, im just asking out of curiosity)Traceback (most recent call last):
File "pyspades\protocol.pyo", line 165, in update
File "run.py", line 885, in data_received
File "pyspades\protocol.pyo", line 117, in data_received
File "pyspades\server.pyo", line 249, in loader_received
File "pyspades\types.pyo", line 110, in __setitem__
KeyError: 'key Dr.Morphman already exists'
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "twisted\internet\base.pyo", line 1162, in run
File "twisted\internet\base.pyo", line 1171, in mainLoop
File "twisted\internet\base.pyo", line 793, in runUntilCurrent
File "twisted\internet\task.pyo", line 194, in __call__
--- <exception caught here> ---
File "twisted\internet\defer.pyo", line 133, in maybeDeferred
File "pyspades\server.pyo", line 1588, in update
File "pyspades\server.pyo", line 1594, in update_network
exceptions.AttributeError: 'NoneType' object has no attribute 'dead'