def player_connect(event_var): """ Announces the connecting player's country """ if event_var['networkid'] == 'BOT': return tokens = { 'name': event_var['name'], 'location': iptocountry.get_country(event_var['address'])[0] } chat = int(cvar_announce_chat) center = int(cvar_announce_center) hud = int(cvar_announce_hud) es.dbgmsg(0, remove_tags(lang_text('connect', tokens))) for userid in es.getUseridList(): text = lang_text('connect', tokens, playerlib.getPlayer(userid).get('lang')) if chat: if chat == 2: es.tell(userid, '#multi', text) else: usermsg.echo(userid, remove_tags(text)) if center: es.centertell(userid, remove_tags(text)) if hud: usermsg.hudhint(userid, remove_tags(text))
def usermsg_cmd(args): if len(args) == 1: if args[0] == 'list': es.dbgmsg(0, "usermsg fade: Syntax: fade <userid> <0 = no fade, 1 = fade Out 2 = fade in> <time to fade (in frames)> <time faded (in frames)> <red> <green> <blue> <alpha>") es.dbgmsg(0, "usermsg shake: Syntax: shake <userid> <magnitude> <time>") es.dbgmsg(0, "usermsg motd: Syntax: motd <userid> <0 = text, 2 = url> <title> <msg>") es.dbgmsg(0, "usermsg hudhint: Syntax: hudhint <userid> <msg>") es.dbgmsg(0, "usermsg keyhint: Syntax: keyhint <userid> <msg>") es.dbgmsg(0, "usermsg centermsg: Syntax: centermsg <userid> <msg>") else: es.dbgmsg(0, 'usermsg: Invalid parameters, type "usermsg list" to see a list of valid subcommands') elif len(args) > 1: subcommand = args[0] if subcommand == 'fade': if len(args) > 8: usermsg.fade(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]) else: es.dbgmsg(0, "usermsg fade: Syntax: fade <userid> <0 = no fade, 1 = fade Out 2 = fade in> <time to fade (in frames)> <time faded (in frames)> <red> <green> <blue> <alpha>") elif subcommand == 'shake': if len(args) > 3: usermsg.shake(args[1], args[2], args[3]) else: es.dbgmsg(0, "usermsg shake: Syntax: shake <userid> <magnitude> <time>") elif subcommand == 'motd': if len(args) > 4: usermsg.motd(args[1], args[2], args[3], args[4]) else: es.dbgmsg(0, "usermsg motd: Syntax: motd <userid> <0 = text, 2 = url> <title> <msg>") elif subcommand == 'hudhint': if len(args) > 2: usermsg.hudhint(args[1], args[2]) else: es.dbgmsg(0, "usermsg hudhint: Syntax: hudhint <userid> <msg>") elif subcommand == 'keyhint': if len(args) > 2: usermsg.keyhint(args[1], args[2]) else: es.dbgmsg(0, "usermsg keyhint: Syntax: keyhint <userid> <msg>") elif subcommand == 'centermsg': if len(args) > 2: usermsg.centermsg(args[1], args[2]) else: es.dbgmsg(0, "usermsg centermsg: Syntax: centermsg <userid> <msg>") elif subcommand == 'echo': if len(args) > 2: usermsg.echo(args[1], args[2]) else: es.dbgmsg(0, "usermsg echo: Syntax: echo <userid> <msg>") else: es.dbgmsg(0, 'usermsg: Invalid subcommand, type "usermsg list" to see a list of valid subcommands') else: es.dbgmsg(0, 'usermsg: Missing userid and subcommand, type "usermsg list" to see a list of valid subcommands')
def xarates_cmd(): int_userid = es.getcmduserid() xarates.logging.log( 'xarates request by %s (%s)' % (es.getplayersteamid(int_userid), es.getplayername(int_userid))) dict_rates = {} longest_name = 4 longest_rate = 4 longest_cmdrate = 8 longest_updaterate = 11 longest_interp = 6 for instance_player in playerlib.getPlayerList("#all"): int_player = int(instance_player) if es.getplayersteamid(int_player) != "BOT": str_name = es.getplayername(int_player) if len(str_name) > longest_name: longest_name = len(str_name) dict_rates[int_player] = {} str_rate = es.getclientvar(int_player, "rate") dict_rates[int_player]["rate"] = str_rate if len(str_rate) > longest_rate: longest_rate = len(str_rate) str_cmdrate = es.getclientvar(int_player, "cl_cmdrate") dict_rates[int_player]["cmdrate"] = str_cmdrate if len(str_cmdrate) > longest_cmdrate: longest_cmdrate = len(str_cmdrate) str_updaterate = es.getclientvar(int_player, "cl_updaterate") dict_rates[int_player]["updaterate"] = str_updaterate if len(str_updaterate) > longest_updaterate: longest_updaterate = len(str_updaterate) str_interp = es.getclientvar(int_player, "cl_interp") dict_rates[int_player]["interp"] = str_interp if len(str_interp) > longest_interp: longest_interp = len(str_interp) total_len = longest_name + longest_rate + longest_cmdrate + longest_updaterate + longest_interp + 12 usermsg.echo(int_userid, "|%s|" % ("-" * total_len)) usermsg.echo( int_userid, "|%-*s %-*s %-*s %-*s %-*s|" % (longest_name, "Name", longest_rate, "Rate", longest_cmdrate, "CMD Rate", longest_updaterate, "Update Rate", longest_interp, "Interp")) usermsg.echo(int_userid, "|%s|" % ("-" * total_len)) for int_player in dict_rates: usermsg.echo( int_userid, "|%-*s %-*s %-*s %-*s %-*s|" % (longest_name, es.getplayername(int_player), longest_rate, dict_rates[int_player]["rate"], longest_cmdrate, dict_rates[int_player]["cmdrate"], longest_updaterate, dict_rates[int_player]["updaterate"], longest_interp, dict_rates[int_player]["interp"])) usermsg.echo(int_userid, "|%s|" % ("-" * total_len))
def xarates_cmd(): int_userid = es.getcmduserid() xarates.logging.log('xarates request by %s (%s)' % (es.getplayersteamid(int_userid), es.getplayername(int_userid))) dict_rates = {} longest_name = 4 longest_rate = 4 longest_cmdrate = 8 longest_updaterate = 11 longest_interp = 6 for instance_player in playerlib.getPlayerList("#all"): int_player = int(instance_player) if es.getplayersteamid(int_player) != "BOT": str_name = es.getplayername(int_player) if len(str_name) > longest_name: longest_name = len(str_name) dict_rates[int_player] = {} str_rate = es.getclientvar(int_player, "rate") dict_rates[int_player]["rate"] = str_rate if len(str_rate) > longest_rate: longest_rate = len(str_rate) str_cmdrate = es.getclientvar(int_player, "cl_cmdrate") dict_rates[int_player]["cmdrate"] = str_cmdrate if len(str_cmdrate) > longest_cmdrate: longest_cmdrate = len(str_cmdrate) str_updaterate = es.getclientvar(int_player, "cl_updaterate") dict_rates[int_player]["updaterate"] = str_updaterate if len(str_updaterate) > longest_updaterate: longest_updaterate = len(str_updaterate) str_interp = es.getclientvar(int_player, "cl_interp") dict_rates[int_player]["interp"] = str_interp if len(str_interp) > longest_interp: longest_interp = len(str_interp) total_len = longest_name + longest_rate + longest_cmdrate + longest_updaterate + longest_interp + 12 usermsg.echo(int_userid, "|%s|" % ("-" * total_len)) usermsg.echo(int_userid, "|%-*s %-*s %-*s %-*s %-*s|" % (longest_name, "Name", longest_rate, "Rate", longest_cmdrate, "CMD Rate", longest_updaterate, "Update Rate", longest_interp, "Interp")) usermsg.echo(int_userid, "|%s|" % ("-" * total_len)) for int_player in dict_rates: usermsg.echo(int_userid, "|%-*s %-*s %-*s %-*s %-*s|" % (longest_name, es.getplayername(int_player), longest_rate, dict_rates[int_player]["rate"], longest_cmdrate, dict_rates[int_player]["cmdrate"], longest_updaterate, dict_rates[int_player]["updaterate"], longest_interp, dict_rates[int_player]["interp"])) usermsg.echo(int_userid, "|%s|" % ("-" * total_len))
def player_connect(event_var): """ Announces the connecting player's country """ if event_var['networkid'] == 'BOT': return tokens = {'name': event_var['name'], 'location': iptocountry.get_country(event_var['address'])[0]} chat = int(cvar_announce_chat) center = int(cvar_announce_center) hud = int(cvar_announce_hud) es.dbgmsg(0, remove_tags(lang_text('connect', tokens))) for userid in es.getUseridList(): text = lang_text('connect', tokens, playerlib.getPlayer(userid).get('lang')) if chat: if chat == 2: es.tell(userid, '#multi', text) else: usermsg.echo(userid, remove_tags(text)) if center: es.centertell(userid, remove_tags(text)) if hud: usermsg.hudhint(userid, remove_tags(text))
def echo(self, filter, level, string, tokens={}, prefix=False): # Setup filter filter = self.__format_filter(filter) ''' # Is the debug level high enough? if int(gungameDebugLevel) < level: return ''' # Format the message with the prefix if needed prefix = self.__format_prefix(prefix, string) # Check if this is a normal message if not str(string) in __strings__: # Get clean string string = self.__clean_string(string) # Console or Userid if isinstance(filter, int): # Send message return usermsg.echo(filter, '%s%s' % (prefix, string)) # Send message to the userids from the playerlib filter for userid in getUseridList(filter): # Send message usermsg.echo(userid, '%s%s' % (prefix, string)) else: # Console or Userid if isinstance(filter, int): # Get clean string string = self.__clean_string( self.__format_string(string, tokens, filter)) # Send message return usermsg.echo(filter, '%s%s' % (prefix, string)) # Send message to the userids from the playerlib filter for userid in getUseridList(filter): # Send message usermsg.echo( userid, '%s%s' % (prefix, self.__clean_string( self.__format_string(string, tokens, userid))))
def echo(self, filter, level, string, tokens={}, prefix=False): # Setup filter filter = self.__format_filter(filter) ''' # Is the debug level high enough? if int(gungameDebugLevel) < level: return ''' # Format the message with the prefix if needed prefix = self.__format_prefix(prefix, string) # Check if this is a normal message if not str(string) in __strings__: # Get clean string string = self.__clean_string(string) # Console or Userid if isinstance(filter, int): # Send message return usermsg.echo(filter, '%s%s' % (prefix, string)) # Send message to the userids from the playerlib filter for userid in getUseridList(filter): # Send message usermsg.echo(userid, '%s%s' % (prefix, string)) else: # Console or Userid if isinstance(filter, int): # Get clean string string = self.__clean_string(self.__format_string(string, tokens, filter)) # Send message return usermsg.echo(filter, '%s%s' % (prefix, string)) # Send message to the userids from the playerlib filter for userid in getUseridList(filter): # Send message usermsg.echo(userid, '%s%s' % (prefix, self.__clean_string(self.__format_string(string, tokens, userid))))
def credits_cmd(): userid = es.getcmduserid() usermsg.echo(userid, ' == eXtensible Admin Credits ==') usermsg.echo(userid, 'The following people helped create XA') usermsg.echo(userid, 'Project Lead: NATO|Hunter') usermsg.echo(userid, 'Release Manager: Errant') usermsg.echo(userid, 'Community Manager: Freddukes') usermsg.echo(userid, 'Website: Ojii') usermsg.echo(userid, 'Eventscripts: Mattie') usermsg.echo(userid, ' ') usermsg.echo(userid, '# Contributors') usermsg.echo(userid, 'Superdave,Venjax,jeff91,juba_pornborn,Sumguy41') usermsg.echo(userid, 'HitThePipe,Undead,British.Assassin,101Satoon101') usermsg.echo(userid, 'adminc,Soynuts,XE_ManUp,JoeyT2006,Omega_K2,colster') usermsg.echo(userid, 'dajayguy,awuh0,AMMUT,chatcon,chrisber,chriske21') usermsg.echo(userid, 'claridon,Einlanzers,GODJonez,JAMES,rio,thekiller') usermsg.echo(userid, 'tim3port,Brettonawak')
def usermsg_cmd(args): if len(args) == 1: if args[0] == 'list': es.dbgmsg( 0, "usermsg fade: Syntax: fade <userid> <0 = no fade, 1 = fade Out 2 = fade in> <time to fade (in frames)> <time faded (in frames)> <red> <green> <blue> <alpha>" ) es.dbgmsg( 0, "usermsg shake: Syntax: shake <userid> <magnitude> <time>") es.dbgmsg( 0, "usermsg motd: Syntax: motd <userid> <0 = text, 2 = url> <title> <msg>" ) es.dbgmsg(0, "usermsg hudhint: Syntax: hudhint <userid> <msg>") es.dbgmsg(0, "usermsg keyhint: Syntax: keyhint <userid> <msg>") es.dbgmsg(0, "usermsg centermsg: Syntax: centermsg <userid> <msg>") else: es.dbgmsg( 0, 'usermsg: Invalid parameters, type "usermsg list" to see a list of valid subcommands' ) elif len(args) > 1: subcommand = args[0] if subcommand == 'fade': if len(args) > 8: usermsg.fade(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]) else: es.dbgmsg( 0, "usermsg fade: Syntax: fade <userid> <0 = no fade, 1 = fade Out 2 = fade in> <time to fade (in frames)> <time faded (in frames)> <red> <green> <blue> <alpha>" ) elif subcommand == 'shake': if len(args) > 3: usermsg.shake(args[1], args[2], args[3]) else: es.dbgmsg( 0, "usermsg shake: Syntax: shake <userid> <magnitude> <time>") elif subcommand == 'motd': if len(args) > 4: usermsg.motd(args[1], args[2], args[3], args[4]) else: es.dbgmsg( 0, "usermsg motd: Syntax: motd <userid> <0 = text, 2 = url> <title> <msg>" ) elif subcommand == 'hudhint': if len(args) > 2: usermsg.hudhint(args[1], args[2]) else: es.dbgmsg(0, "usermsg hudhint: Syntax: hudhint <userid> <msg>") elif subcommand == 'keyhint': if len(args) > 2: usermsg.keyhint(args[1], args[2]) else: es.dbgmsg(0, "usermsg keyhint: Syntax: keyhint <userid> <msg>") elif subcommand == 'centermsg': if len(args) > 2: usermsg.centermsg(args[1], args[2]) else: es.dbgmsg( 0, "usermsg centermsg: Syntax: centermsg <userid> <msg>") elif subcommand == 'echo': if len(args) > 2: usermsg.echo(args[1], args[2]) else: es.dbgmsg(0, "usermsg echo: Syntax: echo <userid> <msg>") else: es.dbgmsg( 0, 'usermsg: Invalid subcommand, type "usermsg list" to see a list of valid subcommands' ) else: es.dbgmsg( 0, 'usermsg: Missing userid and subcommand, type "usermsg list" to see a list of valid subcommands' )
def credits_cmd(): userid = es.getcmduserid() usermsg.echo(userid,' == eXtensible Admin Credits ==') usermsg.echo(userid,'The following people helped create XA') usermsg.echo(userid,'Project Lead: NATO|Hunter') usermsg.echo(userid,'Release Manager: Errant') usermsg.echo(userid,'Community Manager: Freddukes') usermsg.echo(userid,'Website: Ojii') usermsg.echo(userid,'Eventscripts: Mattie') usermsg.echo(userid,' ') usermsg.echo(userid,'# Contributors') usermsg.echo(userid,'Superdave,Venjax,jeff91,juba_pornborn,Sumguy41') usermsg.echo(userid,'HitThePipe,Undead,British.Assassin,101Satoon101') usermsg.echo(userid,'adminc,Soynuts,XE_ManUp,JoeyT2006,Omega_K2,colster') usermsg.echo(userid,'dajayguy,awuh0,AMMUT,chatcon,chrisber,chriske21') usermsg.echo(userid,'claridon,Einlanzers,GODJonez,JAMES,rio,thekiller') usermsg.echo(userid,'tim3port,Brettonawak')