def load(): public = es.ServerVar('hu_qs', info.version, info.name) public.makepublic() quake_sounds_players = {} for userid in es.getUseridList(): quake_sounds_players[userid] = {'kills':0,'multikills':0,'headshot':False,'headshots':0} quake_sounds_setting.clearoption() quake_sounds_kv.load(es.getAddonPath('quake_sounds')+'/quake_sounds.txt') for keyname in quake_sounds_kv['styles']: quake_sounds_setting.addoption(str(keyname), str(quake_sounds_kv['styles'][str(keyname)])) quake_sounds_setting.addoption('off', 'Off') quake_sounds_setting.setdefault(str(quake_sounds_default)) quake_sounds_setting.addsound('ui/buttonclick.wav') es.regsaycmd('!quake', 'quake_sounds/saycmd', 'Quake Sounds Style') es.addons.registerForEvent(quake_sounds_module, 'player_changename', _check_event) es.addons.registerForEvent(quake_sounds_module, 'player_info', _check_event) es.addons.registerForEvent(quake_sounds_module, 'player_say', _check_event) es.addons.registerForEvent(quake_sounds_module, 'round_freeze_end', _check_event) es.addons.registerForEvent(quake_sounds_module, 'round_end', _check_event) es.addons.registerForEvent(quake_sounds_module, 'bomb_planted', _check_event) es.addons.registerForEvent(quake_sounds_module, 'bomb_defused', _check_event) es.log(hunter_quake_sounds_text) es.msg('#multi', '#green[QuakeSounds] #defaultLoaded')
def player_say(ev): userid = ev['userid'] text = ev['text'] plyinst = playerlib.getPlayer(userid) if text == '!block' or text == '!unghost': if int(es.ServerVar('noblock_allow_block')) >= 1: if not plyinst.isdead and plyinst.teamid != 1 and plyinst.teamid != 0: try: if not players[userid]['queued']: plyinst.noblock(0) gamethread.delayedname(float(es.ServerVar('noblock_block_time')), userid, noblock, userid) players[userid]['queued'] = True es.tell(userid, '#multi', '#green[NoBlock]#default You are now solid for ' + float(es.ServerVar('noblock_block_time')) + ' seconds') else: es.tell(userid, '#multi', '#green[NoBlock]#default You are already blocking') except KeyError: es.msg('#green', 'Error in keys') for k, v in players.items(): es.msg('#green', str(k) + '=' + str(v)) else: es.tell(userid, '#multi', '#green[NoBlock]#default You cannot block when you are dead or not on a team') else: es.tell(userid, '#multi', '#green[NoBlock]#default Blocking is not allowed on this server') if text == '!noblock' or text == '!unblock' or text == '!ghost': if int(es.ServerVar('noblock_allow_block')) >= 1: if not plyinst.isdead and plyinst.teamid != 1 and plyinst.teamid != 0: if players[userid]['queued']: gamethread.cancelDelayed(userid) plyinst.noblock(1) es.tell(userid, '#multi', '#green[NoBlock]#default You are no longer solid') else: es.tell(userid, '#multi', '#green[NoBlock]#default You are not blocking') else: es.tell(userid, '#multi', '#green[NoBlock]#default You cannot unblock when dead or not on a team') else: es.tell(userid, '#multi', '#green[NoBlock]#default Cannot unblock because blocking is not allowed')
def unload(): gamethread.cancelDelayed("advertDelay") cmdlib.unregisterServerCommand("dump_colors") es.msg( "#multi", "\x07FF8D00[\x0703B0FFSimple Adverts\x07FF8D00] \x0703B0FF%s \x07FF8D00successfully unloaded!" % info.version, )
def load(): for k, v in cvars.items(): es.ServerVar(k, 0, v) es.server.cmd('exec noblock') es.ServerVar('noblock_version', '1.0.0', 'The version of the ES Python noblock script') for k in playerlib.getPlayerList(): players[k.userid] = dict(queued=False) if(es.getInt('noblock_load_advert')): es.msg('#multi', '#green[NoBlock]#default NoBlock has been loaded')
def announce(text): """Broadcast a message, viewable by everyone on the server. Arguments: text - The text to announce. """ es.msg(_format_text(text))
def load(): es.set("simple_adverts", info.version) es.makepublic("simple_adverts") gamethread.delayedname(advert.delay, "advertDelay", advert.endDelay) cmdlib.registerServerCommand("dump_colors", advert.dumpColors, "") es.msg( "#multi", "\x07FF8D00[\x0703B0FFSimple Adverts\x07FF8D00] \x0703B0FF%s \x07FF8D00successfully loaded!" % info.version, )
def start(self): global started, changed self.useridList = es.getUseridList() for userid in self.useridList: player = playerlib.getPlayer(userid) if player.team < 2 or player.isdead: self.useridList.remove(userid) if len(self.useridList) < 3: es.centermsg("You have to have more than 3 players to play the Assassin mod!") return None if self.useridList: ultilib.removeMapObjective() if self.manualAssassinID: self.assassinID = self.manualAssassinID self.useridList.remove(self.assassinID) else: self.assassinID = self._selectOneUserid() if self.manualVipID: self.vipID = self.manualVipID self.useridList.remove(self.vipID) else: self.vipID = self._selectOneUserid() self.vip = VIP(self.vipID) self.assassin = Assassin(self.assassinID) self.guards = {} for userid in self.useridList: self.guards[userid] = Guard(userid) self.vip.prepare(self) self.assassin.prepare(self) for userid in self.guards.keys(): self.guards[userid].prepare(self) self.aInvisibilityInfo = {"userid": None, "weapon": None, "color": None} if not changed: es.set("mp_limitteams", 20) es.set("mp_friendlyfire", 1) es.set("mp_autoteambalance", 0) es.set("sv_alltalk", 1) changed = True started = True roundtime = int(float(es.ServerVar("mp_roundtime")) * 60.0) roundtime += int(float(es.ServerVar("mp_freezetime")) * 60.0) gamethread.cancelDelayed("vipwins") gamethread.delayedname(roundtime,"vipwins", self.vipWins) es.msg("#multi", "#green[UltiAssassin 1.1]#defaultYou're playing the UltiAssassin!") self.started = True
def advertisement(index=0): if training_advertise > 0 and ip_trainingserver_enable > 0: if len(advertisements): es.msg("#multi", advertisements[index]) index += 1 if index >= len(advertisements): index = 0 gamethread.delayedname(training_advert_timer, "advertisements", advertisement, index)
def unload(): es.unregsaycmd('!quake') es.addons.unregisterForEvent(quake_sounds_module, 'player_changename') es.addons.unregisterForEvent(quake_sounds_module, 'player_info') es.addons.unregisterForEvent(quake_sounds_module, 'player_say') es.addons.unregisterForEvent(quake_sounds_module, 'round_freeze_end') es.addons.unregisterForEvent(quake_sounds_module, 'round_end') es.addons.unregisterForEvent(quake_sounds_module, 'bomb_planted') es.addons.unregisterForEvent(quake_sounds_module, 'bomb_defused') es.msg('#multi', '#green[QuakeSounds] #defaultUnloaded')
def load(): if ip_trainingserver_enable > 0: if training_advertise > 0: global advertisements advertisements = [] AddonPath = es.getAddonPath('ip_trainingserver') advertisement_file = open(AddonPath+'/advertisements.txt') for adline in advertisement_file: advertisements.append(adline.replace('\n', '')) advertisement_file.close advertisement() es.msg("#multi", "#lightgreen[#greenIP#lightgreen]#default Server now in training mode")
def plant(self, userid, site, mapname): if active: if site != bombsitesNum[self.defaultSiteLetter]: if es.getplayersteamid(userid) != 'BOT': playerlib.getPlayer(userid).set("push", (0, 300, 1)) es.tell(userid, '#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#lightgreen]#default Due to the low number of CT\'s this round, you must #lightgreenonly plant at site #green%s#lightgreen!'%self.defaultSiteLetter) es.centertell(userid, 'You must only plant at %s site!'%self.defaultSiteLetter) gamethread.delayed(1, es.centertell, (userid, 'You must only plant at %s site!'%self.defaultSiteLetter)) else: x, y, z = random.choice(coords) es.server.queuecmd('es_xsetpos %s %s %s %s'%(userid, x, y, z)) es.msg('#multi','#green[#lightgreenBombsite#green-#lightgreenLimiter#green]#lightgreen %s #defaultwas teleported for planting at the wrong bombsite and being a bot!' % es.getplayername(userid))
def TeamChat(userid, text, teamonly): text = str(str(text).strip('"')) if es.exists('saycommand',text.split(' ')[0]) or text.split(' ')[0].lower() in ["!vote","!kick","!ban","!tele","!teleport","!burn","!slay","!noclip","!beacon","!happy","!slap","!nominate","!rtv","rtv","/rtv","votekick","voteban","!votekick","!voteban","!me","/me"]: return (userid, text, teamonly) else: if es.getplayerteam(userid) == 1: return (userid, text, teamonly) if es.getplayerteam(userid) == 2: es.msg('#multi','[#greenInfected#default] %s: #default%s'%(es.getplayername(userid),text)) if es.getplayerteam(userid) == 3: es.msg('#multi','[#greenSurvivor#default] %s: #default%s'%(es.getplayername(userid),text)) es.cexec_all('play common/talk.wav') return (0, None, None)
def doWork(arg1, arg2): global checkTeabag victim = playerlib.getPlayer(arg1) attacker = playerlib.getPlayer(arg2) isDucking = es.getplayerprop(arg2, 'CBasePlayer.localdata.m_Local.m_bDucked') victimPos = victim.x + victim.y + victim.z attackerPos = attacker.x + attacker.y + attacker.z if (attackerPos - victimPos) <= 50: # Change this to change sensitivity if isDucking > 0: checkTeabag.stop es.centermsg("%s just got teabagged!!!" % victim.name) es.emitsound(player, arg2, 'bot/owned.wav', 1.0, 0.5) es.msg("#multi", "#lightgreen[#greenTea-Bag#lightgreen] %s#default has just tea-bagged #lightgreen%s#default!" % (attacker.name, victim.name))
def _admin_say(userid, message, teamonly): tokens = {} tokens['username'] = es.getplayername(userid) tokens['message'] = message if teamonly: admins = playerlib.getPlayerList("#admin_say") for j in admins: # "#green[Admin Only]#lightgreen $username: #default$message" % (es.getplayername(userid), message) es.tell(int(j), "#multi", text("admin only message", tokens)) play_admin_say_sound(int(j)) else: es.msg("#multi", text("admin say message", tokens)) play_admin_say_sound() # kill the message return (0, "", 0)
def show_time(): """ """ int_userid = es.getcmduserid() xathetime.logging.log('requested the current time' % int_userid) tuple_time = time.localtime(time.time() + (60 * int(adjust_time))) if int(military_time): int_hour = tuple_time[3] else: int_hour = tuple_time[3] % 12 str_time = '%s:%02d %s %s-%s-%s' % (int_hour, tuple_time[4], thetime_timezone, tuple_time[2], tuple_time[1], tuple_time[0]) if int(thetime_player_only): es.tell(int_userid, str_time) else: es.msg(str_time)
def exp(args_dummy): args = es.getargs() if ('\(' in args) or ('\)' in args): args = args.replace('\(', '%left%').replace('\)', '%right%').replace('\"', '%quote%') if args and ('(' in args) and (')' in args): global funcs global uxpfuncs global regex1 global srcdsargs if args.count('"') % 2: args += '"' infuncs = regex1.findall(''.join(re.findall('"[^"]*"|([^"]+)', args))) if infuncs: regex2 = re.compile('(' + '|'.join(infuncs) + ')\\((("[^\\(\\)"]*"|[^\\(\\)"]+)*)\\)') temp = True count = 10 while temp: count -= 1 if not count: temp = 0 regex = regex2.search(args) if regex: regex = regex.groups() func = regex[0] val = regex[1] es.msg(func + '(' + val + ')') if func in funcs: if not func in ('nq', 'eq'): es.server.cmd('_exp_eval ' + val) else: srcdsargs = val if len(srcdsargs) >= funcs[func]['minargs']: if func in uxpfuncs: uxp_eval(func, srcdsargs) result = es.server_var['_uxp_result'] else: funcpointer = funcs[func]['function'] result = funcpointer(srcdsargs) if not func in ('nq', 'eq'): result = '"' + result + '"' else: result = '0' args = args.replace(func + '(' + val + ')', result) else: temp = False args = args.replace('%left%', '(').replace('%right%', '(').replace('%quote%', '"') es.server.cmd(args)
def exp(args_dummy): args = es.getargs() if ("\(" in args) or ("\)" in args): args = args.replace("\(", "%left%").replace("\)", "%right%").replace('"', "%quote%") if args and ("(" in args) and (")" in args): global funcs global uxpfuncs global regex1 global srcdsargs if args.count('"') % 2: args += '"' infuncs = regex1.findall("".join(re.findall('"[^"]*"|([^"]+)', args))) if infuncs: regex2 = re.compile("(" + "|".join(infuncs) + ')\\((("[^\\(\\)"]*"|[^\\(\\)"]+)*)\\)') temp = True count = 10 while temp: count -= 1 if not count: temp = 0 regex = regex2.search(args) if regex: regex = regex.groups() func = regex[0] val = regex[1] es.msg(func + "(" + val + ")") if func in funcs: if not func in ("nq", "eq"): es.server.cmd("_exp_eval " + val) else: srcdsargs = val if len(srcdsargs) >= funcs[func]["minargs"]: if func in uxpfuncs: uxp_eval(func, srcdsargs) result = es.server_var["_uxp_result"] else: funcpointer = funcs[func]["function"] result = funcpointer(srcdsargs) if not func in ("nq", "eq"): result = '"' + result + '"' else: result = "0" args = args.replace(func + "(" + val + ")", result) else: temp = False args = args.replace("%left%", "(").replace("%right%", "(").replace("%quote%", '"') es.server.cmd(args)
def load(): public = es.ServerVar('hu_bt', info.version, info.name) public.makepublic() cmdlib.registerSayCommand('!bombtimer', _say_cmd, 'Bomb Timer') bomb_timer_config.execute() bomb_timer_setting.addoption('display', 'Display') bomb_timer_setting.addoption('text', 'Text') bomb_timer_setting.addoption('sound', 'Sound') bomb_timer_setting.setdefault('display', int(bomb_timer_default_display)) bomb_timer_setting.setdefault('text', int(bomb_timer_default_text)) bomb_timer_setting.setdefault('sound', int(bomb_timer_default_sound)) bomb_timer_setting.addsound('ui/buttonclick.wav') es.log(hunter_bomb_timer_text) es.msg('#multi', '#green[BombTimer] #defaultLoaded')
def player_hurt(ev): if ip_scoutag_enable > 0 and ev['weapon'] == "scout": victim = playerlib.getPlayer(ev['userid']) attacker = playerlib.getPlayer(ev['attacker']) es.centertell(ev['attacker'], 'TaG') if int(ev["hitgroup"]) == 1: if ip_scoutag_announce_headshot > 0: es.msg("#multi", "#green [Scout Tag] : #default %s just #lightgreen HEADSHOT #default %s with the scout!" % (attacker.name, victim.name)) else: es.tell(attacker, "#multi", "#green [Scout Tag] : #default You just HEADSHOT %s for %s damage" % (victim.name, ev["dmg_health"])) es.tell(victim, "#multi", "#green [Scout Tag] : #default %s just HEADSHOT you!" % attacker.name) attackercash = attacker.get("cash") attacker.set("cash", attackercash + 500) elif int(ev["hitgroup"]) == 2: es.tell(attacker, "#multi", "#green [Scout Tag] : #default You just shot %s in the #lightgreen CHEST #default" % (victim.name)) es.tell(victim, "#multi", "#green [Scout Tag] : #default %s just shot your in the #lightgreen CHEST #default for #lightgreen %s #default damage" % (attacker.name, ev["dmg_health"]))
def roundStart(self, ev): global changed if not changed: limitteams = es.ServerVar("mp_limitteams") autobalance = es.ServerVar("mp_autoteambalance") es.server.queuecmd("bot_knives_only") if limitteams < 15: limitteams.set(20) if autobalance == 1: autobalance.set(0) changed = True if noMapObjective: ultilib.removeMapObjective(buyzone=False) es.centermsg("Kill the zombies and survive!!") es.msg("#multi", "#green[UltiZombie 1.0]#defaultYou're playing the single player/coop zombie mod by Ulti") es.centermsg("Do your objective or kill all zombies!")
def load(): global checksites global mapname es.set('bombsite_limiter_ver', '1.0.4') es.makepublic('bombsite_limiter_ver') es.msg('#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#lightgreen]#default Loaded...') for map in maplist: mapsites[map] = bombsites(map, maplist[map]) mapname = es.getString('eventscripts_currentmap') try: for userid in es.getUseridList(): siteCheck() if len(bombsitesNum) >= 1: gamethread.delayed(0.5, mapsites[mapname].announce, (userid)) else: checksites = 1 except KeyError: mapsites[mapname] = bombsites(mapname, 'A') for userid in es.getUseridList(): gamethread.delayed(0.5, mapsites[mapname].announce, (userid))
def bullet_impact(ev): x, y, z = getplayerlocation(ev['userid']) x1, y1, z1 = float(ev['x']), float(ev['y']), float(ev['z']) r, g, b = randint(0, 255), randint(0, 255), randint(0, 255) msg('%s (number %s/%s)' % (_effects[_users[ev['userid']]], _users[ev['userid']], len(_effects) - 1)) ServerVar('est_userid').set(ev['userid']) ServerVar('wcs_x1').set(x) ServerVar('wcs_y1').set(y) ServerVar('wcs_z1').set(z) ServerVar('wcs_x2').set(x1) ServerVar('wcs_y2').set(y1) ServerVar('wcs_z2').set(z1) if int(_users[ev['userid']]) < 234: server.queuecmd('es_doblock effects/%s' % _effects[_users[ev['userid']]]) else: exec("ice_test.ice_test.%s(%s)" % (_effects[_users[ev['userid']]], [(x, y, z), (x1, y1, z1)])) weapon = getWeapon(getPlayer(ev['userid']).weapon) if weapon.slot == 1: getPlayer(ev['userid']).clip.primary += 1 elif weapon.slot==2: getPlayer(ev['userid']).clip.secondary += 1
def blind_con_com(): ''' Allows admins to blind via a console command ''' if es.getargc() > 1: id = es.getuserid(es.getargv(1)) admin = playerlib.getPlayer(es.getcmduserid()) if id > 0: target = playerlib.getPlayer(id) if ghosting.setting.getVariable('blind_ghosters') == "0": # can only use this if auto blinding is OFF if checkplayer(int(target)): es.msg( "#green %s blinded %s till the end of the round for ghosting" % (admin.attributes["name"], target.attributes["name"])) ghosting.logging.log( "blinded user %s [%s] for ghosting" % (es.getplayername(id), es.getplayersteamid(id)), int(admin), True) blindplayer(str(target)) else: es.tell( int(admin), "#green %s was not IP ghosting" % (target.attributes["name"])) else: es.tell( int(admin), "#green XA will blind %s automatically if they are IP ghosting" % (target.attributes["name"])) else: es.tell( int(admin), "#green Player %s could not be found" % (str(es.getargv(1)))) else: es.dbgmsg( 0, "Syntax: xa_blind_ghoster <steamid|userid> - blinds ghosting players till the end of the round" )
def load(): public = es.ServerVar('hu_qs', info.version, info.name) public.makepublic() quake_sounds_players = {} for userid in es.getUseridList(): quake_sounds_players[userid] = { 'kills': 0, 'multikills': 0, 'headshot': False, 'headshots': 0 } quake_sounds_setting.clearoption() quake_sounds_kv.load(es.getAddonPath('quake_sounds') + '/quake_sounds.txt') for keyname in quake_sounds_kv['styles']: quake_sounds_setting.addoption( str(keyname), str(quake_sounds_kv['styles'][str(keyname)])) quake_sounds_setting.addoption('off', 'Off') quake_sounds_setting.setdefault(str(quake_sounds_default)) quake_sounds_setting.addsound('ui/buttonclick.wav') es.regsaycmd('!quake', 'quake_sounds/saycmd', 'Quake Sounds Style') es.addons.registerForEvent(quake_sounds_module, 'player_changename', _check_event) es.addons.registerForEvent(quake_sounds_module, 'player_info', _check_event) es.addons.registerForEvent(quake_sounds_module, 'player_say', _check_event) es.addons.registerForEvent(quake_sounds_module, 'round_freeze_end', _check_event) es.addons.registerForEvent(quake_sounds_module, 'round_end', _check_event) es.addons.registerForEvent(quake_sounds_module, 'bomb_planted', _check_event) es.addons.registerForEvent(quake_sounds_module, 'bomb_defused', _check_event) es.log(hunter_quake_sounds_text) es.msg('#multi', '#green[QuakeSounds] #defaultLoaded')
def round_end(ev): if int(ev['reason']) == 8: es.msg("#green", "------------") es.msg("#green", "Zombies Win!") es.msg("#green", "------------") if int(ev['reason']) == 7: SurvivorsWon() if int(ev['reason']) == 10: SurvivorsWon() if int(ev['reason']) == 11: SurvivorsWon()
def round_end(ev): if int(ev['reason']) == 8: es.msg("#green", "---------------") es.msg("#green", "Wolves win !") es.msg("#green", "---------------") if int(ev['reason']) == 7: SheepsWon() if int(ev['reason']) == 10: SheepsWon() if int(ev['reason']) == 11: SheepsWon()
def player_land(ev): if not es.isbot(ev['userid']): steamid = extendedstats.sid(ev) extendedstats.dbg('player land') pos = vecmath.vector(es.getplayerlocation(ev['userid'])) startpos = extendedstats.players.query(steamid,'jump_startpos') if startpos: distance = vecmath.distance(pos, vecmath.vector(startpos)) extendedstats.players.add(steamid,'jump_distance',distance) if distance > extendedstats.players.query(steamid,'jump_longest'): extendedstats.players.update(steamid,'jump_longest',distance) if dcfg['notify_longestjump'] == '1': name = extendedstats.getName(steamid) rank,allplayers = extendedstats.getRank(steamid,'jump_longest') rSteamid, rDistance = extendedstats.getToplist(1,'jump_longest')[0] rName = extendedstats.getName(rSteamid) if dcfg['notify_longestjump_all'] == '1': es.msg('%s just broke his record of his longest jump. His new record is: %.2f meters!' % (name,distance*0.01905)) es.msg('He is ranked %s of %s now. Longest jump overall is %.2f meters by %s' % (rank,allplayers,rDistance,rName)) else: es.tell(ev['userid'],'You just broke your record of your longest jump! Your new record is: %.2f meters!' % (distance*0.01905)) es.tell(ev['userid'],'You are now ranked %s of %s. Longest jump overall is %.2f meters by %s' % (rank,allplayers,rDistance,rName)) extendedstats.players.update(steamid,'jump_startpos',None)
def load(): global checksites global mapname es.set('bombsite_limiter_ver', '1.0.4') es.makepublic('bombsite_limiter_ver') es.msg( '#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#lightgreen]#default Loaded...' ) for map in maplist: mapsites[map] = bombsites(map, maplist[map]) mapname = es.getString('eventscripts_currentmap') try: for userid in es.getUseridList(): siteCheck() if len(bombsitesNum) >= 1: gamethread.delayed(0.5, mapsites[mapname].announce, (userid)) else: checksites = 1 except KeyError: mapsites[mapname] = bombsites(mapname, 'A') for userid in es.getUseridList(): gamethread.delayed(0.5, mapsites[mapname].announce, (userid))
def blind_con_com(): ''' Allows admins to blind via a console command ''' if es.getargc() > 1: id = es.getuserid(es.getargv(1)) admin = playerlib.getPlayer(es.getcmduserid()) if id > 0: target = playerlib.getPlayer(id) if ghosting.setting.getVariable('blind_ghosters') == "0": # can only use this if auto blinding is OFF if checkplayer(int(target)): es.msg("#green %s blinded %s till the end of the round for ghosting" % (admin.attributes["name"], target.attributes["name"])) ghosting.logging.log("Admin (%s) blinded player %s for ghosting " % (admin.attributes["name"], target.attributes["name"])) blindplayer(str(target)) else: es.tell(int(admin), "#green %s was not IP ghosting" % (target.attributes["name"])) else: es.tell(int(admin), "#green XA will blind %s automatically if they are IP ghosting" % (target.attributes["name"])) else: es.tell(int(admin), "#green Player %s could not be found" % (str(es.getargv(1)))) else: es.dbgmsg(0, "Syntax: xa_blind_ghoster <steamid|userid> - blinds ghosting players till the end of the round")
def plant(self, userid, site, mapname): if active: if site != bombsitesNum[self.defaultSiteLetter]: if es.getplayersteamid(userid) != 'BOT': playerlib.getPlayer(userid).set("push", (0, 300, 1)) es.tell( userid, '#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#lightgreen]#default Due to the low number of CT\'s this round, you must #lightgreenonly plant at site #green%s#lightgreen!' % self.defaultSiteLetter) es.centertell( userid, 'You must only plant at %s site!' % self.defaultSiteLetter) gamethread.delayed( 1, es.centertell, (userid, 'You must only plant at %s site!' % self.defaultSiteLetter)) else: x, y, z = random.choice(coords) es.server.queuecmd('es_xsetpos %s %s %s %s' % (userid, x, y, z)) es.msg( '#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#green]#lightgreen %s #defaultwas teleported for planting at the wrong bombsite and being a bot!' % es.getplayername(userid))
def _admin_say(userid, message, teamonly): tokens = {} tokens['username'] = es.getplayername(userid) tokens['message'] = message if xasay.isUseridAuthorized(userid, 'admin_say'): if teamonly: xasay.logging.log("has said '%s' in admin only chat" % message, userid, True) admins = playerlib.getPlayerList("#admin_say") for j in admins: # "#green[Admin Only]#lightgreen $username: #default$message" % (es.getplayername(userid), message) es.tell(int(j), "#multi", text("admin only message", tokens)) play_admin_say_sound(int(j)) else: xasay.logging.log("has said '%s' in global admin chat" % message, userid, True) es.msg("#multi", text("admin say message", tokens)) play_admin_say_sound() else: xasay.logging.log("has said '%s' to the admins" % message, userid) for player in playerlib.getPlayerList('#admin_say'): es.tell(int(player), '#multi', xalanguage('to admins message', tokens, player.get("lang"))) # say to the user as well so they know it made it! es.tell(userid, "#multi", text("to admins message", tokens)) # kill the message return (0, "", 0)
def dumpColors(self, args): es.msg("#multi", "\x07FF8D00[\x0703B0FFSimple Adverts\x07FF8D00] Dumping colors..") iniFile = ConfigParser.ConfigParser() iniFile.optionxform = str iniFile.read(PATH_ADDON + "/configs/colors.ini") for section in iniFile.sections(): dumpDict = {} dumpString = "" for color in iniFile.options(section): dumpString = dumpString + "%s%s " % (self.replaceColors("#" + color), color) es.msg("#multi", "\x07FF8D00[\x0703B0FF%s\x07FF8D00] %s" % (section, dumpString)) es.msg("#multi", "\x07FF8D00[\x0703B0FFSimple Adverts\x07FF8D00] Finished colordump!")
def dumpColors(self, args): es.msg( '#multi', '\x07FF8D00[\x0703B0FFSimple Adverts\x07FF8D00] Dumping colors..') iniFile = ConfigParser.ConfigParser() iniFile.optionxform = str iniFile.read(PATH_ADDON + '/configs/colors.ini') for section in iniFile.sections(): dumpDict = {} dumpString = '' for color in iniFile.options(section): dumpString = dumpString + '%s%s ' % ( self.replaceColors('#' + color), color) es.msg( '#multi', '\x07FF8D00[\x0703B0FF%s\x07FF8D00] %s' % (section, dumpString)) es.msg( '#multi', '\x07FF8D00[\x0703B0FFSimple Adverts\x07FF8D00] Finished colordump!' )
def load(): global spat_game spat_game = es.getgame() initGameTeams(spat_game) es.msg(initGameTeams(spat_game))
def load(): es.msg("#multi","\x05[CDJ] #greenCheeTaHs Double Jump #defaulthas been loaded! (#lightgreen%s#default)"%VersionN) Set_Up_Public_Var()
def unload(): gamethread.cancelDelayed('bomb_timer') cmdlib.unregisterSayCommand('!bombtimer') es.msg('#multi', '#green[BombTimer] #defaultUnloaded')
def wcrm(args): userid = es.getargv(1) if userid and es.exists("userid", userid): genRacelistPop('myrace_menu_%s' % userid, changerace_handler, userid) else: es.msg("#green", "Failed.")
def es_player_variable(event_var): global detect global on_connect variable_offense = False tokens = {} if (not detect) and (event_var['variable'] != "rate"): if (event_var['variable'] in "sv_cheats mat_wireframe mat_fillrate snd_show snd_visualize mem_force_flush r_drawmodelstatsoverlay cl_leveloverview r_shadowwireframe r_visualizetraces r_visualizelighttraces cl_particles_show_bbox r_drawlights r_drawrenderboxes vcollide_wireframe mat_normalmaps mat_luxels r_modelwireframedecal sv_showplayerhitboxes vgui_drawtree mat_showlowresimage" ) and (str(event_var['value']) != '0'): variable_offense = True elif (event_var['variable'] in "sv_consistency r_drawothermodels r_drawbrushmodels r_drawparticles fog_enable" ) and (str(event_var['value']) != '1'): variable_offense = True elif (event_var['variable'] == "cl_pitchup cl_pitchdown") and (str( event_var['value']) != '89'): variable_offense = True elif (event_var['variable'] == "r_partition_level") and (str(event_var['value']) != '-1'): variable_offense = True elif (event_var['variable'] == "cl_bobcycle") and (str(event_var['value']) != '0.8'): variable_offense = True elif (event_var['variable'] == "r_rainspeed") and (str(event_var['value']) != '600.0f'): variable_offense = True elif (event_var['variable'] == "host_framerate") and (str(event_var['value']) != '0'): joueur = playerlib.getPlayer(event_var['userid']) es.server.queuecmd( "kickid %s [DeToCs] %s" % (event_var['userid'], messages("host_framerate", lang=joueur.get("lang")))) on_connect = False if variable_offense: tokens["variablecl"] = event_var['variable'] tokens["userid"] = event_var['userid'] tokens["username"] = es.getplayername(event_var['userid']) tokens["steamid"] = es.getplayersteamid(event_var['userid']) player = playerlib.getPlayer(event_var['userid']) userIp = player.attributes["address"] ipAddy, port = userIp.split(":") if int(action_on_cheatR) == 0: es.msg( "#multi", messages("advert_cheat", opts=tokens, lang=detocs_langR)) detect = True if int(action_on_cheatR) == 1: es.server.queuecmd( "kickid %s [DeToCs] Kick (%s bypass)" % (event_var['userid'], event_var['variable'])) detect = True elif int(action_on_cheatR) == 2: es.server.queuecmd( "kickid %s [DeToCs] Ban (%s bypass)" % (event_var['userid'], event_var['variable'])) if int(ban_with_gbR) == 1: es.server.queuecmd( 'es gb_externalBanUser "%s" "%s" %s %s minutes %s' % (str(steamid_gbR), es.getplayersteamid(event_var['userid']), str(idreason_gbR), str(ban_durationR), urllib.parse.quote( es.getplayername(event_var['userid'])))) es.log( "COMMANDE: es gb_externalBanUser %s %s %s %s minutes %s" % (str(steamid_gbR), es.getplayersteamid(event_var['userid']), str(idreason_gbR), str(ban_durationR), urllib.parse.quote( es.getplayername(event_var['userid'])))) else: if int(ban_typeR) == 0: es.server.queuecmd( "banid %s %s" % (int(es.ServerVar('ban_duration')), es.getplayersteamid(event_var['userid']))) es.server.queuecmd("writeid") elif int(ban_typeR) == 1: es.server.queuecmd( "addip %s %s" % (int(es.ServerVar('ban_duration')), ipAddy)) es.server.queuecmd("writeip") elif int(ban_typeR) == 2: es.server.queuecmd( "addip %s %s" % (int(es.ServerVar('ban_duration')), ipAddy)) es.server.queuecmd( "banid %s %s" % (int(es.ServerVar('ban_duration')), es.getplayersteamid(event_var['userid']))) es.server.queuecmd("writeid") es.server.queuecmd("writeip") detect = True if (int(advert_on_cheatR) == 1) and (int(action_on_cheatR) == 1): es.msg("#multi", messages("advert_kick", opts=tokens, lang=detocs_langR)) elif (int(advert_on_cheatR) == 1) and (int(action_on_cheatR) == 2): es.msg("#multi", messages("advert_ban", opts=tokens, lang=detocs_langR)) if os.path.isfile( os.getcwd() + "/cstrike/addons/eventscripts/detocs/detocs_logs.txt"): fichier = open( os.getcwd() + "/cstrike/addons/eventscripts/detocs/detocs_logs.txt", "a") else: fichier = open( os.getcwd() + "/cstrike/addons/eventscripts/detocs/detocs_logs.txt", "w") fichier.write("Date: %s %s\n" % (time.strftime("%d/%m/%y", time.localtime()), time.strftime("%H:%M", time.localtime()))) fichier.write("Username: %s\n" % es.getplayername(event_var['userid'])) fichier.write("SteamID: %s\n" % es.getplayersteamid(event_var['userid'])) fichier.write("IP: %s\n" % ipAddy) fichier.write("Variable: %s\n" % event_var['variable']) fichier.write("-----------------------------------\n") fichier.close() elif (int(advert_on_nocheatR) == 1) and (event_var['variable'] == "host_framerate") and on_connect: tokens["username"] = es.getplayername(event_var['userid']) tokens["steamid"] = es.getplayersteamid(event_var['userid']) es.msg("#multi", messages("advert_nocheat", opts=tokens, lang=detocs_langR)) on_connect = False
def sendAll(self, text): es.msg("#multi", "%s %s" % (self.prefix, self.replaceColors(text))) if self.prefix != "" else es.msg( "#multi", self.replaceColors(text) )
def msg(argv): es.msg(*argv)
def warden(): es.msg('warden 1') userid = str(es.ServerVar('wcs_userid')) count = int(wcsgroup.getUser(userid, 'ability_count')) if count: es.msg('warden 2') param = str(wcsgroup.getUser(userid, 'ability_parameter')) if param: es.msg('warden 3') param = param.split('_') team = int(es.getplayerteam(userid)) if team == 2: teamtarget = '3' teamtargetn = '#ct' color = '255 0 10 150' elif team == 3: teamtarget = '2' teamtargetn = '#t' color = '10 0 255 150' es.msg('warden 4') x, y, z = es.getplayerlocation(userid) es.server.queuecmd('wcs_warden ' + userid + ' ' + param[0] + ' ' + param[1] + ' ' + param[2] + ' ' + teamtarget + ' ' + teamtargetn + ' ' + str(x) + ' ' + str(y) + ' ' + str(z) + ' ' + str(es.ServerVar('wcs_roundcounter'))) es.msg('warden 5') tell(userid, 'a_wardencreated') if count and not count == -1: es.msg('warden 6') wcsgroup.setUser(userid, 'ability_count', count - 1) else: es.msg('warden 7') tell(userid, 'a_failed')
import es from wcs import wcsgroup from wcs.xtell import tell es.msg('warden loaded') def warden(): es.msg('warden 1') userid = str(es.ServerVar('wcs_userid')) count = int(wcsgroup.getUser(userid, 'ability_count')) if count: es.msg('warden 2') param = str(wcsgroup.getUser(userid, 'ability_parameter')) if param: es.msg('warden 3') param = param.split('_') team = int(es.getplayerteam(userid)) if team == 2: teamtarget = '3' teamtargetn = '#ct' color = '255 0 10 150' elif team == 3: teamtarget = '2' teamtargetn = '#t' color = '10 0 255 150'
def round_start(eventVar): if int(slay): es.msg("#multi", text("round_start"))
def unload(): es.msg( '#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#lightgreen]#default Unloaded...' )
def msg(text): es.msg("#multi", "#green[ztricks-debug]#default %s" % text)
def ztricks_trick(e): # # ztricks_trick # # When someone lands a trick successfully, this is available: # userid # trick_id The internal number of the trick # trick_time The total time it took to complete the trick # trick_short The short name for the trick. If you did a awp3, this would be "awp" # trick_points The point value of the trick # player_velocity The players velocity. (This must be an average) # player_mph Velocity / 26 # player_angle forward, half side ways, backwards # userid = e['userid'] steamid = es.getplayersteamid(userid) name = e['trick_name'] thetime = float(e['trick_time']) speed = float(e['player_speed']) playername = gpn(userid) points = int(e['trick_points']) # Give them a point es.server.queuecmd("es score add %s 1" % e['userid']) # Give them points setValue(steamid, 'points', (getValue(steamid, 'points', 0) + points)) # Say the message es.msg( "#multi", "#lightgreen%s#default just completed #lightgreen%s#default going #green%.0f#default mph in #lightgreen%.4f#default seconds!!" % (playername, name, speed, thetime)) # Total count # FIXME? #cnt = int(getValue(name, 'total_completed', 0)) #setValue(name, 'total_completed', (cnt + 1)) ########################################### # First person to do the trick ########################################### if getValue(name, 'first_player_time', 0) == 0: setValue(name, 'first_player_time', time.time()) setValue(name, 'first_player_name', playername) setValue(name, 'first_player_steamid', steamid) ########################################### # TRICK SPEED ########################################### fastest_speed = float(getValue(name, 'fastest_speed_mph', 0)) slowest_speed = float(getValue(name, 'slowest_speed_mph', 0)) if fastest_speed == 0: es.msg( "#multi", "#lightgreen%s#default just set the first speed record for #lightgreen%s#default!!" % (playername, name)) fastest_speed = speed setValue(name, 'fastest_speed_first_mph', speed) setValue(name, 'fastest_speed_first_name', playername) setValue(name, 'fastest_speed_first_steamid', steamid) setValue(name, 'fastest_speed_first_date', time.time()) setValue(name, 'fastest_speed_mph', speed) setValue(name, 'fastest_speed_name', playername) setValue(name, 'fastest_speed_steamid', steamid) setValue(name, 'fastest_speed_date', time.time()) slowest_speed = speed setValue(name, 'slowest_speed_first_mph', speed) setValue(name, 'slowest_speed_first_name', playername) setValue(name, 'slowest_speed_first_steamid', steamid) setValue(name, 'slowest_speed_first_date', time.time()) setValue(name, 'slowest_speed_mph', speed) setValue(name, 'slowest_speed_name', playername) setValue(name, 'slowest_speed_steamid', steamid) setValue(name, 'slowest_speed_date', time.time()) elif speed > fastest_speed: diff = speed - fastest_speed es.msg( '#multi', "#lightgreen%s#default just broke the speed record for #lightgreen%s#default by #green%.4f#default mph!!" % (playername, name, diff)) setValue(name, 'fastest_speed_mph', speed) setValue(name, 'fastest_speed_name', playername) setValue(name, 'fastest_speed_steamid', steamid) setValue(name, 'fastest_speed_date', time.time()) elif speed < slowest_speed: diff = slowest_speed - speed #es.msg("#multi", "#lightgreen%s#default just broke the slowest speed record for #lightgreen%s#default by #green%.4f#default mph!!" % (playername, name, diff)) es.tell(userid, "That was the slowest speed for %s!!" % name) setValue(name, 'slowest_speed_mph', speed) setValue(name, 'slowest_speed_name', playername) setValue(name, 'slowest_speed_steamid', steamid) setValue(name, 'slowest_speed_date', time.time()) ########################################### # TRICK TIME ########################################### fastest_time = float(getValue(name, 'fastest_time_time', 0)) slowest_time = float(getValue(name, 'slowest_time_time', 0)) if fastest_time == 0: es.msg( "#multi", "#lightgreen%s#default just set the first time record for #lightgreen%s#default!!" % (playername, name)) fastest_time = thetime setValue(name, 'fastest_time_first_time', thetime) setValue(name, 'fastest_time_first_name', playername) setValue(name, 'fastest_time_first_steamid', steamid) setValue(name, 'fastest_time_first_date', time.time()) setValue(name, 'fastest_time_time', thetime) setValue(name, 'fastest_time_name', playername) setValue(name, 'fastest_time_steamid', steamid) setValue(name, 'fastest_time_date', time.time()) slowest_time = thetime setValue(name, 'slowest_time_first_time', thetime) setValue(name, 'slowest_time_first_name', playername) setValue(name, 'slowest_time_first_steamid', steamid) setValue(name, 'slowest_time_first_date', time.time()) setValue(name, 'slowest_time_time', thetime) setValue(name, 'slowest_time_name', playername) setValue(name, 'slowest_time_steamid', steamid) setValue(name, 'slowest_time_date', time.time()) elif thetime < fastest_time: diff = fastest_time - thetime es.msg( "#multi", "#lightgreen%s#default just broke the time record for #lightgreen%s#default by #green%.4f#default seconds!!" % (playername, name, diff)) setValue(name, 'fastest_time_time', thetime) setValue(name, 'fastest_time_name', playername) setValue(name, 'fastest_time_steamid', steamid) setValue(name, 'fastest_time_date', time.time()) elif thetime > slowest_time: diff = thetime - slowest_time #es.msg("#multi", "#lightgreen%s#default just broke the slowest time record for #lightgreen%s#default by #green%.4f#default seconds!!" % (playername, name, diff)) es.tell(userid, "That was the slowest time for %s!!" % name) setValue(name, 'slowest_time_time', thetime) setValue(name, 'slowest_time_name', playername) setValue(name, 'slowest_time_steamid', steamid) setValue(name, 'slowest_time_date', time.time()) ########################################### # Personal Stats ########################################### count = getValue(steamid, "count %s" % name, 0) + 1 setValue(steamid, "count %s" % name, count) if count in [10, 25, 50, 75, 100, 150, 200, 300, 400, 500, 750, 1000]: es.msg( '#multi', "#lightgreen%s#default just did their #green%sth #lightgreen%s#default!" % (playername, count, name))
def msg(text): es.msg("#multi", "#green[ztricks-score]#default %s" % text)
def myscore(): userid = es.getcmduserid() steamid = es.getplayersteamid(userid) es.msg( "#multi", "#lightgreen%s's#default score is #lightgreen%s#default!" % (gpn(userid), getValue(steamid, 'points', 0)))
def unload(): es.msg("#multi","\x05[CDJ] #greenCheeTaHs Double Jump #defaulthas been unloaded! (#lightgreen%s#default)"%VersionN)
def round_start(event_var): if mattie_mugmod > 0 and mugmod_announce > 0: es.msg("#multi", text("mugmod announcement"))
def sendAll(self, text): es.msg('#multi', '%s %s' % (self.prefix, self.replaceColors(text))) if self.prefix != '' else es.msg( '#multi', self.replaceColors(text))
def announcePersonalRank(self, userid): """ Announce the personal rank """ playerRank = self.getPersonalRank(self.identifyPlayer(userid)) es.msg("%s is ranked %d of %d with %d points. Kills: %d Deaths: %d KDR: %s" % (playerlib.Player(userid).name, playerRank[0], len(self.ranklist), playerRank[1], playerRank[2], playerRank[3], self.getKDR(playerRank[2], playerRank[3]))) if self.readonly: self.tellplayer(userid, "The ranking system is currently in read-only mode. Your kills and deaths will not be logged.")
def SheepsWon(): es.msg("#green", "---------------") es.msg("#green", "Sheeps win !") es.msg("#green", "---------------") for Player in playerlib.getUseridList('#t'): playerlib.getPlayer(Player).slay()
def wum(args): if es.getargv(1) and es.exists("userid",es.getargv(1)): genPlayerlistPop('%s%s'%(popups[0],es.getargv(1)), playerSelect).send(es.getargv(1)) else: es.msg("#green", "Failed.")
def round_start(event_var): weplist = ", ".join(restrictedList) es.msg("#multi","#green[UltiRestrict] #defaultThe currect restricted weapon list is:", weplist)
def display_advert(): global next_advert # repeat the timer gamethread.delayedname(float(time_between_advert), 'adverts', display_advert) if adverts and xaadvertlist and es.ServerVar( 'eventscripts_currentmap') != '': # start at the beginning if next_advert >= len(xaadvertlist): next_advert = 0 # get advert advert_text = xaadvertlist[next_advert] tags = re.compile(r'(?P<tag>\{\w+\})') for tag in tags.findall(advert_text): advert_text = advert_text.replace(tag, tag.upper()) # set color color = '%s %s %s 255' % (str(advert_col_red), str(advert_col_green), str(advert_col_blue)) for k in colors: if k in advert_text: color = colors[k] advert_text = advert_text.replace(k, '') # set tags if str(es.ServerVar('eventscripts_nextmapoverride')) != '': advert_text = advert_text.replace( '{NEXTMAP}', str(es.ServerVar('eventscripts_nextmapoverride'))) else: if len(mapcycle) == 1: advert_text = advert_text.replace( '{NEXTMAP}', str(es.ServerVar('eventscripts_currentmap'))) elif currentmap + 1 > len(mapcycle): # fix for when we are at the end of the maplist advert_text = advert_text.replace('{NEXTMAP}', mapcycle[0]) else: advert_text = advert_text.replace('{NEXTMAP}', mapcycle[currentmap + 1]) advert_text = advert_text.replace( '{CURRENTMAP}', str(es.ServerVar('eventscripts_currentmap'))) advert_text = advert_text.replace('{TICKRATE}', 'UNKNOWN') if int(es.ServerVar('mp_friendlyfire')): advert_text = advert_text.replace('{FF}', 'on') else: advert_text = advert_text.replace('{FF}', 'off') advert_text = advert_text.replace( '{THETIME}', str(time.strftime("%H:%M:%S", time.localtime()))) advert_text = advert_text.replace('{SERVERHOST}', 'UNKNOWN') # send top text if int(adverts_top_left): if int(advert_dead_only) == 1: xaadvert_playerlist = playerlib.getPlayerList('#human,#dead') else: xaadvert_playerlist = playerlib.getPlayerList('#human') toptext = msglib.VguiDialog(title=advert_text, level=5, time=25, mode=msglib.VguiMode.MSG) toptext['color'] = color for k in xaadvert_playerlist: toptext.send(k.userid) # send chat text if int(adverts_chat_area): if int(advert_dead_only) == 1: xaadvert_playerlist = playerlib.getPlayerList('#human,#dead') for k in xaadvert_playerlist: es.tell(k.userid, '#lightgreen', advert_text) else: es.msg('#lightgreen', advert_text) # send bottom text if int(adverts_bottom_area): if int(advert_dead_only) == 1: xaadvert_playerlist = playerlib.getPlayerList('#human,#dead') else: xaadvert_playerlist = playerlib.getPlayerList('#human') for k in xaadvert_playerlist: usermsg.hudhint(k.userid, advert_text) next_advert = next_advert + 1
def restart_game(self): self.active.echo() es.msg(langstring('WeaponOrder:ChangedTo', {'to': self.active.title})) es.ServerCommand('mp_restartgame 2')