コード例 #1
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def server_idle():
    hostport = int(sv('hostport'))
    if hostport != 27100:
        es.ServerCommand('rcon_address 1.214.121.137:27100')
        es.ServerCommand('rcon es_xset res_%s_state idle' %(sv('hostport')))
        es.ServerCommand('sv_password %02X' %(random.randint(10000,99999)))
        es.set("server_state", "idle")
コード例 #2
0
ファイル: GlobalBan.py プロジェクト: madPO/es_plugin-depot
def loadConfig():
  global serverId, websiteAddy, banAppealMessage, hashCode, teachAdmins, clanName, allowAdminBanning
  
  gbanLog('GBAN: Attempting to load values from GlobalBan.cfg')
  
  # Look for the GlobalBan config file and load the values from it
  if os.path.isfile(es.getAddonPath('GlobalBan') + '/GlobalBan.cfg'):
    cfg = ConfigObj(es.getAddonPath('GlobalBan') + '/GlobalBan.cfg')

    serverId = cfg['serverId']
    websiteAddy = cfg['websiteAddy']
    banAppealMessage = cfg['banAppealMessage']
    hashCode = cfg['hash']
    teachAdmins = int(cfg['teachAdmins'])
    clanName = cfg['clanName']
    allowAdminBanning = cfg['allowAdminBanning']
    es.set("GlobalBan_Web", websiteAddy)
  else:
    es.dbgmsg(0, 'GlobalBan: Unable to load GlobalBan.cfg! Please ensure it is in the ./GlobalBan/ directory.')
    gbanLog('GBAN: The GlobalBan.cfg file is not set up correctly!!')
    es.msg('#lightgreen', 'The GlobalBan.cfg file is not set up correctly!!')
    es.msg('#lightgreen', 'The GlobalBan.cfg file is not set up correctly!!')
    gbanLog('GBAN: Please execute a "Save Configuration" from the web, or update the file manually')
    es.msg('#lightgreen', 'Please execute a "Save Configuration" from the web, or update the file manually')
    gbanLog('GBAN: Please save from the web again, or update manually')
    
  # If the website addy is the default... then the cfg file did not load
  if websiteAddy == "http://yourdomain.com/banned/":
    gbanLog('GBAN: The GlobalBan.cfg file is not set up correctly!!')
    es.msg('#lightgreen', 'The GlobalBan.cfg file is not set up correctly!!')
    es.msg('#lightgreen', 'The GlobalBan.cfg file is not set up correctly!!')
    gbanLog('GBAN: Please execute a "Save Configuration" from the web, or update the file manually')
    es.msg('#lightgreen', 'Please execute a "Save Configuration" from the web, or update the file manually')
    gbanLog('GBAN: Please save from the web again, or update manually')
コード例 #3
0
ファイル: setting.py プロジェクト: StarsGame/source_addons
def deleteVariable(module, variable):
    """
        Delete a variable
        
        module:         module name (usually automatically provided)
        variable:       the name of the cvar to delete
        
        return:         (bool) true (false if variable/module does not exist)
    """
    # Does the module exist?
    if xa.exists(module):
        # Find the module instance
        module = xa.find(module)
        
        # Get the variable name
        variable = getVariableName(module, variable)
        
        # Did we get a valid variable name and does the variable exist?
        if variable and getVariable(module, variable):
            # Reset the variable
            es.set(variable, '', '')
            
            # Remove the variable from our module
            del module.variables[variable]
            
            return True
    return False
コード例 #4
0
def vote_win(args):
    """ Called when a winner has been chosen. """
    xartv.logging.log('Rock the vote has won, changing map to %s...' % args['winner']) 
    players.clear()
    winner = args['winner']
    es.set('eventscripts_nextmapoverride', winner)
    xartv.xavote.EndMap()     
コード例 #5
0
def deleteVariable(module, variable):
    """
        Delete a variable
        
        module:         module name (usually automatically provided)
        variable:       the name of the cvar to delete
        
        return:         (bool) true (false if variable/module does not exist)
    """
    # Does the module exist?
    if xa.exists(module):
        # Find the module instance
        module = xa.find(module)

        # Get the variable name
        variable = getVariableName(module, variable)

        # Did we get a valid variable name and does the variable exist?
        if variable and getVariable(module, variable):
            # Reset the variable
            es.set(variable, '', '')

            # Remove the variable from our module
            del module.variables[variable]

            return True
    return False
コード例 #6
0
ファイル: setting.py プロジェクト: StarsGame/source_addons
def deleteVariable(module, variable):
    if xa.exists(module):
        module = xa.find(module)
        variable = getVariableName(module, variable)
        if variable and getVariable(module, variable):
            es.set(variable, '', '')
            del module.variables[variable]
コード例 #7
0
 def testWhile(self):
     i = 5000
     es.set("myvar", 5000)
     while i:
         i -= 1
         es.server.cmd("es_xmath myvar - 1")
     self.failUnless(int(server_var['myvar']) == 0)
コード例 #8
0
def server_idle():
    hostport = int(sv('hostport'))
    if hostport != 27100:
        es.ServerCommand('rcon_address 1.214.121.137:27100')
        es.ServerCommand('rcon es_xset res_%s_state idle' % (sv('hostport')))
        es.ServerCommand('sv_password %02X' % (random.randint(10000, 99999)))
        es.set("server_state", "idle")
コード例 #9
0
def unload():
    es.dbgmsg(1,'*****unload')
    if authaddon == 'basic_auth': 
        popuplib.delete('admindetail')
        if int(popuplib.exists('adminlistmenu')):
            popuplib.delete('adminlistmenu')
        es.dbgmsg(1,'basicadmins_default=%s' %basicadmins_default)
        es.set('BASIC_AUTH_ADMIN_LIST', basicadmins_default)
    elif authaddon == 'group_auth':
        popuplib.delete('groupsmainmenu')
        popuplib.delete('usermenu')
        popuplib.delete('capmain')
        if int(popuplib.exists('groupsmenu')):
            popuplib.delete('groupsmenu')
        if int(popuplib.exists('groupslist')):
            popuplib.delete('groupslist')
        if int(popuplib.exists('groupsusers')):
            popuplib.delete('groupsusers')
        if int(popuplib.exists('groupcaps')):
            popuplib.delete('groupcaps')
		
    if int(popuplib.exists('playermenu')):
        popuplib.delete('playermenu')

    xa.unregister(xaauthmanage)
コード例 #10
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def load():
    es.set("eventscripts_noisy", 1)
    spe.parseINI("the_killers/sig.ini")
    spe.parseTypesINI("the_killers/twosig.ini")
    spe.registerPreHook('player_hurt', pre_player_hurt)
    spe.registerPreHook('weapon_fire', pre_weapon_fire)
    cmdlib.registerServerCommand('r_weaponswap', weapon_swap, "None")
    spe.detourFunction("PlayerRunCommand", spe.HookType.Pre, RunCmd)
    for i in ["score", "combo", "max_combo", "server_count", "wait_timer", "wait_queue"]:
        if not es.exists('variable', i):
            es.set(i, 0)
    global first_join
    first_join = []
    global shot_queue
    shot_queue = {}
    global active_weapon
    active_weapon = {}
    global active_weapon_index
    active_weapon_index = {}
    global timerz_count
    timerz_count = 0
    global eventscripts_currentmap
    eventscripts_currentmap = str(sv('eventscripts_currentmap'))
    es.addons.registerClientCommandFilter(Commander4)
    timerz = repeat.create('timerz', timerz_command, ())
    timerz.start(1, 0)
    for userid in es.getUseridList():
        handle = es.getplayerprop(userid, "CBaseCombatCharacter.m_hActiveWeapon")
        index = es.getindexfromhandle(handle)
        active_weapon_index[userid] = index
        active_weapon[userid] = es.entitygetvalue(index, "classname")
    es.ServerCommand('rcon_password kafkaz')
    server_count_refresh()
    if not "_" in str(sv('eventscripts_currentmap')):
        server_idle()
コード例 #11
0
def deleteVariable(module, variable):
    if xa.exists(module):
        module = xa.find(module)
        variable = getVariableName(module, variable)
        if variable and getVariable(module, variable):
            es.set(variable, '', '')
            del module.variables[variable]
コード例 #12
0
def unload():
    es.dbgmsg(1, '*****unload')
    if authaddon == 'basic_auth':
        popuplib.delete('admindetail')
        if int(popuplib.exists('adminlistmenu')):
            popuplib.delete('adminlistmenu')
        es.dbgmsg(1, 'basicadmins_default=%s' % basicadmins_default)
        es.set('BASIC_AUTH_ADMIN_LIST', basicadmins_default)
    elif authaddon == 'group_auth':
        popuplib.delete('groupsmainmenu')
        popuplib.delete('usermenu')
        popuplib.delete('capmain')
        if int(popuplib.exists('groupsmenu')):
            popuplib.delete('groupsmenu')
        if int(popuplib.exists('groupslist')):
            popuplib.delete('groupslist')
        if int(popuplib.exists('groupsusers')):
            popuplib.delete('groupsusers')
        if int(popuplib.exists('groupcaps')):
            popuplib.delete('groupcaps')

    if int(popuplib.exists('playermenu')):
        popuplib.delete('playermenu')

    xa.unregister(xaauthmanage)
