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 load(): es.log("[DeToCs] Load") es.server.cmd( "es_xmexec ../addons/source-python/plugins/es_emulator/eventscripts/detocs/detocs.cfg" ) if int(check_repeatR) == 1: repeat.create("CheckCheat", check_variable_seconds) repeat.start("CheckCheat", int(check_secondsR), 0)
def gbanLog(message): now = datetime.datetime.now() f = open(es.getAddonPath('GlobalBan') + '/logs/gban-'+now.strftime("%Y-%m-%d")+'.log','a') f.write(now.strftime("%Y-%m-%d %H:%M:%S") + ': ') f.write(message + '\n') f.close() # write the message to the regular game log file es.log(message)
def log(module, text, userid=None, admin=False, loglvl=0): """ XA logging module: module name (usually automatically provided) test: text string to log userid: optionally provide a userid as reference admin: set to true if this is an admin action loglvl: an optional level - messages with lower xa_log values will not be recorded Appends a line to the module's log file (found in the xa/logs directory). Includes ability to reference a specific player and also flag as an admin action """ # Is logging enabled and does our module exist? if int(es.ServerVar('xa_log')) and int( es.ServerVar('xa_log')) >= loglvl and xa.exists(module): # Was a valid source userid specified? if userid and es.exists('userid', int(userid)): # Is this userid an admin? if admin: # Adming log logtext = '%s: Admin %s [%s]: %s' % ( module, es.getplayername(userid), es.getplayersteamid(userid), text) else: # User log logtext = '%s: User %s [%s]: %s' % ( module, es.getplayername(userid), es.getplayersteamid(userid), text) else: # Default log logtext = '%s: %s' % (module, text) # Create our log folder if it does not exist if not os.path.isdir('%s/logs' % xa.coredir()): os.mkdir('%s/logs' % xa.coredir()) # Write to our log file logname = '%s/logs/l%s' % (xa.coredir(), time.strftime('%m%d000.log')) logfile = open(logname, 'a+') logfile.write( time.strftime('L %m/%d/%Y - %H:%M:%S: ') + logtext + '\n') logfile.close() # Write to the SRCDS log file es.log(logtext)
def es_map_start(event_var): """ Executed when the map starts. Check the host to see if there are any later versions. Debug the output of the results. TODO: Make sure that we somehow get more attention. @param event_var es.EventInfo """ if int(checkForUpdates): reCacheConnection() cache = connection.getCache() if cache is not None: es.dbgmsg(0, cache) es.log(cache)
def log(module, text, userid=0, admin=False): if bool(int(es.ServerVar("xa_log"))) and xa.exists(module): if (int(userid) > 0) and es.exists('userid', int(userid)): if admin: logtext = str(module) + ': Admin ' + es.getplayername(userid) + ' [' + es.getplayersteamid(userid) + ']: ' + str(text) else: logtext = str(module) + ': User ' + es.getplayername(userid) + ' [' + es.getplayersteamid(userid) + ']: ' + str(text) else: logtext = str(module) + ': ' + str(text) logname = '%s/logs/l%s' % (xa.coredir(), time.strftime('%m%d000.log')) logfile = open(logname, 'a+') logfile.write(time.strftime('L %m/%d/%Y - %H:%M:%S: ') + logtext + '\n') logfile.close() es.log(logtext) return True return False
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 isIdAuthorized(self, auth_identifier, auth_capability): if not auth_identifier: auth_identifier = 'STEAM_ID_PENDING' if auth_identifier == 'STEAM_ID_PENDING': check = self.check_id(auth_identifier, auth_capability) else: test = self.check_exists(auth_identifier) if test: check = self.check_id(auth_identifier, auth_capability) else: check = self.check_nogroup(auth_capability) if check: es.log('group_auth: ' + auth_identifier + ' was permitted ' + auth_capability) return True else: es.log('group_auth: ' + auth_identifier + ' was forbidden ' + auth_capability) return False
def log(module, text, userid=None, admin=False, loglvl=0): """ XA logging module: module name (usually automatically provided) test: text string to log userid: optionally provide a userid as reference admin: set to true if this is an admin action loglvl: an optional level - messages with lower xa_log values will not be recorded Appends a line to the module's log file (found in the xa/logs directory). Includes ability to reference a specific player and also flag as an admin action """ # Is logging enabled and does our module exist? if int(es.ServerVar('xa_log')) and int(es.ServerVar('xa_log')) >= loglvl and xa.exists(module): # Was a valid source userid specified? if userid and es.exists('userid', int(userid)): # Is this userid an admin? if admin: # Adming log logtext = '%s: Admin %s [%s]: %s' % (module, es.getplayername(userid), es.getplayersteamid(userid), text) else: # User log logtext = '%s: User %s [%s]: %s' % (module, es.getplayername(userid), es.getplayersteamid(userid), text) else: # Default log logtext = '%s: %s' % (module, text) # Create our log folder if it does not exist if not os.path.isdir('%s/logs' % xa.coredir()): os.mkdir('%s/logs' % xa.coredir()) # Write to our log file logname = '%s/logs/l%s' % (xa.coredir(), time.strftime('%m%d000.log')) logfile = open(logname, 'a+') logfile.write(time.strftime('L %m/%d/%Y - %H:%M:%S: ') + logtext + '\n') logfile.close() # Write to the SRCDS log file es.log(logtext)
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 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), urllib2.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), urllib2.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 unload(): es.log("[DeToCs] Unload") if int(check_repeatR) == 1: repeat.stop("CheckCheat") repeat.delete("CheckCheat")
def log(argv): es.log(*argv)
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 load(): es.log("[DeToCs] Load") es.server.cmd("es_xmexec ../addons/eventscripts/detocs/detocs.cfg") if int(check_repeatR) == 1: repeat.create("CheckCheat", check_variable_seconds) repeat.start("CheckCheat", int(check_secondsR), 0)
def logv(argv): result = str(sv[argv[0]]) es.dbgmsg(0, result) es.log(result)
def log(args): es.dbgmsg(0, args) es.log(args)