I've this ES snippet
Syntax: Select all
import es
def load():
es.addons.registerClientCommandFilter(cc_filter)
def unload():
es.addons.unregisterClientCommandFilter(cc_filter)
def cc_filter(userId, args):
if args[0].lower() == 'jointeam':
team = getPlayer(userId).getAllowedTeam()
es.server.queuecmd('es_xchangeteam %i %i' % (userId, teams[team]))
return False
return True
That basically, whenever a player connects and choses a team, i force the user to join the team he specified elsewhere (in this case website, it's for a simple pug system), hence the team = ..
It's works nicelly, but i'm having issues porting this to SP, the code i have
Syntax: Select all
from commands.client import ClientCommandManager
def load():
ClientCommandManager.register_filter(client_command_filter)
def unload():
ClientCommandManager.unregister_filter(client_command_filter)
def client_command_filter(player, CCommand):
print('Testing')
'''
if CCommand == 'jointeam':
team = getPlayer(userId).getAllowedTeam()
es.server.queuecmd('es_xchangeteam %i %i' % (userId, teams[team]))
return False
return True
'''
But it always says that the plugin was unable to be loaded and is there a way to have better debugging so that i know where it's wrong?