コード例 #13
0
def vote_win(args):
    """ Called when a winner has been chosen. """
    xartv.logging.log("Changing map to %s..." % args["winner"])
    players.clear()
    winner = args["winner"]
    es.set("eventscripts_nextmapoverride", winner)
    xartv.xavote.EndMap()
コード例 #14
0
def player_activate_f(userid):
    steamid = getplayerid(userid)
    if steamid != "BOT":
        first_join.append(userid)
        check = est.fileexists(
            "addons/eventscripts/the_killers/player_data/es_%s_db.txt" %
            (steamid))
        if not check:
            make_player(steamid)
        else:
            if not es.exists("keygroup", steamid):
                es.keygroupload(steamid, "|the_killers/player_data")
        if int(sv('hostport')) != 27100:
            if repeat.find("music_loop"):
                repeat.delete("music_loop")
            music = "zeisenproject/the-killers/musics/RollerMobster.mp3"
            es.set("music", music)
            music_loop = repeat.create('music_loop', es.playsound,
                                       (userid, music, 1.0))
            if "RollerMobster.mp3" in music:
                music_loop.start((180 + 34), 0)
            es.playsound(userid, music, 1.0)
        if eventscripts_currentmap == "cs_office":
            es.playsound(userid, "zeisenproject/the-killers/musics/beams.mp3",
                         1.0)
コード例 #15
0
def vote_win(args):
    """ Called when a winner has been chosen. """
    xartv.logging.log('Rock the vote has won, changing map to %s...' % args['winner']) 
    players.clear()
    winner = args['winner']
    es.set('eventscripts_nextmapoverride', winner)
    xartv.xavote.EndMap()     
コード例 #16
0
ファイル: pyunittest.py プロジェクト: StarsGame/source_addons
 def testWhile(self):
   i = 5000
   es.set("myvar", 5000)
   while i:
       i-=1
       es.server.cmd("es_xmath myvar - 1")
   self.failUnless(int(server_var['myvar'])==0)
コード例 #17
0
def load():
    """
    Executed when this file is loaded. Create any console commands that we need
    throughout the script.
    """
    cmdlib.registerServerCommand("es_checkversion", checkUpdateCommand,
                                 "Check for any later EventScripts updates")
    es.set()
コード例 #18
0
def load():
    """
    Executed when this file is loaded. Create any console commands that we need
    throughout the script.
    """
    cmdlib.registerServerCommand("es_checkversion", checkUpdateCommand,
                                 "Check for any later EventScripts updates")
    es.set()
コード例 #19
0
def load():
    es.set('eventscripts_noisy', 1)
    global client
    gamethread.cancelDelayed("antispam")
    antispam()
    load_client_pref()

    chat.hook("window.chat", None)

    """ Trikz menu """
    chat.registerHiddenCommand("!t", trikz_menu, True, True)
    chat.registerHiddenCommand("/t", trikz_menu, True, True)
    chat.registerHiddenCommand("t", trikz_menu, True, True)
    chat.registerHiddenCommand("!trikz", trikz_menu, True, True)

    """ TP menu """
    # TODO: startswith
    chat.registerPublicCommand("!tp ", tp_menu, True, True, startswith=True)
    chat.registerPublicCommand("!tp", tp_menu, True, True, startswith=False)
    chat.registerPublicCommand("!tpto", tp_menu, True, True, startswith=True)
    chat.registerHiddenCommand("/tp ", tp_menu, True, True, startswith=True)
    chat.registerHiddenCommand("/tp", tp_menu, True, True, startswith=False)
    chat.registerHiddenCommand("/tptp", tp_menu, True, True, startswith=True)

    """ TP accept """
    chat.registerPublicCommand("!y", tp_accept, False, True, startswith=True)
    chat.registerHiddenCommand("/y", tp_accept, False, True, startswith=True)

    """ Commands menu"""
    chat.registerPublicCommand("!commands", commands, True, True)
    chat.registerHiddenCommand("/commands", commands, True, True)

    """ Get weapon_glock command"""
    chat.registerPublicCommand("!glock", get_glock, False, True)
    chat.registerHiddenCommand("/glock", get_glock, False, True)

    """ Get weapon_usp command"""
    chat.registerPublicCommand("!usp", get_usp, False, True)
    chat.registerHiddenCommand("/usp", get_usp, False, True)

    """ Toggle block command """
    chat.registerPublicCommand("!b", toggle, True, True)
    chat.registerPublicCommand("!block", toggle, True, True)
    chat.registerHiddenCommand("/b", toggle, True, True)
    chat.registerHiddenCommand("/block", toggle, True, True)

    """ Set player spectate command """
    # TODO: Choose target (startswith method)
    chat.registerPublicCommand("!spec", change_spec, True, True)
    chat.registerPublicCommand("!spectate", change_spec, True, True)
    chat.registerHiddenCommand("/spec", change_spec, True, True)
    chat.registerHiddenCommand("/spectate", change_spec, True, True)

    # TODO: Choose target (startswith method)
    chat.registerPublicCommand("!cp", cp_menu, True, True)
    chat.registerPublicCommand("!checkpoint", cp_menu, True, True)
    chat.registerHiddenCommand("/cp", cp_menu, True, True)
    chat.registerHiddenCommand("/checkpoint", cp_menu, True, True)
コード例 #20
0
def _capsmenu_select(userid, choice, popupid):
    es.dbgmsg(1, '*****_capsmenu_select')
    global capmain
    es.set('_pcap', 0)
    capmain.modlineAll(2, ' - ' + choice)
    capmain.menuvalue('_pcap', 1, choice)
    capmain.menuvalue('_pcap', 2, choice)
    capmain.menuvalue('_pcap', 3, choice)
    capmain.send(userid)
コード例 #21
0
def _capsmenu_select(userid,choice,popupid):
    es.dbgmsg(1,'*****_capsmenu_select')
    global capmain
    es.set('_pcap',0)
    capmain.modlineAll(2,' - ' + choice)
    capmain.menuvalue('_pcap',1,choice)
    capmain.menuvalue('_pcap',2,choice)
    capmain.menuvalue('_pcap',3,choice)
    capmain.send(userid)
コード例 #22
0
def _usersmenu_select(userid,choice,popupid):
    es.dbgmsg(1,'*****_usersmenu_select')
    global usermenu
    es.set('_puser',0)
    usermenu.modlineAll(1,'User: %s' %choice)
    usermenu.menuvalue('_puser',1,choice[0])
    usermenu.menuvalue('_puser',2,choice[0])
    usermenu.menuvalue('_puser',3,choice[0])
    usermenu.send(userid)
コード例 #23
0
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,
    )
コード例 #24
0
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)
コード例 #25
0
def _usersmenu_select(userid, choice, popupid):
    es.dbgmsg(1, '*****_usersmenu_select')
    global usermenu
    es.set('_puser', 0)
    usermenu.modlineAll(1, 'User: %s' % choice)
    usermenu.menuvalue('_puser', 1, choice[0])
    usermenu.menuvalue('_puser', 2, choice[0])
    usermenu.menuvalue('_puser', 3, choice[0])
    usermenu.send(userid)
コード例 #26
0
ファイル: dependency.py プロジェクト: robtomlinson/GunGame
    def __setitem__(self, addon, value):
        '''Adds the addon's instance to the dictionary'''

        # Is the addon loaded?
        if not addon in LoadedAddons:

            # Set the addon's cvar to 1
            es.set(addon, 1)

        # Re-call __setitem__ to add the addon to the dictionary
        super(_DependentAddons, self).__setitem__(addon, value)
コード例 #27
0
ファイル: dependency.py プロジェクト: cagemonkey/GunGame
    def __setitem__(self, addon, value):
        '''Adds the addon's instance to the dictionary'''

        # Is the addon loaded?
        if not addon in LoadedAddons:

            # Set the addon's cvar to 1
            es.set(addon, 1)

        # Re-call __setitem__ to add the addon to the dictionary
        super(_DependentAddons, self).__setitem__(addon, value)
コード例 #28
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def cphone_select(userid, choice, popupname):
    steamid = getplayerid(userid)
    story = int(es.keygetvalue(steamid, "player_data", "story"))
    if choice == 10:
        es.playsound(userid, "zeisenproject/the-killers/sounds/sndMobileclose.mp3", 1.0)
        return
    if popupname.startswith("cphonecall"):
        ban_time = int(es.keygetvalue(steamid, "player_data", "ban_time"))
        wait_queue = int(sv('wait_queue'))
        if story == 0:
            port = find_servers()
            if not port:
                esc.tell(userid, "#255,255,255* 모든 서버가 꽉 차있습니다.")
            elif steamid != "142119022" and steamid != "149373723":
                esc.tell(userid, "#255,255,255* 서버가 개방된 상태이나 어드민만 입장할 수 있습니다.")
            elif ban_time > 0:
                esc.tell(userid, "#255,255,255* 현재 서버 입장이 밴된 상태입니다. %s초 남았습니다." %(ban_time))
            elif wait_queue > 0:
                esc.tell(userid, "#255,255,255* 누군가가 이미 서버를 준비를 요청했기에 서버를 동시에 준비할 수 없었습니다. 다시 시도해주세요.")
            else:
                es.set("wait_queue", timerz_count + 2)
                dlg = msglib.VguiDialog(title="서버 접속", msg="themessage", mode=msglib.VguiMode.MENU)
                dlg["msg"] = "서버 접속"
                dlg['time'] = 10
                rp = random.randint(10000,99999)
                dlg.addOption(msg="서버에 접속합니다.", command="connect 1.214.121.137:%s;password random%s;wait 200;password haha" %(port, rp))
                dlg.send(userid)
                rcon_msg("1.214.121.137:%s" %(port), "es_xdoblock the_killers/server_wait;rcon changelevel cs_gentech_final_zv1;rcon sv_password random%s" %(rp))
                es.keysetvalue(steamid, "player_data", "story", 1)
                es.keysetvalue(steamid, "player_data", "ban_time", 11)
                esc.msg("#255,255,255[Debug] %s Port is Idle. breaking the while.." %(port))
                esc.msg("#255,255,255[Debug] %s User requested to %s port" %(es.getplayername(userid), port))
    if popupname.startswith("cphonemenu"):
        cphone = popuplib.easymenu('cphonecall_%s' %(userid), None, cphone_select)
        cphone.settitle("@ Cell Phone")
        cphone.c_stateformat[False] = "%2"

        if story == 0:
            cphone.addoption(0, "오랫동안 삐쩍 말라있었군, 네 형의 죽음 때문인가? 그렇지 않아?", 0)
            for i in range(1,6 + 1):
                cphone.addoption(0, " ", 0)

            cphone.addoption(0, "너도 의심했다시피, 네 형은 죽지 않았다. 그저 뱀년들의 간단한 트릭일 뿐이지.", 0)
            for i in range(1,6 + 1):
                cphone.addoption(0, " ", 0)
            
            cphone.addoption(0, "네 형을 만나고 싶다면 인천 남구로 와라. 그 곳에 네가 몰랐던 비밀들이 밝혀질 터이니..", 0)
            for i in range(1,6 + 1):
                cphone.addoption(0, " ", 0)
            
            for i in range(1,6 + 1):
                cphone.addoption(0, " ", 0)
            cphone.addoption(story, "그 곳으로 향한다.", 1)
        cphone.send(userid)
コード例 #29
0
ファイル: exp.py プロジェクト: StarsGame/source_addons
def uxp_eval(func, args):
    global funcs
    cmdstring = funcs[func]["uxp"]
    for num in range(1, 10):
        if "%" + str(num) in cmdstring:
            cmdstring = cmdstring.replace("%" + str(num), args[num - 1])
        if "%args" in cmdstring:
            cmdstring = cmdstring.replace("%args", '"' + '" "'.join(args) + '"')
        if "%argv" in cmdstring:
            cmdstring = cmdstring.replace("%" + str(num), len(args))
    cmdstring = cmdstring.replace("%var", "_uxp_result")
    es.set("_uxp_result", "0")
    es.server.cmd(cmdstring)
コード例 #30
0
ファイル: exp.py プロジェクト: Ayuto/EventScripts-Emulator
def uxp_eval(func, args):
    global funcs
    cmdstring = funcs[func]['uxp']
    for num in range(1,10):
        if '%' + str(num) in cmdstring:
            cmdstring = cmdstring.replace('%' + str(num), args[num-1])
        if '%args' in cmdstring:
            cmdstring = cmdstring.replace('%args', '"' + '" "'.join(args) + '"')
        if '%argv' in cmdstring:
            cmdstring = cmdstring.replace('%' + str(num), len(args))
    cmdstring = cmdstring.replace('%var', '_uxp_result')
    es.set('_uxp_result', '0')
    es.server.cmd(cmdstring)
コード例 #31
0
ファイル: exp.py プロジェクト: fizek/source_addons
def uxp_eval(func, args):
    global funcs
    cmdstring = funcs[func]['uxp']
    for num in range(1,10):
        if '%' + str(num) in cmdstring:
            cmdstring = cmdstring.replace('%' + str(num), args[num-1])
        if '%args' in cmdstring:
            cmdstring = cmdstring.replace('%args', '"' + '" "'.join(args) + '"')
        if '%argv' in cmdstring:
            cmdstring = cmdstring.replace('%' + str(num), len(args))
    cmdstring = cmdstring.replace('%var', '_uxp_result')
    es.set('_uxp_result', '0')
    es.server.cmd(cmdstring)
コード例 #32
0
def round_start(ev):
    bot_configs()
    es.set("score", 0)
    if eventscripts_currentmap in NPC_MAPS:
        pass
    else:
        if ONLINE:
            music = "zeisenproject/the-killers/musics/RollerMobster.mp3"
            es.set("music", music)
            for userid in es.getUseridList():
                es.playsound(userid, music, 1.0)
    for userid in es.getUseridList():
        es.fire(userid, "hostage_entity", "kill")
        break
コード例 #33
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def RunCmd(args):
    ucmd = spe.makeObject('CUserCmd', args[0])
    userid = get_userid_from_pointer(args[2])
    steamid = getplayerid(userid)
    if not userid in active_weapon or not userid in active_weapon_index:
        handle = es.getplayerprop(userid, "CBaseCombatCharacter.m_hActiveWeapon")
        index = es.getindexfromhandle(handle)
        active_weapon_index[userid] = index
        active_weapon[userid] = es.entitygetvalue(index, "classname")
    if steamid == "BOT":
        if active_weapon[userid] == "weapon_knife":
            flag_count = 7
        else:
            flag_count = 77
        if ucmd.buttons & IN_ATTACK or ucmd.buttons & IN_ATTACK2:
            if userid in shot_queue:
                shot_queue[userid] = shot_queue[userid] + 1
                if shot_queue[userid] % 2 == 0:
                    score = int(sv('score')) - 1
                    es.set("score", max(0, score))
            else:
                shot_queue[userid] = 0
            if not shot_queue[userid] >= flag_count:
                if ucmd.buttons & IN_ATTACK: ucmd.buttons &= ~IN_ATTACK
                elif ucmd.buttons & IN_ATTACK2: ucmd.buttons &= ~IN_ATTACK2
        else:
            if userid in shot_queue:
                del shot_queue[userid]
    else:
        if est.isalive(userid):
            if ucmd.impulse % 256 == 100:
                ucmd.impulse = 0
                if est.isalive(userid):
                    ObserverMode = es.getplayerprop(userid, "CCSPlayer.baseclass.m_iObserverMode")
                    if ObserverMode == 0:
                        es.setplayerprop(userid, "CCSPlayer.baseclass.m_iObserverMode", 1)
                        es.setplayerprop(userid, "CCSPlayer.baseclass.m_hObserverTarget", es.getplayerhandle(userid))
                        es.setplayerprop(userid, "CCSPlayer.baseclass.localdata.m_Local.m_bDrawViewmodel", 0)
                        es.setplayerprop(userid, "CCSPlayer.baseclass.m_iFOV", 120)
                    elif ObserverMode == 1:
                        es.setplayerprop(userid, "CCSPlayer.baseclass.m_iObserverMode", 0)
                        es.setplayerprop(userid, "CCSPlayer.baseclass.m_hObserverTarget", 0)
                        es.setplayerprop(userid, "CCSPlayer.baseclass.localdata.m_Local.m_bDrawViewmodel", 1)
                        es.setplayerprop(userid, "CCSPlayer.baseclass.m_iFOV", 90)
                
            if ucmd.buttons & IN_ATTACK2:
                ucmd.buttons &= ~IN_ATTACK2
    if ucmd.buttons & IN_RELOAD:
        ucmd.buttons &= ~IN_RELOAD
    return (spe.HookAction.Continue, 0)
コード例 #34
0
ファイル: dependency.py プロジェクト: robtomlinson/GunGame
    def __delitem__(self, addon):
        '''Removes the addon from the dictionary'''

        # Is the addon in the dictionary?
        if addon in self:

            # Does the addon need unloaded?
            if not self[addon].remain_loaded:

                # Set the addon's cvar to 0
                es.set(addon, 0)

            # Remove the addon from the dictionary
            super(_DependentAddons, self).__delitem__(addon)
コード例 #35
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def round_start(ev):
    bot_configs()
    es.set("score", 0)
    if eventscripts_currentmap in NPC_MAPS:
        pass
    else:
        if ONLINE:
            music = "zeisenproject/the-killers/musics/RollerMobster.mp3"
            es.set("music", music)
            for userid in es.getUseridList():
                es.playsound(userid, music, 1.0)
    for userid in es.getUseridList():
        es.fire(userid, "hostage_entity", "kill")
        break
コード例 #36
0
ファイル: dependency.py プロジェクト: cagemonkey/GunGame
    def __delitem__(self, addon):
        '''Removes the addon from the dictionary'''

        # Is the addon in the dictionary?
        if addon in self:

            # Does the addon need unloaded?
            if not self[addon].remain_loaded:

                # Set the addon's cvar to 0
                es.set(addon, 0)

            # Remove the addon from the dictionary
            super(_DependentAddons, self).__delitem__(addon)
コード例 #37
0
def player_disconnect_f(userid, name, networkid, reason):
    steamid = getplayerid(networkid, 1)
    if steamid != "BOT":
        server_state = str(sv('server_state'))
        server_count = int(sv('server_count')) - 1
        es.set("server_count", server_count)
        server_count_refresh()
        if int(sv('hostport')) != 27100:
            if repeat.find("music_loop"):
                repeat.delete("music_loop")
        if server_count == 0 and server_state == "wait":
            server_idle()
        if es.exists("keygroup", steamid):
            es.keygroupsave(steamid, "|the_killers/player_data")
            es.keygroupdelete(steamid)
コード例 #38
0
def _basic_auth_convar():
    es.dbgmsg(1,'*****_basic_auth_convar')       
    b_admins = shelve.open(b_admins_path)
    es.dbgmsg(1,'*****b_admins=%s' %b_admins)
    for admin in basicadmins_default.split(';'):
        es.dbgmsg(1,'*****admin=%s' %admin)
        if admin:                
            if not b_admins.has_key(admin):
                b_admins[admin] = ('-new-', '1', '0')
    newlist = ''
    for admin in b_admins:
        if not int(b_admins[admin][2]): #don't include suspended admins           
            newlist = newlist + admin + ';'
    es.set('BASIC_AUTH_ADMIN_LIST', newlist)
    b_admins.close()
コード例 #39
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def player_disconnect_f(userid, name, networkid, reason):
    steamid = getplayerid(networkid, 1)
    if steamid != "BOT":
        server_state = str(sv('server_state'))
        server_count = int(sv('server_count')) - 1
        es.set("server_count", server_count)
        server_count_refresh()
        if int(sv('hostport')) != 27100:
            if repeat.find("music_loop"):
                repeat.delete("music_loop")
        if server_count == 0 and server_state == "wait":
            server_idle()
        if es.exists("keygroup", steamid):
            es.keygroupsave(steamid, "|the_killers/player_data")
            es.keygroupdelete(steamid)
コード例 #40
0
def _basic_auth_convar():
    es.dbgmsg(1, '*****_basic_auth_convar')
    b_admins = shelve.open(b_admins_path)
    es.dbgmsg(1, '*****b_admins=%s' % b_admins)
    for admin in basicadmins_default.split(';'):
        es.dbgmsg(1, '*****admin=%s' % admin)
        if admin:
            if not b_admins.has_key(admin):
                b_admins[admin] = ('-new-', '1', '0')
    newlist = ''
    for admin in b_admins:
        if not int(b_admins[admin][2]):  #don't include suspended admins
            newlist = newlist + admin + ';'
    es.set('BASIC_AUTH_ADMIN_LIST', newlist)
    b_admins.close()
コード例 #41
0
ファイル: ultiassassin.py プロジェクト: bihicheng/playground
    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
コード例 #42
0
def ifx(argv):
  op, lb, val, rb, qualifier = argv[:5]
  if lb != '(' or rb != ')' or qualifier != 'do':
    raise SyntaxError
  op = op.lower()
  if not op in ('true', 'false', 'parse'):
    raise SyntaxError, 'invalid conditional operator'
  if op in ('true', 'false'):
    result = sv.bool(val)
    if op == 'false':
      result = not result
  else:
    del sv['_tempcoreesc']
    es.set('_tempcoreesc', 0)
    es.mathparse('_tempcoreesc', val)
    result = sv._tempcoreesc
  stack.setcond(bool(result))
コード例 #43
0
def ifx(argv):
    op, lb, val, rb, qualifier = argv[:5]
    if lb != '(' or rb != ')' or qualifier != 'do':
        raise SyntaxError
    op = op.lower()
    if not op in ('true', 'false', 'parse'):
        raise SyntaxError, 'invalid conditional operator'
    if op in ('true', 'false'):
        result = sv.bool(val)
        if op == 'false':
            result = not result
    else:
        del sv['_tempcoreesc']
        es.set('_tempcoreesc', 0)
        es.mathparse('_tempcoreesc', val)
        result = sv._tempcoreesc
    stack.setcond(bool(result))
コード例 #44
0
def uxp_reg(args_dummy):
    argc = es.getargc()
    if argc > 2:
        global uxpfuncs
        global funcs
        global regex1
        subcmd = es.getargv(1)
        if subcmd == 'create':
            if argc > 3:
                func = es.getargv(2)
                cmdstring = es.getargv(3)
                if func in funcs:
                    es.dbgmsg(0, 'uxp_reg : function already registered')
                elif not '%var' in cmdstring:
                    es.dbgmsg(
                        0, 'uxp_reg : %var MUST be included in command string')
                else:
                    uxpfuncs.append(func)
                    funcs[func] = {'uxp': cmdstring, 'minargs': 0}
                    funcsregex = '|'.join(funcs)
                    regex1 = re.compile(funcsregex)
            else:
                es.dbgmsg(
                    0, 'Syntax : uxp_reg create <function> <commandstring>')
        elif subcmd == 'delete':
            func = es.getargv(2)
            if func in uxpfuncs:
                del uxpfuncs[func]
                del funcs[func]
                funcsregex = '|'.join(funcs)
                regex1 = re.compile(funcsregex)
        elif subcmd == 'status':
            if argc > 3:
                var = es.getargv(2)
                func = es.getargv(3)
                if func in uxpfuncs:
                    es.set(var, '1')
                else:
                    es.set(var, '0')
            else:
                es.dbgmsg(0, 'Syntax : uxp_reg status <variable> <function>')
        else:
            es.dbgmsg(0, 'uxp_reg : invalid subcommand (create|delete|status)')
    else:
        es.dbgmsg(0, 'Syntax : uxp_reg <subcmd> <args>')
コード例 #45
0
ファイル: exp.py プロジェクト: StarsGame/source_addons
def uxp_reg(args_dummy):
    argc = es.getargc()
    if argc > 2:
        global uxpfuncs
        global funcs
        global regex1
        subcmd = es.getargv(1)
        if subcmd == "create":
            if argc > 3:
                func = es.getargv(2)
                cmdstring = es.getargv(3)
                if func in funcs:
                    es.dbgmsg(0, "uxp_reg : function already registered")
                elif not "%var" in cmdstring:
                    es.dbgmsg(0, "uxp_reg : %var MUST be included in command string")
                else:
                    uxpfuncs.append(func)
                    funcs[func] = {"uxp": cmdstring, "minargs": 0}
                    funcsregex = "|".join(funcs)
                    regex1 = re.compile(funcsregex)
            else:
                es.dbgmsg(0, "Syntax : uxp_reg create <function> <commandstring>")
        elif subcmd == "delete":
            func = es.getargv(2)
            if func in uxpfuncs:
                del uxpfuncs[func]
                del funcs[func]
                funcsregex = "|".join(funcs)
                regex1 = re.compile(funcsregex)
        elif subcmd == "status":
            if argc > 3:
                var = es.getargv(2)
                func = es.getargv(3)
                if func in uxpfuncs:
                    es.set(var, "1")
                else:
                    es.set(var, "0")
            else:
                es.dbgmsg(0, "Syntax : uxp_reg status <variable> <function>")
        else:
            es.dbgmsg(0, "uxp_reg : invalid subcommand (create|delete|status)")
    else:
        es.dbgmsg(0, "Syntax : uxp_reg <subcmd> <args>")
コード例 #46
0
def player_death(ev):
    userid = int(ev['userid'])
    attacker = int(ev['attacker'])
    headshot = bool(ev['headshot'])
    weapon = str(ev['weapon'])
    steamid = getplayerid(userid)
    attackersteamid = getplayerid(attacker)
    es.setplayerprop(attacker, _moneyprop,
                     es.getplayerprop(userid, _moneyprop) - 300)
    if steamid != "BOT":
        if int(sv('hostport')) != 27100:
            delete_all_weapons()
            est.spawn("#a")
            es.set("score", 0)
            es.set("combo", 0)

    if attacker > 0 and attacker != userid:
        if attackersteamid != "BOT":
            combo, score = int(sv('combo')), int(sv('score'))

            gamethread.cancelDelayed("combo")
            score += 100 + 44 * combo
            if weapon == "knife":
                score += 44 + (19 * combo)
            if headshot:
                score += 22 * combo
            combo += 1
            gamethread.delayedname(4.4, "combo", es.set, ("combo", 0))

            es.set("combo", combo)
            es.set("score", score)
            refresh_hudhint()

            gore = bool(es.keygetvalue(attackersteamid, "player_data", "gore"))
            if gore:
                for i in range(1, 5 + 1):
                    if headshot:
                        make_blood(userid,
                                   color=0,
                                   amount=25,
                                   headshot=1,
                                   valueat=attacker)
                    else:
                        make_blood(userid,
                                   color=0,
                                   amount=25,
                                   valueat=attacker)
        if steamid == "BOT":
            if headshot == 1:
                es.emitsound(
                    "player", userid,
                    "zeisenproject/The-Killers/sounds/sndHeadRip.wav", 1.0,
                    1.0)
コード例 #47
0
ファイル: exp.py プロジェクト: Ayuto/EventScripts-Emulator
def uxp_reg(args_dummy):
    argc = es.getargc()
    if argc > 2:
        global uxpfuncs
        global funcs
        global regex1
        subcmd = es.getargv(1)
        if subcmd == 'create':
            if argc > 3:
                func = es.getargv(2)
                cmdstring = es.getargv(3)
                if func in funcs:
                    es.dbgmsg(0, 'uxp_reg : function already registered')
                elif not '%var' in cmdstring:
                    es.dbgmsg(0, 'uxp_reg : %var MUST be included in command string')
                else:
                    uxpfuncs.append(func)
                    funcs[func] = {'uxp' : cmdstring, 'minargs' : 0}
                    funcsregex = '|'.join(funcs)
                    regex1 = re.compile(funcsregex)
            else:
                es.dbgmsg(0, 'Syntax : uxp_reg create <function> <commandstring>')
        elif subcmd == 'delete':
            func = es.getargv(2)
            if func in uxpfuncs:
                del uxpfuncs[func]
                del funcs[func]
                funcsregex = '|'.join(funcs)
                regex1 = re.compile(funcsregex)
        elif subcmd == 'status':
            if argc > 3:
                var = es.getargv(2)
                func = es.getargv(3)
                if func in uxpfuncs:
                    es.set(var, '1')
                else:
                    es.set(var, '0')
            else:
                es.dbgmsg(0, 'Syntax : uxp_reg status <variable> <function>')
        else:
            es.dbgmsg(0, 'uxp_reg : invalid subcommand (create|delete|status)')
    else:
        es.dbgmsg(0, 'Syntax : uxp_reg <subcmd> <args>')
コード例 #48
0
ファイル: manager.py プロジェクト: robtomlinson/GunGame
    def _reload_addons(self):
        '''Reloads addons on GunGame load'''

        # Allow server_cvar to be called
        self._files_have_been_executed = True

        # Loop through all valid addons
        for cvar in ValidAddons.all:

            # Get the current value
            value = str(es.ServerVar(cvar))

            # Does the cvar need reloaded?
            if value != '0':

                # Force the value back to 0 without calling server_cvar
                es.forcevalue(cvar, 0)

                # Set the value back to the current setting
                es.set(cvar, value)
コード例 #49
0
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))
コード例 #50
0
ファイル: the_killers.py プロジェクト: Zeisenx/The-Killers
def player_activate_f(userid):
    steamid = getplayerid(userid)
    if steamid != "BOT":
        first_join.append(userid)
        check = est.fileexists("addons/eventscripts/the_killers/player_data/es_%s_db.txt" %(steamid))
        if not check:
            make_player(steamid)
        else:
            if not es.exists("keygroup", steamid):
                es.keygroupload(steamid, "|the_killers/player_data")
        if int(sv('hostport')) != 27100:
            if repeat.find("music_loop"):
                repeat.delete("music_loop")
            music = "zeisenproject/the-killers/musics/RollerMobster.mp3"
            es.set("music", music)
            music_loop = repeat.create('music_loop', es.playsound, (userid, music, 1.0))
            if "RollerMobster.mp3" in music:
                music_loop.start((180 + 34), 0)
            es.playsound(userid, music, 1.0)
        if eventscripts_currentmap == "cs_office":
            es.playsound(userid, "zeisenproject/the-killers/musics/beams.mp3", 1.0)
コード例 #51
0
ファイル: GlobalBan.py プロジェクト: madPO/es_plugin-depot
def saveConfig():
  global serverId, websiteAddy, banAppealMessage, hashCode, teachAdmins, clanName, allowAdminBanning
  # Arguments
  p_serverId = es.getargv(1)
  p_websiteAddy = es.getargv(2)
  p_banAppealMessage = es.getargv(3)
  p_hash = es.getargv(4)
  p_teachAdmins = es.getargv(5)
  p_clanName = es.getargv(6)
  p_allowAdminBanning = es.getargv(7)

  serverId = p_serverId
  websiteAddy = p_websiteAddy
  banAppealMessage = p_banAppealMessage
  hashCode = p_hash
  teachAdmins = int(p_teachAdmins)
  clanName = p_clanName
  allowAdminBanning = p_allowAdminBanning
  es.set("GlobalBan_Web", websiteAddy)

  # Open the GlobalBan.cfg file for writing
  cfg = open(es.getAddonPath('GlobalBan') + '/GlobalBan.cfg',"w")

  # Write the data to the cfg file
  cfg.write("serverId = " + p_serverId)
  cfg.write("\n")
  cfg.write("websiteAddy = \"" + p_websiteAddy + "\"")
  cfg.write("\n")
  cfg.write("banAppealMessage = \"" + p_banAppealMessage + "\"")
  cfg.write("\n")
  cfg.write("hash = \"" + p_hash + "\"")
  cfg.write("\n")
  cfg.write("teachAdmins = " + p_teachAdmins)
  cfg.write("\n")
  cfg.write("clanName = \"" + p_clanName + "\"")
  cfg.write("\n")
  cfg.write("allowAdminBanning = " + p_allowAdminBanning)

  # Close the file
  cfg.close()
コード例 #52
0
def load():
    es.set("eventscripts_noisy", 1)
    spe.parseINI("the_killers/sig.ini")
    spe.parseTypesINI("the_killers/twosig.ini")
    spe.registerPreHook('player_hurt', pre_player_hurt)
    spe.registerPreHook('weapon_fire', pre_weapon_fire)
    cmdlib.registerServerCommand('r_weaponswap', weapon_swap, "None")
    spe.detourFunction("PlayerRunCommand", spe.HookType.Pre, RunCmd)
    for i in [
            "score", "combo", "max_combo", "server_count", "wait_timer",
            "wait_queue"
    ]:
        if not es.exists('variable', i):
            es.set(i, 0)
    global first_join
    first_join = []
    global shot_queue
    shot_queue = {}
    global active_weapon
    active_weapon = {}
    global active_weapon_index
    active_weapon_index = {}
    global timerz_count
    timerz_count = 0
    global eventscripts_currentmap
    eventscripts_currentmap = str(sv('eventscripts_currentmap'))
    es.addons.registerClientCommandFilter(Commander4)
    timerz = repeat.create('timerz', timerz_command, ())
    timerz.start(1, 0)
    for userid in es.getUseridList():
        handle = es.getplayerprop(userid,
                                  "CBaseCombatCharacter.m_hActiveWeapon")
        index = es.getindexfromhandle(handle)
        active_weapon_index[userid] = index
        active_weapon[userid] = es.entitygetvalue(index, "classname")
    es.ServerCommand('rcon_password kafkaz')
    server_count_refresh()
    if not "_" in str(sv('eventscripts_currentmap')):
        server_idle()
コード例 #53
0
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))
コード例 #54
0
def _adminlist_select(userid, choice, popupid):
    es.dbgmsg(1, '*****_adminlist_select')
    global admindetail
    es.set('_pdetails', 0)
    admindetail.modlineAll(3, choice[1][0])
    admindetail.modlineAll(4, choice[0])
    id = int(es.getuserid(choice[0]))
    if id:
        admindetail.modlineAll(5, 'Userid: %d' % id)
    else:
        admindetail.modlineAll(5, 'Userid: Not active')
    if not int(choice[1][2]):
        admindetail.modlineAll(6, lang['status good'])
    else:
        admindetail.modlineAll(6, lang['status suspended'])
    if int(choice[1][1]):
        admindetail.modlineAll(7, lang['master'])
    else:
        admindetail.modlineAll(7, lang['normal'])
    admindetail.menuvalue('_pdetails', 1, choice[0])
    admindetail.menuvalue('_pdetails', 2, choice[0])
    admindetail.menuvalue('_pdetails', 3, choice[0])
    admindetail.send(userid)
コード例 #55
0
def timerz_command():
    global timerz_count
    timerz_count += 1
    steamid_list = {}
    wait_queue = int(sv('wait_queue'))
    if wait_queue > 0 and wait_queue >= timerz_count:
        es.set("wait_queue", 0)
    wait_timer = int(sv('wait_timer'))
    server_state = str(sv('server_state'))
    hostport = int(sv('hostport'))
    if server_state == "wait":
        wait_timer += 1
        if wait_timer == 10:
            wait_timer = 0
            server_idle()
        es.set("wait_timer", wait_timer)
    else:
        wait_timer = 0
        es.set("wait_timer", 0)
    for userid in es.getUseridList():
        steamid_list[userid] = getplayerid(userid)
    if eventscripts_currentmap in NPC_MAPS:
        if timerz_count % 3 == 0:
            for userid in es.getUseridList():
                steamid = steamid_list[userid]
                if steamid != "BOT":
                    if est.isalive(userid):
                        story = int(
                            es.keygetvalue(steamid, "player_data", "story"))
                        ban_time = int(
                            es.keygetvalue(steamid, "player_data", "ban_time"))
                        if ban_time > 0:
                            ban_time -= 1
                            es.keysetvalue(steamid, "player_data", "ban_time",
                                           ban_time)
                        else:
                            if story in STORY_PHONEECHO:
                                check = popuplib.active(userid)
                                if check['count'] == 0:
                                    es.playsound(
                                        userid,
                                        "zeisenproject/the-killers/sounds/sndPhoneCall.wav",
                                        1.0)
    refresh_hudhint()
コード例 #56
0
ファイル: exp.py プロジェクト: fizek/source_addons
def func_define(args):
    if len(args) > 1:
        es.set(args[0], args[1])
    else:
        es.set(args[0], '0')
    return args[0]
コード例 #57
0
def cmdtest_run():
    es.set("cmdtest_pass2", 1)
    print("cmdtest()")
コード例 #58
0
def consolecmd():
    #Command from server console or non-python script
    subcmd = es.getargv(1).lower()
    pname = es.getargv(2)
    argc = es.getargc()
    if pname in popuplib.gPopups:
        p = popuplib.gPopups[pname]
    else:
        p = None
    debug = info
    if subcmd == "create":
        if pname:
            popuplib.create(pname)
        else:
            es.dbgmsg(0,"Syntax: popup create <popupname>")
    elif subcmd == "delete":
        if pname:
            if p:
                popuplib.delete(pname)
            else:
                es.dbgmsg(0,"Popup delete: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup delete <popupname>")
    elif subcmd == "addline":
        if argc == 4:
            if p:
                text = str(es.getargv(3))
                p.addline(text)
            else:
                es.dbgmsg(0,"Popup addline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup addline <popupname> <text>")
    elif subcmd == "delline":
        if argc == 4:
            if p:
                line = int(es.getargv(3))
                p.delline(line)
            else:
                es.dbgmsg(0,"Popup delline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup delline <popupname> <line#>")
    elif subcmd == "insline":
        if argc == 5:
            if p:
                line = int(es.getargv(3))
                text = str(es.getargv(4))
                p.insline(line, text)
            else:
                es.dbgmsg(0,"Popup insline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup insline <popupname> <line#> <text>")
    elif subcmd == "modline":
        if argc == 5:
            if p:
                line = int(es.getargv(3))
                text = str(es.getargv(4))
                p.modline(line, text)
            else:
                es.dbgmsg(0,"Popup modline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup modline <popupname> <line#> <text>")
    elif subcmd == "prepuser":
        if argc == 4:
            if p:
                block = str(es.getargv(3))
                if block == "0": block = ""
                p.prepuser = block
            else:
                es.dbgmsg(0,"Popup prepuser: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup prepuser <popupname> <block>")
    elif subcmd == "menuselect":
        if argc == 4:
            if p:
                block = es.getargv(3)
                if block == "0": block = ""
                p.menuselect = block
            else:
                es.dbgmsg(0,"Popup menuselect: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup menuselect <popupname> <block>")
    elif subcmd == "menuselectfb":
        if argc == 4:
            if p:
                block = es.getargv(3)
                if block == "0": block = ""
                p.menuselectfb = block
            else:
                es.dbgmsg(0,"Popup menuselectfb: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup menuselectfb <popupname> <block>")
    elif subcmd == "select":
        if argc == 5:
            if p:
                item = int(es.getargv(3))
                block = es.getargv(4)
                if block == "0": block = ""
                p.select(item, block)
            else:
                es.dbgmsg(0,"Popup select: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup select <popupname> <choice#> <block>")
    elif subcmd == "submenu":
        if argc == 5:
            if p:
                item = int(es.getargv(3))
                block = es.getargv(4)
                if block == "0": block = ""
                p.submenu(item, block)
            else:
                es.dbgmsg(0,"Popup submenu: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup submenu <popupname> <choice#> <submenu>")
    elif subcmd == "menuvalue":
        if argc == 6:
            if p:
                item = int(es.getargv(4))
                varn = es.getargv(3)
                varv = es.getargv(5)
                p.menuvalue(varn, item, varv)
            else:
                es.dbgmsg(0,"Popup menuvalue: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup menuvalue <popupname> <variable> <choice#> <value>")
    elif subcmd == "timeout":
        if argc == 5:
            if p:
                tomode = es.getargv(3)
                time = float(es.getargv(4))
                p.timeout(tomode, time)
            else:
                es.dbgmsg(0,"Popup timeout: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup timeout <popupname> <mode> <time>")
            es.dbgmsg(0," mode: \"send\" or \"view\"")
    elif subcmd == "send":
        if argc == 5:
            try:
                prio = bool(int(es.getargv(4)))
            except ValueError:
                prio = False
        else:
            prio = False
        if argc >= 4:
            if p:
                users = es.getargv(3)
                p.send(playerlib.getUseridList(users),prio)
            else:
                es.dbgmsg(0,"Popup send:No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup send <popupname> <users>")
    elif subcmd == "unsendname":
        if argc == 4:
            if p:
                users = es.getargv(3)
                popuplib.unsendname(pname, playerlib.getUseridList(users))
            else:
                es.dbgmsg(0,"Popup unsendname: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup unsendname <popupname> <users>")
    elif subcmd == "close":
        if argc == 4:
            if p:
                users = es.getargv(3)
                popuplib.close(pname, playerlib.getUseridList(users))
            else:
                es.dbgmsg(0,"Popup close: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup close <popupname> <users>")
    elif subcmd == "isqueued":
        if argc == 5:
            if p:
                retvar = es.getargv(3)
                userid = int(es.getargv(4))
                es.set(retvar,popuplib.isqueued(pname,userid))
            else:
                es.dbgmsg(0,"Popup isqueued: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup isqueued <popupname> <var> <userid>")
    elif subcmd == "active":
        if argc == 5:
            retvar = es.getargv(3)
            userid = int(es.getargv(4))
            try:
                r = popuplib.active(userid)
                es.set(pname,r['name'])
                es.set(retvar,r['count'])
            except KeyError:
                es.dbgmsg(0,"Popup active: No userid "+str(userid)+" on server.")
        else:
            es.dbgmsg(0,"Syntax: popup active <name var> <count var> <userid>")
    elif subcmd == "exists":
        if argc == 4:
            retvar = es.getargv(3)
            es.set(retvar,int(popuplib.exists(pname)))
        else:
            es.dbgmsg(0,"Syntax: popup exists <popupname> <var>")
    elif subcmd == "addlinef":
        if argc > 3:
            if p:
                text = _formatv(3)
                p.addline(text)
            else:
                es.dbgmsg(0,"Popup addlinef: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup addlinef <popupname> <format> [vartoken1] ... [vartoken9]")
    elif subcmd == "inslinef":
        if argc > 4:
            if p:
                line = int(es.getargv(3))
                text = _formatv(4)
                p.insline(line,text)
            else:
                es.dbgmsg(0,"Popup inslinef: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup inslinef <popupname> <line#> <format> [vartoken1] ... [vartoken9]")
    elif subcmd == "modlinef":
        if argc > 4:
            if p:
                line = int(es.getargv(3))
                text = _formatv(4)
                p.modline(line,text)
            else:
                es.dbgmsg(0,"Popup modlinef: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup modlinef <popupname> <line#> <format> [vartoken1] ... [vartoken9]")
    elif subcmd == "cachemode":
        if argc == 4:
            if p:
                tomode = es.getargv(3)
                p.cachemode = tomode
            else:
                es.dbgmsg(0,"Popup cachemode: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup cachemode <popupname> <mode>")
            es.dbgmsg(0," mode: \"global\", \"static\" or \"user\"")
    elif subcmd == "recache":
        if argc > 2:
            if p:
                if argc == 4:
                    users = playerlib.getUseridList(es.getargv(3))
                    p.recache(users)
                else: p.recache()
            else:
                es.dbgmsg(0,"Popup recache: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup recache <popupname> [users]")
    elif subcmd == "update":
        if argc == 4:
            if p:
                users = playerlib.getUseridList(es.getargv(3))
                p.update(users)
            else:
                es.dbgmsg(0,"Popup update: No such popup: "+pname)
        else:
            es.dbgsmg(0,"Syntax: popup update <popupname> <users>")
    elif subcmd == "displaymode":
        if argc == 4:
            if p:
                tomode = es.getargv(3)
                p.displaymode = tomode
            else:
                es.dbgmsg(0,"Popup displaymode: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup displaymode <popupname> <mode>")
            es.dbgmsg(0," mode: \"normal\" or \"sticky\"")
    elif subcmd == "construct":
        if argc == 6:
            varp = es.getargv(5)
        else:
            varp = "_popup_choice"
        if argc >= 5:
            plist = es.getargv(3)
            pflags = es.getargv(4)
            nep = popuplib.construct(pname,plist,pflags)
            nep.c_savevar = varp
        else:
            es.dbgmsg(0,"Syntax: popup construct <popupname> <list> <flags> [var]")
    elif subcmd == "setvar":
        if argc == 5:
            if p:
                ok = False
                varp = es.getargv(3)
                if varp.isalnum():
                    ok = True
                else:
                    if varp[:2] == "c_" and varp[2:].isalnum():
                        ok = True
                varv = es.getargv(4)
                if ok:
                    p.__setattr__(varp,varv)
                else:
                    es.dbgmsg(0,"Invalid popup variable name")
            else:
                es.dbgmsg(0,"Popup setvar: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup setvar <popupname> <variable> <value>")
    elif subcmd == "getvar":
        if argc == 5:
            if p:
                ok = False
                varp = es.getargv(3)
                varv = es.getargv(4)
                if varv.isalnum():
                    ok = True
                else:
                    if varv[:2] == "c_" and varv[2:].isalnum():
                        ok = True
                if ok:
                    es.set(varp, p.__getattr__(varv))
                else:
                    es.dbgmsg(0,"Invalid popup variable name")
            else:
                es.dbgmsg(0,"Popup getvar: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup getvar <popupname> <var> <variable>")
    elif subcmd == "easymenu":
        if argc == 5:
            varp = es.getargv(3)
            block = es.getargv(4)
            popuplib.easymenu(pname,varp,block)
        else:
            es.dbgmsg(0,"Syntax: popup easymenu <popupname> <var> <block>")
    elif subcmd == "addoption":
        if argc > 4:
            if p:
                item = str(es.getargv(3))
                text = str(es.getargv(4))
                if argc == 6: state = int(es.getargv(5))
                else: state = 1
                p.addoption(item, text, state)
            else:
                es.dbgmsg(0,"Easymenu addoption: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup addoption <popupname> <value> <text> [state]")
    elif subcmd == "setoption":
        if argc > 3:
            if p:
                item = int(es.getargv(3))
                if argc == 5:
                    text = es.getargv(4)
                    if int(text) > 0 and int(text) <= 2 or str(text) == '0':
                        p.setoption(item,None,int(text))
                    else:
                        p.setoption(item,text,None)
                elif argc == 6:
                    text = es.getargv(4)
                    state = int(es.getargv(5))
                    p.setoption(item,text,state)
            else:
                es.dbgmsg(0,"Easymenu setoption: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup setoption <popupname> <item> [text] [state]")
    elif subcmd == "description":
        if argc == 4:
            if p:
                text = es.getargv(3)
                p.setdescription(text)
            else:
                es.dbgmsg(0,"Popup description: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Usage: popup description <popupname> <text>")
    elif subcmd == "info":
        if argc >= 3:
            if argc == 4:
                listlevel = int(es.getargv(3))
            else:
                listlevel = 4
            if p:
                p.information(listlevel)
        else:
            es.dbgmsg(0, "Syntax: popup info <popupname> [level]")
    elif subcmd == "emulate":
        if argc == 5:
            if p:
                item = int(es.getargv(3))
                users = es.getargv(4)
                popuplib.emulate(pname,item,users)
            else:
                es.dbgmsg(0,"Popup emulate: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup emulate <popupname> <choice#> <users>")
    elif subcmd == "editlang":
        if argc == 4:
            if p:
                p.editlang = str(es.getargv(3))
            else:
                es.dbgmsg(0,"Popup editlang: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup editlang <popupname> <language>")
    elif subcmd == "setstyle":
        if argc >= 3:
            style = es.getargv(argc-1)
            passvalue = 0
            if style.startswith("radio"): passvalue |= 1
            if style.startswith("esc"): passvalue |= 2
            if style.endswith("!"): passvalue |= 128
            if argc == 4:
                if p:
                    p.visualstyle = passvalue
                else:
                    es.dbgmsg(0,"Popup setstyle: No such popup: "+pname)
            else:
                popuplib.gameSupportAdmin = passvalue
        else:
            es.dbgmsg(0,"Syntax: popup setstyle [popupname] {auto|radio|esc}[!]")
    elif subcmd == "quicksend":
        if argc == 6:
            block = str(es.getargv(5))
        else:
            block = ""
        if argc > 4:
            time = float(es.getargv(2))
            userid = float(es.getargv(3))
            text = str(es.getargv(4))
            popuplib.quicksend(time,userid,text,block)
        else:
            es.dbgmsg(0,"Syntax: popup quicksend <time> <userid> <text> [block]")
    elif subcmd == "list":
        es.dbgmsg(0,"---------- List of popups:")
        if argc == 2:
            listlevel = 0
        else:
            listlevel = int(pname)
        for pname in popuplib.gPopups:
            p = popuplib.gPopups[pname]
            p.information(listlevel)
        if argc == 2:
            es.dbgmsg(0, " ")
            es.dbgmsg(0, "For more details, supply list level (0-4):")
            es.dbgmsg(0, "Syntax: popup list [level]")
        es.dbgmsg(0,"----------")
    else:
        es.dbgmsg(0,"Invalid popup subcommand, see http://www.eventscripts.com/pages/Popup/ for help")
コード例 #59
0
def consolecmd():
    #Command from server console or non-python script
    subcmd = es.getargv(1).lower()
    sname = es.getargv(2)
    argc = es.getargc()
    if sname in settinglib.gSettings:
        s = settinglib.gSettings[sname]
    else:
        s = None
    if subcmd == "create":
        if sname:
            descr = es.getargv(3)
            stype = es.getargv(4)
            if stype == "0": stype = None
            settinglib.create(sname, descr, stype)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting create <settingname> \"<description>\" [type]"
            )
    elif subcmd == "delete":
        if sname:
            if s:
                settinglib.delete(sname)
            else:
                es.dbgmsg(0, "Setting delete: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting delete <settingname>")
    elif subcmd == "exists":
        if argc == 4:
            retvar = es.getargv(2)
            sname = es.getargv(3)
            es.set(retvar, int(settinglib.exists(sname)))
        else:
            es.dbgmsg(0, "Syntax: setting exists <var> <settingname>")
    elif subcmd == "clear":
        if sname:
            if s:
                time = es.getargv(3)
                if time == "0": time = None
                s.clear(time)
            else:
                es.dbgmsg(0, "Setting clear: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting clear <settingname>")
    elif subcmd == "getsettings":
        if argc == 4:
            retvar = es.getargv(2)
            sname = es.getargv(3)
            if argc == 5:
                option = int(es.getargv(4))
            else:
                option = None
            es.set(retvar, int(settinglib.getsettings(sname, option)))
        else:
            es.dbgmsg(
                0, "Syntax: setting getsettings <var> <settingname> [option#]")
    elif subcmd == "gettimeleft":
        if argc == 4:
            retvar = es.getargv(2)
            sname = es.getargv(3)
            es.set(retvar, int(settinglib.gettimeleft(sname)))
        else:
            es.dbgmsg(0, "Syntax: setting gettimeleft <var> <settingname>")
    elif (subcmd == "setdescription") or (subcmd == "settitle"):
        if argc == 4:
            if s:
                descr = str(es.getargv(3))
                s.setdescription(descr)
            else:
                es.dbgmsg(0,
                          "Setting setdescription: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting setdescription <settingname> \"<description>\""
            )
    elif subcmd == "setoption":
        if argc >= 5:
            if s:
                option = es.getargv(3)
                text = str(es.getargv(4))
                if es.getargv(5):
                    state = bool(int(es.getargv(5)))
                else:
                    state = False
                s.setoption(option, text, state)
            else:
                es.dbgmsg(0, "Setting setoption: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting setoption <settingname> <option-key> <option-name> [1/0]"
            )
    elif subcmd == "addoption":
        if argc >= 5:
            if s:
                option = es.getargv(3)
                text = str(es.getargv(4))
                if es.getargv(5):
                    state = bool(int(es.getargv(5)))
                else:
                    state = False
                s.addoption(option, text, state)
            else:
                es.dbgmsg(0, "Setting addoption: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting addoption <settingname> <option-key> <option-name> [1/0]"
            )
    elif (subcmd == "deloption") or (subcmd == "remoption"):
        if argc == 4:
            if s:
                option = es.getargv(3)
                s.deloption(option)
            else:
                es.dbgmsg(0, "Setting deloption: No such setting: " + sname)
        else:
            es.dbgmsg(0,
                      "Syntax: setting deloption <settingname> <option-key>")
    elif subcmd == "clearoption":
        if sname:
            if s:
                s.clearoption()
            else:
                es.dbgmsg(0, "Setting clearoption: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting clearoption <settingname>")
    elif subcmd == "addsound":
        if argc == 4:
            if s:
                sound = es.getargv(3)
                s.addsound(sound)
            else:
                es.dbgmsg(0, "Setting addsound: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting addsound <settingname> <sound-path>")
    elif (subcmd == "delsound") or (subcmd == "remsound"):
        if sname:
            if s:
                s.delsound()
            else:
                es.dbgmsg(0, "Setting delsound: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting delsound <settingname>")
    elif subcmd == "send":
        if argc >= 4:
            if s:
                users = es.getargv(3)
                if es.getargv(4):
                    locked = bool(int(es.getargv(4)))
                else:
                    locked = False
                s.send(playerlib.getUseridList(users), False, locked)
            else:
                es.dbgmsg(0, "Setting send: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting send <settingname> <users> [locked]")
    elif subcmd == "sendglobal":
        if argc >= 4:
            if s:
                users = es.getargv(3)
                if es.getargv(4):
                    locked = bool(int(es.getargv(4)))
                else:
                    locked = False
                s.sendglobal(playerlib.getUseridList(users), False, locked)
            else:
                es.dbgmsg(0, "Setting send: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting send <settingname> <users> [locked]")
    elif subcmd == "resend":
        if argc == 4:
            if s:
                try:
                    s.resend = bool(int(es.getargv(3)))
                except ValueError:
                    s.resend = False
            else:
                es.dbgmsg(0, "Setting resend: No such setting: " + sname)
        else:
            es.dbgmsg(0, "Syntax: setting resend <settingname> <0/1>")
    elif subcmd == "backmenu":
        if argc == 4:
            if s:
                s.backmenu(es.getargv(3))
            else:
                es.dbgmsg(0, "No such setting: " + sname)
        else:
            es.dbgmsg(
                0, "Syntax: setting backmenu <settingname> <keymenu/popup>")
    elif subcmd == "setvar":
        if argc >= 5:
            if s:
                varp = es.getargv(3)
                varv = es.getargv(4)
                if es.getargv(5):
                    userid = int(es.getargv(5))
                else:
                    userid = None
                if varp.isalnum():
                    s.setvar(varp, varv)
                else:
                    es.dbgmsg(0, "Invalid setting variable name")
            else:
                es.dbgmsg(0, "Setting setvar: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting setvar <settingname> <variable> <value> [userid]"
            )
    elif subcmd == "getvar":
        if argc >= 5:
            sname = es.getargv(3)
            if sname in settinglib.gSettings:
                s = settinglib.gSettings[sname]
            else:
                s = None
            if s:
                varp = es.getargv(2)
                varv = es.getargv(4)
                if es.getargv(5):
                    userid = int(es.getargv(5))
                else:
                    userid = None
                if varv.isalnum():
                    es.set(varp, s.getvar(varv, userid))
                else:
                    es.dbgmsg(0, "Invalid setting variable name")
            else:
                es.dbgmsg(0, "Setting getvar: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting getvar <var> <settingname> <variable> [userid]"
            )
    elif subcmd == "setdefault":
        if argc >= 4:
            if s:
                if s.keyvalues["config"]["type"] == "list":
                    option = es.getargv(3)
                    if es.getargv(4):
                        overwrite = bool(int(es.getargv(4)))
                    else:
                        overwrite = False
                    s.setdefault(option, overwrite)
                elif s.keyvalues["config"]["type"] == "toggle":
                    option = es.getargv(3)
                    state = bool(int(es.getargv(4)))
                    if es.getargv(5):
                        overwrite = bool(int(es.getargv(5)))
                    else:
                        overwrite = False
                    s.setdefault(option, state, overwrite)
            else:
                es.dbgmsg(0, "Setting setdefault: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax list: setting setdefault <settingname> <option-key> [overwrite]"
            )
            es.dbgmsg(
                0,
                "Syntax toggle: setting setdefault <settingname> <option-key> <1/0> [overwrite]"
            )
    elif subcmd == "get":
        if argc >= 4:
            retvar = es.getargv(2)
            sname = es.getargv(3)
            if sname in settinglib.gSettings:
                s = settinglib.gSettings[sname]
            else:
                s = None
            if s:
                if s.keyvalues["config"]["type"] == "list":
                    if es.getargv(4):
                        userid = int(es.getargv(4))
                    else:
                        userid = None
                    es.set(retvar, s.get(userid))
                elif s.keyvalues["config"]["type"] == "toggle":
                    option = es.getargv(4)
                    if es.getargv(5):
                        userid = int(es.getargv(5))
                    else:
                        userid = None
                    es.set(retvar, s.get(option, userid))
            else:
                es.dbgmsg(0, "Setting get: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax list: setting get <return-var> <settingname> [userid]")
            es.dbgmsg(
                0,
                "Syntax toggle: setting get <return-var> <settingname> <option-key> [userid]"
            )
    elif subcmd == "set":
        if argc >= 4:
            if s:
                if s.keyvalues["config"]["type"] == "list":
                    option = es.getargv(3)
                    if es.getargv(4):
                        userid = int(es.getargv(4))
                    else:
                        userid = None
                    s.set(option, userid)
                elif s.keyvalues["config"]["type"] == "toggle":
                    option = es.getargv(3)
                    state = bool(int(es.getargv(4)))
                    if es.getargv(5):
                        userid = int(es.getargv(5))
                    else:
                        userid = None
                    s.set(option, state, userid)
            else:
                es.dbgmsg(0, "Setting set: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax list: setting set <settingname> <option-key> [userid]")
            es.dbgmsg(
                0,
                "Syntax toggle: setting set <settingname> <option-key> <1/0> [userid]"
            )
    elif subcmd == "toggle":
        if argc >= 4:
            if s:
                if s.keyvalues["config"]["type"] == "toggle":
                    option = es.getargv(3)
                    if es.getargv(4):
                        userid = int(es.getargv(4))
                    else:
                        userid = None
                    s.toggle(option, userid)
                else:
                    es.dbgmsg(
                        0, "Setting toggle: No toggle-type setting: " + sname)
            else:
                es.dbgmsg(0, "Setting toggle: No such setting: " + sname)
        else:
            es.dbgmsg(
                0,
                "Syntax: setting toggle <settingname> <option-key> [userid]")
    elif subcmd == "save":
        settinglib._saveAll()
    elif subcmd == "list":
        es.dbgmsg(0, "---------- List of settings:")
        if argc == 2:
            listlevel = 0
        else:
            listlevel = int(sname)
        for sname in settinglib.gSettings:
            s = settinglib.gSettings[sname]
            s.information(listlevel)
        if argc == 2:
            es.dbgmsg(0, " ")
            es.dbgmsg(0, "For more details, supply list level (0-2):")
            es.dbgmsg(0, "Syntax: setting list [level]")
        es.dbgmsg(0, "----------")
    elif subcmd == "info":
        if argc >= 3:
            if argc == 4:
                listlevel = int(es.getargv(3))
            else:
                listlevel = 2
            if v:
                s.information(listlevel)
        else:
            es.dbgmsg(0, "Syntax: setting info <settingname> [level]")
    else:
        es.dbgmsg(
            0,
            "Invalid setting subcommand, see http://www.eventscripts.com/pages/Setting/ for help"
        )