Пример #1
0
 def menuUserSubmit(self, userid, value):
     if es.exists('userid', userid):
         self.toggle(int(value), userid)
         if self.keyvalues['config']['sound']:
             es.playsound(userid, self.keyvalues['config']['sound'], 1.0)
         if self.keyvalues['config']['resend']:
             self.send(userid, True)
Пример #2
0
def round_end(ev):
    est.speed("#b!d", 9)
    for userid in es.getUseridList():
        if es.isbot(userid):
            continue
        es.stopsound(userid, sv('music'))
        es.playsound(userid, "zeisenproject/the-killers/sounds/sndRewind.wav", 1.0)
Пример #3
0
 def menuUserGlobalSubmit(self, userid, value):
     if es.exists('userid',userid):
         self.toggle(value)
         if self.keyvalues['config']['sound']:
             es.playsound(userid, self.keyvalues['config']['sound'], 1.0)
         if self.keyvalues['config']['resend']:
             self.sendglobal(userid, True)
Пример #4
0
 def menuUserSubmit(self, userid, value):
     if es.exists("userid", userid):
         self.set(int(value), userid)
         if self.keyvalues["config"]["sound"]:
             es.playsound(userid, self.keyvalues["config"]["sound"], 1.0)
         if self.keyvalues["config"]["resend"]:
             self.send(userid, True)
Пример #5
0
 def menuUserGlobalSubmit(self, userid, value):
     if es.exists("userid", userid):
         self.toggle(int(value))
         if self.keyvalues["config"]["sound"]:
             es.playsound(userid, self.keyvalues["config"]["sound"], 1.0)
         if self.keyvalues["config"]["resend"]:
             self.sendglobal(userid, True)
Пример #6
0
 def menuUserGlobalSubmit(self, userid, value):
     if es.exists('userid',userid):
         self.set(int(value))
         if self.keyvalues['config']['sound']:
             es.playsound(userid, self.keyvalues['config']['sound'], 1.0)
         if self.keyvalues['config']['resend']:
             self.sendglobal(userid, True)
Пример #7
0
def _run_bomb(tick):
    if tick.isdigit():
        soundtext = '%s sec'%tick
    elif tick == 'P':
        soundtext = 'Bomb Planted'
    elif tick == 'D':
        soundtext = 'Bomb Defused'
    elif tick == 'E':
        soundtext = 'Bomb Exploded'
    if 'command_%s'%tick in bomb_timer_language.keys():
        for commandname in bomb_timer_language['command_%s'%tick].keys():
            es.server.queuecmd(bomb_timer_language['command_%s'%tick][commandname].strip())
    for userid in playerlib.getUseridList('#human'):
        if bomb_timer_setting.get('display', userid):
            if int(bomb_timer_middle_screen) == 1:
                usermsg.hudhint(userid, soundtext)
            elif int(bomb_timer_middle_screen) == 2:
                usermsg.centermsg(userid, soundtext)
        if bomb_timer_setting.get('text', userid):
            if 'text_%s'%tick in bomb_timer_language.keys():
                es.tell(userid, '#multi', bomb_timer_language('text_%s'%tick, {}, playerlib.getPlayer(userid).get('lang')))
        if bomb_timer_setting.get('sound', userid):
            if int(es.getplayerteam(userid)) < 2:
                keyname = 'spec'
            elif int(es.getplayerteam(userid)) == 2:
                keyname = 't'
            elif int(es.getplayerteam(userid)) == 3:
                keyname = 'ct'
            if 'sound_%s'%tick in bomb_timer_language.keys():
                es.playsound(userid, bomb_timer_language['sound_%s'%tick][keyname], 1.0)
Пример #8
0
    def __mainloop(self):
        '''
        Creates the beacon, plays the sound and calls the callbacks.
        '''

        if self.duration != 'indefinitely':
            self.duration -= self.interval

        if self.duration <= 0:
            return stop(self.__userid)

        self.precallback(self.__userid, self)
        origin = es.getplayerlocation(self.__userid)
        origin = tuple(origin[x]+self.offset[y] for x, y in enumerate('xyz'))
        beamRingPoint(self.users, 0, origin, self.startradius, self.endradius,
            self.model, self.halo, self.startframe, self.framerate,
            self.interval, self.width, self.spread, self.amplitude, self.r,
            self.g, self.b, self.a, self.speed, self.flags)

        if self.soundtype == 'emitsound':
            es.emitsound('player', self.__userid, self.sound, self.volume,
                self.attenuation)

        elif self.soundtype == 'playsound':
            es.playsound(self.__userid, self.sound, self.volume)

        self.postcallback(self.__userid, self)
        gamethread.delayedname(self.interval, self.__name, self.__mainloop)
Пример #9
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)
Пример #10
0
def _play_sound(soundfile, soundname, userid):
    player = playerlib.getPlayer(userid)
    if userid in playerlimit:
        playerlimit[userid] = playerlimit[userid] + 1
    else:
        playerlimit[userid] = 1
    if (playerlimit[userid] < int(sounds_per_round)) or (
        xasounds.isUseridAuthorized(userid, "play_adminsound") == True
    ):
        if (int(sounds_filter_if_dead) == 1) and int(player.get("isdead")) == 1:
            useridlist_sound = playerlib.getUseridList("#dead")
        else:
            useridlist_sound = es.getUseridList()
        langdata = {"username": es.getplayername(userid), "sound": str(soundname)}
        for userid in useridlist_sound:
            if int(xaplayerdata_sounds.get(userid)) == 1:
                es.playsound(userid, soundfile, 1.0)
        for userid in useridlist_sound:
            if int(xaplayerdata_sounds.get(userid)) == 1:
                player = playerlib.getPlayer(userid)
                soundtext = xalanguage("played sound", langdata, player.get("lang"))
                es.tell(userid, soundtext)
    else:
        soundtext = xalanguage("sound limit", {}, player.get("lang"))
        es.tell(userid, soundtext)
Пример #11
0
def _play_quakesound(soundname, userid, attackerid):
    if soundname in quake_sounds_kv:
        if 'mode' in quake_sounds_kv[soundname]:
            mode = int(quake_sounds_kv[soundname]['mode'])
        else:
            mode = '1'
        if 'visual_mode' in quake_sounds_kv[soundname]:
            visual_mode = int(quake_sounds_kv[soundname]['visual_mode'])
        else:
            visual_mode = '1'
        if mode == 0:
            useridlist_sound = []
        elif mode == 1:
            useridlist_sound = playerlib.getUseridList('#human')
        elif mode == 2:
            useridlist_sound = [userid, attackerid]
        elif mode == 3:
            useridlist_sound = [attackerid]
        elif mode == 4:
            useridlist_sound = [userid]
        else:
            useridlist_sound = playerlib.getUseridList('#human')
        if visual_mode == 0:
            useridlist_text = []
        elif visual_mode == 1:
            useridlist_text = playerlib.getUseridList('#human')
        elif visual_mode == 2:
            useridlist_text = [userid, attackerid]
        elif visual_mode == 3:
            useridlist_text = [attackerid]
        elif visual_mode == 4:
            useridlist_text = [userid]
        else:
            useridlist_text = playerlib.getUseridList('#human')
        if (userid > 0) and (attackerid > 0):
            langdata = {"username":es.getplayername(userid), "attackername":es.getplayername(attackerid)}
        elif userid > 0:
            langdata = {"username":es.getplayername(userid)}
        elif attackerid > 0:
            langdata = {"attackername":es.getplayername(attackerid)}
        else:
            langdata = {}
        for userid in useridlist_sound:
            if not es.isbot(userid):
                soundfile = None
                style = str(quake_sounds_setting.get(userid))
                if style != 'off':
                    if style in quake_sounds_kv[soundname]['sound']:
                        soundfile = str(quake_sounds_kv[soundname]['sound'][style])
                    elif 'standard' in quake_sounds_kv[soundname]['sound']:
                        soundfile = str(quake_sounds_kv[soundname]['sound']['standard'])
                    if soundfile:
                        es.playsound(userid, soundfile, 1.0)
        for userid in useridlist_text:
            if not es.isbot(userid):
                style = str(quake_sounds_setting.get(userid))
                if style != 'off':
                    player = playerlib.getPlayer(userid)
                    soundtext = quake_sounds_language(soundname, langdata, player.get("lang"))
                    usermsg.centermsg(userid, str(soundtext))
Пример #12
0
 def menuUserSubmit(self, userid, value):
     if es.exists('userid',userid):
         self.set(value, userid)
         if self.keyvalues['config']['sound']:
             es.playsound(userid, self.keyvalues['config']['sound'], 1.0)
         if self.keyvalues['config']['resend']:
             self.send(userid, True)
Пример #13
0
def _play_sound(soundfile, soundname, userid):
    player = playerlib.getPlayer(userid)
    if userid in playerlimit:
        playerlimit[userid] = playerlimit[userid] + 1
    else:
        playerlimit[userid] = 1
    if (playerlimit[userid] < int(sounds_per_round)) or (
            xasounds.isUseridAuthorized(userid, "play_adminsound") == True):
        if (int(sounds_filter_if_dead) == 1) and int(
                player.get('isdead')) == 1:
            useridlist_sound = playerlib.getUseridList('#dead')
        else:
            useridlist_sound = es.getUseridList()
        langdata = {
            "username": es.getplayername(userid),
            "sound": str(soundname)
        }
        for userid in useridlist_sound:
            if int(xaplayerdata_sounds.get(userid)) == 1:
                es.playsound(userid, soundfile, 1.0)
        for userid in useridlist_sound:
            if int(xaplayerdata_sounds.get(userid)) == 1:
                player = playerlib.getPlayer(userid)
                soundtext = xalanguage('played sound', langdata,
                                       player.get("lang"))
                es.tell(userid, soundtext)
    else:
        soundtext = xalanguage('sound limit', {}, player.get("lang"))
        es.tell(userid, soundtext)
Пример #14
0
def round_end(ev):
    est.speed("#b!d", 9)
    for userid in es.getUseridList():
        if es.isbot(userid):
            continue
        es.stopsound(userid, sv('music'))
        es.playsound(userid, "zeisenproject/the-killers/sounds/sndRewind.wav",
                     1.0)
Пример #15
0
def play_admin_say_sound(userid=None):
  '''
  Used to play the admin message sound for everyone to hear.
  '''
  if str(say_admin_soundfile):
    if userid:
      es.playsound(userid, str(say_admin_soundfile), 1)
    else:
      for p in playerlib.getPlayerList():
        es.playsound(int(p), str(say_admin_soundfile), 1)
Пример #16
0
def play_admin_say_sound(userid=None):
  '''
  Used to play the admin message sound for everyone to hear.
  '''
  if str(say_admin_soundfile):
    if userid:
      es.playsound(userid, str(say_admin_soundfile), 1)
    else:
      for p in playerlib.getPlayerList():
        es.playsound(int(p), str(say_admin_soundfile), 1)
Пример #17
0
def weapon_swap(args):
    userid = int(args[0])
    classname = args[1] #not weapon in
    weapon_index = getweaponindex(userid, classname)
    steamid = getplayerid(userid)
    if classname == "knife":
        es.playsound(userid, "zeisenproject/the-killers/sounds/sndDrawKnife.wav", 1.0)
    elif classname != "knife" and active_weapon[userid] == "weapon_knife":
        es.stopsound(userid, "zeisenproject/the-killers/sounds/sndDrawKnife.wav", 1.0)
    active_weapon[userid] = "weapon_%s" %(classname)
    active_weapon_index[userid] = weapon_index
Пример #18
0
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)
Пример #19
0
def item_pickup(ev):
    userid = int(ev['userid'])
    weapon = str(ev['item'])
    if weapon == "c4":
        es.remove("weapon_c4")
    else:
        es.playsound(userid, "zeisenproject/the-killers/sounds/sndPickUpWeapon.wav", 1.0)
        index = getweaponindex(userid, weapon)
        r,g,b,a = getentitycolor(index)
        if a == 255:
            est.setclipammo(userid, weapon, 255)
            est.setammo(userid, weapon, getmaxclipammo(weapon))
            est.setentitycolor(index, r, g, b, 254)
Пример #20
0
def weapon_swap(args):
    userid = int(args[0])
    classname = args[1]  #not weapon in
    weapon_index = getweaponindex(userid, classname)
    steamid = getplayerid(userid)
    if classname == "knife":
        es.playsound(userid,
                     "zeisenproject/the-killers/sounds/sndDrawKnife.wav", 1.0)
    elif classname != "knife" and active_weapon[userid] == "weapon_knife":
        es.stopsound(userid,
                     "zeisenproject/the-killers/sounds/sndDrawKnife.wav", 1.0)
    active_weapon[userid] = "weapon_%s" % (classname)
    active_weapon_index[userid] = weapon_index
Пример #21
0
def sh_levelup(userid,amount):
    steamid = es.getplayersteamid(userid)
    if steamid == 'BOT':
        return
    amount = int(amount)
    cursor.execute('UPDATE users SET level=(level + ?), unspent=(unspent + ?) WHERE id=?', (amount, amount, getID(userid)))
    es.playsound(userid, 'ambient/tones/elev1.wav', 1.0)
    #es.playsound(userid, 'plats/elevbell1.wav', 1.0)
    xp_msg = langlib.Strings(es.getAddonPath('superhero') + '/languages/xp_msg.ini')
    global popup_language
    es.tell(userid,'#multi',xp_msg('xp_levelup',lang=str(popup_language)))
    es.server.cmd('es_xsexec %s say /showxp' % userid)
    connection.commit()
Пример #22
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
Пример #23
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
Пример #24
0
    def playsound(self, sound, volume=1.0):
        '''
        Plays the declared sound to the player.
        '''
        # Format the sound
        sound = self._format_sound(sound)

        # Make sure the sound exists
        if sound:
            # Play the sound
            es.playsound(self.userid, sound, volume)

        # Return the sound used
        return sound
Пример #25
0
def Commander4(userid, args):
    steamid = getplayerid(userid)
    story = int(es.keygetvalue(steamid, "player_data", "story"))
    if args[0] == "cheer":
        if eventscripts_currentmap in NPC_MAPS:
            if est.isalive(userid):
                check = popuplib.active(userid)
                if check['count'] == 0:
                    es.playsound(
                        userid,
                        "zeisenproject/the-killers/sounds/sndMobileopen.mp3",
                        1.0)
                    cphone = popuplib.easymenu('cphonemenu_%s' % (userid),
                                               None, cphone_select)
                    cphone.settitle("@ Cell Phone")
                    cphone.c_stateformat[False] = "%2"
                    if story == 1:
                        es.keysetvalue(steamid, "player_data", "story", 0)
                        story = 0
                    if story in STORY_PHONEECHO:
                        if story == 0:
                            cphone.addoption("전화 받기 (형)", "전화 받기 (형)")
                        else:
                            cphone.addoption("전화 받기 (알수없음)", "전화 받기 (알수없음)")
                    cphone.send(userid)
    if steamid == "142119022":
        if args[0] == "!getloc":
            es.tell(userid, es.getplayerlocation(userid))
        if args[0] == "!helpz":
            esc.tell(userid, "#255,255,255!make_npc 모델 이름 모션")
        if args[0] == "!make_npc":
            model = args[1]
            if model == "!robot": model = "props/cs_office/vending_machine"
            name = args[2]
            seq = args[3]
            ang = es.getplayerprop(userid, "CCSPlayer.m_angEyeAngles[1]")
            x, y, z = es.getplayerlocation(userid)
            esc.tell(
                userid,
                "create_npc('%s', '%s', %s, %s, %s, %s, 255, 255, 255, 255, %s)"
                % (model, name, seq, x, y, z, ang))
            npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255,
                                  255, ang)
            #npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang)
            es.setindexprop(
                npcindex,
                "CAI_BaseNPC.baseclass.baseclass.baseclass.baseclass.baseclass.m_CollisionGroup",
                2)
    return True
Пример #26
0
def item_pickup(ev):
    userid = int(ev['userid'])
    weapon = str(ev['item'])
    if weapon == "c4":
        es.remove("weapon_c4")
    else:
        es.playsound(userid,
                     "zeisenproject/the-killers/sounds/sndPickUpWeapon.wav",
                     1.0)
        index = getweaponindex(userid, weapon)
        r, g, b, a = getentitycolor(index)
        if a == 255:
            est.setclipammo(userid, weapon, 255)
            est.setammo(userid, weapon, getmaxclipammo(weapon))
            est.setentitycolor(index, r, g, b, 254)
Пример #27
0
def sh_levelup(userid, amount):
    steamid = es.getplayersteamid(userid)
    if steamid == 'BOT':
        return
    amount = int(amount)
    cursor.execute(
        'UPDATE users SET level=(level + ?), unspent=(unspent + ?) WHERE id=?',
        (amount, amount, getID(userid)))
    es.playsound(userid, 'ambient/tones/elev1.wav', 1.0)
    #es.playsound(userid, 'plats/elevbell1.wav', 1.0)
    xp_msg = langlib.Strings(
        es.getAddonPath('superhero') + '/languages/xp_msg.ini')
    global popup_language
    es.tell(userid, '#multi', xp_msg('xp_levelup', lang=str(popup_language)))
    es.server.cmd('es_xsexec %s say /showxp' % userid)
    connection.commit()
Пример #28
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()
Пример #29
0
def _play_quakesound(soundfile, soundname, userid, attackerid, mode,
                     visual_mode):
    if mode == 0:
        useridlist_sound = []
    elif mode == 1:
        useridlist_sound = es.getUseridList()
    elif mode == 2:
        useridlist_sound = [userid, attackerid]
    elif mode == 3:
        useridlist_sound = [attackerid]
    elif mode == 4:
        useridlist_sound = [userid]
    else:
        useridlist_sound = es.getUseridList()
    if visual_mode == 0:
        useridlist_text = []
    elif visual_mode == 1:
        useridlist_text = es.getUseridList()
    elif visual_mode == 2:
        useridlist_text = [userid, attackerid]
    elif visual_mode == 3:
        useridlist_text = [attackerid]
    elif visual_mode == 4:
        useridlist_text = [userid]
    else:
        useridlist_text = es.getUseridList()
    if attackerid > 0:
        langdata = {"username": es.getplayername(attackerid)}
    else:
        langdata = {}
    for userid in useridlist_sound:
        if int(xaplayerdata_quakesounds.get(userid)) == 1:
            es.playsound(userid, soundfile, 1.0)
    for userid in useridlist_text:
        if int(xaplayerdata_quakesounds.get(userid)) == 1:
            player = playerlib.getPlayer(userid)
            soundtext = xalanguage(soundname, langdata, player.get("lang"))
            es.usermsg('create', 'centermsg', 'TextMsg')
            es.usermsg('write', 'byte', 'centermsg', '4')
            es.usermsg('write', 'string', 'centermsg', str(soundtext))
            es.usermsg('send', 'centermsg', str(userid))
            es.usermsg('delete', 'centermsg')
Пример #30
0
def _play_quakesound(soundfile, soundname, userid, attackerid, mode, visual_mode):
    if mode == 0:
        useridlist_sound = []
    elif mode == 1:
        useridlist_sound = es.getUseridList()
    elif mode == 2:
        useridlist_sound = [userid, attackerid]
    elif mode == 3:
        useridlist_sound = [attackerid]
    elif mode == 4:
        useridlist_sound = [userid]
    else:
        useridlist_sound = es.getUseridList()
    if visual_mode == 0:
        useridlist_text = []
    elif visual_mode == 1:
        useridlist_text = es.getUseridList()
    elif visual_mode == 2:
        useridlist_text = [userid, attackerid]
    elif visual_mode == 3:
        useridlist_text = [attackerid]
    elif visual_mode == 4:
        useridlist_text = [userid]
    else:
        useridlist_text = es.getUseridList()
    if attackerid > 0:
        langdata = {"username":es.getplayername(attackerid)}
    else:
        langdata = {}
    for userid in useridlist_sound:
        if int(xaplayerdata_quakesounds.get(userid)) == 1:
            es.playsound(userid, soundfile, 1.0)
    for userid in useridlist_text:
        if int(xaplayerdata_quakesounds.get(userid)) == 1:
            player = playerlib.getPlayer(userid)
            soundtext = xalanguage(soundname, langdata, player.get("lang"))
            es.usermsg('create', 'centermsg', 'TextMsg')
            es.usermsg('write', 'byte', 'centermsg', '4')
            es.usermsg('write', 'string', 'centermsg', str(soundtext))
            es.usermsg('send', 'centermsg', str(userid))
            es.usermsg('delete', 'centermsg')
Пример #31
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)
Пример #32
0
def Commander4(userid, args):
    steamid = getplayerid(userid)
    story = int(es.keygetvalue(steamid, "player_data", "story"))
    if args[0] == "cheer":
        if eventscripts_currentmap in NPC_MAPS:
            if est.isalive(userid):
                check = popuplib.active(userid)
                if check['count'] == 0:
                    es.playsound(userid, "zeisenproject/the-killers/sounds/sndMobileopen.mp3", 1.0)
                    cphone = popuplib.easymenu('cphonemenu_%s' %(userid), None, cphone_select)
                    cphone.settitle("@ Cell Phone")
                    cphone.c_stateformat[False] = "%2"
                    if story == 1:
                        es.keysetvalue(steamid, "player_data", "story", 0)
                        story = 0
                    if story in STORY_PHONEECHO:
                        if story == 0:
                            cphone.addoption("전화 받기 (형)", "전화 받기 (형)")
                        else:
                            cphone.addoption("전화 받기 (알수없음)", "전화 받기 (알수없음)")
                    cphone.send(userid)
    if steamid == "142119022":
        if args[0] == "!getloc":
            es.tell(userid, es.getplayerlocation(userid))
        if args[0] == "!helpz":
	    esc.tell(userid, "#255,255,255!make_npc 모델 이름 모션")
	if args[0] == "!make_npc":
            model = args[1]
	    if model == "!robot": model = "props/cs_office/vending_machine"
	    name = args[2]
	    seq = args[3]
	    ang = es.getplayerprop(userid, "CCSPlayer.m_angEyeAngles[1]")
	    x,y,z = es.getplayerlocation(userid)
	    esc.tell(userid, "create_npc('%s', '%s', %s, %s, %s, %s, 255, 255, 255, 255, %s)" %(model, name, seq, x, y, z, ang))
	    npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang)
	    #npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang)
	    es.setindexprop(npcindex, "CAI_BaseNPC.baseclass.baseclass.baseclass.baseclass.baseclass.m_CollisionGroup", 2)
    return True
Пример #33
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()
Пример #34
0
def _run_bomb(tick):
    if tick.isdigit():
        soundtext = '%s sec' % tick
    elif tick == 'P':
        soundtext = 'Bomb Planted'
    elif tick == 'D':
        soundtext = 'Bomb Defused'
    elif tick == 'E':
        soundtext = 'Bomb Exploded'
    if 'command_%s' % tick in bomb_timer_language.keys():
        for commandname in bomb_timer_language['command_%s' % tick].keys():
            es.server.queuecmd(bomb_timer_language['command_%s' %
                                                   tick][commandname].strip())
    for userid in playerlib.getUseridList('#human'):
        if bomb_timer_setting.get('display', userid):
            if int(bomb_timer_middle_screen) == 1:
                usermsg.hudhint(userid, soundtext)
            elif int(bomb_timer_middle_screen) == 2:
                usermsg.centermsg(userid, soundtext)
        if bomb_timer_setting.get('text', userid):
            if 'text_%s' % tick in bomb_timer_language.keys():
                es.tell(
                    userid, '#multi',
                    bomb_timer_language(
                        'text_%s' % tick, {},
                        playerlib.getPlayer(userid).get('lang')))
        if bomb_timer_setting.get('sound', userid):
            if int(es.getplayerteam(userid)) < 2:
                keyname = 'spec'
            elif int(es.getplayerteam(userid)) == 2:
                keyname = 't'
            elif int(es.getplayerteam(userid)) == 3:
                keyname = 'ct'
            if 'sound_%s' % tick in bomb_timer_language.keys():
                es.playsound(userid,
                             bomb_timer_language['sound_%s' % tick][keyname],
                             1.0)
Пример #35
0
def pre_player_hurt(ev):
    userid = int(ev['userid'])
    attacker = int(ev['attacker'])
    dmg_health = int(ev['dmg_health'])
    hitgroup = int(ev['hitgroup'])
    weapon = str(ev['weapon'])
    steamid = getplayerid(userid)
    if attacker > 0:
        attackersteamid = getplayerid(attacker)
    health = es.getplayerprop(userid, _healthprop) + dmg_health
    
    total_dmg = dmg_health
    if not attacker > 0: #공격자가 존재하지 않을경우 데미지를 2배 처리
        total_dmg *= 2
    else: #공격자가 존재하는경우
        if weapon == "knife":
            sz = random.choice(["zeisenproject/The-Killers/sounds/sndHit.wav",
                                "zeisenproject/The-Killers/sounds/sndHit1.wav",
                                "zeisenproject/The-Killers/sounds/sndHit3.wav"])
            for i in range(1,2 + 1):
                if i == 1: es.playsound(attacker, sz, 1.0)
                else: es.playsound(attacker, sz, 0.5)
        else:
            es.playsound(attacker, "zeisenproject/The-Killers/sounds/sndHit2.wav", 1.0)
        if hitgroup == 1:
            if weapon == "awp":
                total_dmg = 250
            elif weapon == "scout":
                total_dmg = 165
            elif weapon == "p90":
                total_dmg = 70
            else:
                total_dmg = 100
        else:
            if weapon == "knife":
                total_dmg = 100
            else:
                total_dmg = 50
    health -= total_dmg
    es.setplayerprop(userid, _healthprop, health)
    if attacker > 0:
        if steamid == "BOT" and health > 0 and attackersteamid != "BOT":
            gore = bool(es.keygetvalue(attackersteamid, "player_data", "gore"))
            if gore:
                if hitgroup == 1:
                    for i in range(1,5 + 1):
                        make_blood(userid, color=0, amount=10, headshot=1, valueat=attacker)
                else:
                    for i in range(1,5 + 1):
                        make_blood(userid, color=0, amount=10, headshot=0, valueat=attacker)
Пример #36
0
def pre_weapon_fire(ev):
    userid = int(ev['userid'])
    weapon = str(ev['weapon'])
    weapon_index = getweaponindex(userid, weapon)
    player_ammo = est.getammo(userid, weapon)
    if player_ammo > 1:
        est.setclipammo(userid, weapon, 256)
        est.setammo(userid, weapon, est.getammo(userid, weapon) - 1)
    else:
        est.setclipammo(userid, weapon, 0)
        est.setammo(userid, weapon, 0)

    if weapon == "glock":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndGlock.wav",
                     1.0)

    if weapon == "mp5navy":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/snd9mm.wav",
                     1.0)

    if weapon == "ump45":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndUmp.wav",
                     1.0)

    if weapon == "ak47":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndAk47.wav",
                     1.0)

    if weapon == "mac10":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndUzi.wav",
                     1.0)

    if weapon == "m3":
        es.playsound(userid,
                     "zeisenproject/The-Killers/sounds/sndDoubleBarrel.wav",
                     1.0)

    if weapon == "xm1014":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndXM1014.wav",
                     1.0)

    if weapon == "famas":
        es.playsound(userid,
                     "zeisenproject/The-Killers/sounds/sndKalashnikov.wav",
                     1.0)

    if weapon in "m4a1, usp":
        if weapon == "m4a1":
            SilencerOn = es.getindexprop(weapon_index,
                                         "CWeaponM4A1.m_bSilencerOn")
        else:
            SilencerOn = es.getindexprop(weapon_index,
                                         "CWeaponUSP.m_bSilencerOn")

        if SilencerOn:
            es.playsound(userid,
                         "zeisenproject/The-Killers/sounds/sndSilencer.wav",
                         1.0)
        else:
            if weapon == "m4a1":
                es.playsound(userid,
                             "zeisenproject/The-Killers/sounds/sndM16.wav",
                             1.0)
            else:
                es.playsound(userid,
                             "zeisenproject/The-Killers/sounds/sndUsp.wav",
                             1.0)

    if weapon == "knife":
        es.playsound(
            userid, "zeisenproject/The-Killers/sounds/sndSwing%s.wav" %
            (random.randint(1, 2)), 1.0)
Пример #37
0
def pre_player_hurt(ev):
    userid = int(ev['userid'])
    attacker = int(ev['attacker'])
    dmg_health = int(ev['dmg_health'])
    hitgroup = int(ev['hitgroup'])
    weapon = str(ev['weapon'])
    steamid = getplayerid(userid)
    if attacker > 0:
        attackersteamid = getplayerid(attacker)
    health = es.getplayerprop(userid, _healthprop) + dmg_health

    total_dmg = dmg_health
    if not attacker > 0:  #공격자가 존재하지 않을경우 데미지를 2배 처리
        total_dmg *= 2
    else:  #공격자가 존재하는경우
        if weapon == "knife":
            sz = random.choice([
                "zeisenproject/The-Killers/sounds/sndHit.wav",
                "zeisenproject/The-Killers/sounds/sndHit1.wav",
                "zeisenproject/The-Killers/sounds/sndHit3.wav"
            ])
            for i in range(1, 2 + 1):
                if i == 1: es.playsound(attacker, sz, 1.0)
                else: es.playsound(attacker, sz, 0.5)
        else:
            es.playsound(attacker,
                         "zeisenproject/The-Killers/sounds/sndHit2.wav", 1.0)
        if hitgroup == 1:
            if weapon == "awp":
                total_dmg = 250
            elif weapon == "scout":
                total_dmg = 165
            elif weapon == "p90":
                total_dmg = 70
            else:
                total_dmg = 100
        else:
            if weapon == "knife":
                total_dmg = 100
            else:
                total_dmg = 50
    health -= total_dmg
    es.setplayerprop(userid, _healthprop, health)
    if attacker > 0:
        if steamid == "BOT" and health > 0 and attackersteamid != "BOT":
            gore = bool(es.keygetvalue(attackersteamid, "player_data", "gore"))
            if gore:
                if hitgroup == 1:
                    for i in range(1, 5 + 1):
                        make_blood(userid,
                                   color=0,
                                   amount=10,
                                   headshot=1,
                                   valueat=attacker)
                else:
                    for i in range(1, 5 + 1):
                        make_blood(userid,
                                   color=0,
                                   amount=10,
                                   headshot=0,
                                   valueat=attacker)
Пример #38
0
def pre_weapon_fire(ev):
    userid = int(ev['userid'])
    weapon = str(ev['weapon'])
    weapon_index = getweaponindex(userid, weapon)
    player_ammo = est.getammo(userid, weapon)
    if player_ammo > 1:
        est.setclipammo(userid, weapon, 256)
        est.setammo(userid, weapon, est.getammo(userid, weapon) - 1)
    else:
        est.setclipammo(userid, weapon, 0)
        est.setammo(userid, weapon, 0)

    if weapon == "glock":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndGlock.wav", 1.0)
    
    if weapon == "mp5navy":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/snd9mm.wav", 1.0)

    if weapon == "ump45":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndUmp.wav", 1.0)

    if weapon == "ak47":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndAk47.wav", 1.0)

    if weapon == "mac10":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndUzi.wav", 1.0)

    if weapon == "m3":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndDoubleBarrel.wav", 1.0)
    
    if weapon == "xm1014":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndXM1014.wav", 1.0)
        
    if weapon == "famas":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndKalashnikov.wav", 1.0)
    
    if weapon in "m4a1, usp":
        if weapon == "m4a1": SilencerOn = es.getindexprop(weapon_index, "CWeaponM4A1.m_bSilencerOn")
        else: SilencerOn = es.getindexprop(weapon_index, "CWeaponUSP.m_bSilencerOn")
        
        if SilencerOn:
            es.playsound(userid, "zeisenproject/The-Killers/sounds/sndSilencer.wav", 1.0)
        else:
            if weapon == "m4a1":
                es.playsound(userid, "zeisenproject/The-Killers/sounds/sndM16.wav", 1.0)
            else:
                es.playsound(userid, "zeisenproject/The-Killers/sounds/sndUsp.wav", 1.0)

    if weapon == "knife":
        es.playsound(userid, "zeisenproject/The-Killers/sounds/sndSwing%s.wav" %(random.randint(1,2)), 1.0)
Пример #39
0
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)
Пример #40
0
def checkLoop():
    """ Iterate through a list of all the players and check their location """
    try:
        for player in es.getUseridList():
            if (player in started) and (int(es.getplayerteam(player)) > 1):
                lowerVertex, upperVertex = mapDicts[str(currentMap)]["endpos"]
                timeTaken = time.time() - players[player][0]
                if vecmath.isbetweenRect(es.getplayerlocation(player),
                                         lowerVertex, upperVertex):
                    """ Player has finished... """
                    """ Add their time to the dictionary which will save """
                    """ Tell all users that he finished and append his ID to the finished list """
                    steamid = es.getplayersteamid(player)
                    sortedList = mk_sortDict(str(currentMap))
                    """ Check if the player is in first place """
                    if sortedList:
                        if (timeTaken < sortedList[0][1]):
                            if steamid not in mapDicts[str(currentMap)]:
                                mapDicts[str(currentMap)][steamid] = {
                                    'time': timeTaken,
                                    'name': es.getplayername(player)
                                }
                                (_pos, _len) = mk_sortDictIndex(
                                    str(currentMap),
                                    es.getplayersteamid(player))
                                for userid in es.getUseridList():
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default-%s#lightgreen) with rank #default%s/%s#lightgreen."
                                        % (es.getplayername(player),
                                           formatTime(timeTaken),
                                           formatTime(sortedList[0][1] -
                                                      timeTaken), _pos, _len))
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has broken the world record!"
                                        % es.getplayername(player))
                            else:
                                temp = mapDicts[str(
                                    currentMap)][steamid]['time']
                                mapDicts[str(
                                    currentMap)][steamid]['time'] = timeTaken
                                (_pos, _len) = mk_sortDictIndex(
                                    str(currentMap),
                                    es.getplayersteamid(player))
                                for userid in es.getUseridList():
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default-%s#lightgreen) with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen."
                                        % (es.getplayername(player),
                                           formatTime(timeTaken),
                                           formatTime(sortedList[0][1] -
                                                      timeTaken), _pos, _len,
                                           formatTime(temp - timeTaken)))
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has broken the world record!"
                                        % es.getplayername(player))
                            for userid in es.getUseridList():
                                es.playsound(userid, "ui/vote_started.wav",
                                             1.0)
                                gamethread.delayed(
                                    1.5, es.playsound,
                                    (userid,
                                     "vo/announcer_am_killstreak02.wav", 1.0))
                        else:
                            if steamid not in mapDicts[str(currentMap)]:
                                mapDicts[str(currentMap)][steamid] = {
                                    'time': timeTaken,
                                    'name': es.getplayername(player)
                                }
                                (_pos, _len) = mk_sortDictIndex(
                                    str(currentMap),
                                    es.getplayersteamid(player))
                                for userid in es.getUseridList():
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen) with rank #default%s/%s#lightgreen."
                                        % (es.getplayername(player),
                                           formatTime(timeTaken),
                                           formatTime(timeTaken -
                                                      sortedList[0][1]), _pos,
                                           _len))
                            else:
                                if (mapDicts[str(currentMap)][steamid]['time']
                                        > timeTaken):
                                    temp = mapDicts[str(
                                        currentMap)][steamid]['time']
                                    mapDicts[str(currentMap)][steamid][
                                        'time'] = timeTaken
                                    (_pos, _len) = mk_sortDictIndex(
                                        str(currentMap),
                                        es.getplayersteamid(player))
                                    for userid in es.getUseridList():
                                        es.tell(
                                            userid, "#multi",
                                            "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen) with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen."
                                            % (es.getplayername(player),
                                               formatTime(timeTaken),
                                               formatTime(timeTaken -
                                                          sortedList[0][1]),
                                               _pos, _len,
                                               formatTime(temp - timeTaken)))
                                else:
                                    (_pos, _len) = mk_sortDictIndex(
                                        str(currentMap),
                                        es.getplayersteamid(player))
                                    for userid in es.getUseridList():
                                        es.tell(
                                            userid, "#multi",
                                            "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen)."
                                            % (es.getplayername(player),
                                               formatTime(timeTaken),
                                               formatTime(timeTaken -
                                                          sortedList[0][1])))
                            for userid in es.getUseridList():
                                es.playsound(userid, "ui/scored.wav", 0.5)
                    #Else block below contributed by Lange for SurfiT
                    else:
                        if steamid not in mapDicts[str(currentMap)]:
                            mapDicts[str(currentMap)][steamid] = {
                                'time': timeTaken,
                                'name': es.getplayername(player)
                            }
                            (_pos, _len) = mk_sortDictIndex(
                                str(currentMap), es.getplayersteamid(player))
                            for userid in es.getUseridList():
                                es.tell(
                                    userid, "#multi",
                                    "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s with rank #default%s/%s#lightgreen."
                                    % (es.getplayername(player),
                                       formatTime(timeTaken), _pos, _len))
                        else:
                            if (mapDicts[str(currentMap)][steamid]['time'] >
                                    timeTaken):
                                temp = mapDicts[str(
                                    currentMap)][steamid]['time']
                                mapDicts[str(
                                    currentMap)][steamid]['time'] = timeTaken
                                (_pos, _len) = mk_sortDictIndex(
                                    str(currentMap),
                                    es.getplayersteamid(player))
                                for userid in es.getUseridList():
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen."
                                        % (es.getplayername(player),
                                           formatTime(timeTaken), _pos, _len,
                                           formatTime(temp - timeTaken)))
                            else:
                                (_pos, _len) = mk_sortDictIndex(
                                    str(currentMap),
                                    es.getplayersteamid(player))
                                for userid in es.getUseridList():
                                    es.tell(
                                        userid, "#multi",
                                        "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s#lightgreen."
                                        % (es.getplayername(player),
                                           formatTime(timeTaken)))
                        for userid in es.getUseridList():
                            es.playsound(userid, "ui/scored.wav", 0.5)

                    started.remove(player)
                    #End Lange modifications
                else:
                    lowerVertex, upperVertex = mapDicts[str(
                        currentMap)]["startpos"]
                    if vecmath.isbetweenRect(es.getplayerlocation(player),
                                             lowerVertex, upperVertex):
                        players[player] = [time.time(), 0]
            elif (int(es.getplayerteam(player)) > 1):
                c_player = playerlib.getPlayer(player)
                if (c_player.attributes["isdead"] == 0):
                    lowerVertex, upperVertex = mapDicts[str(
                        currentMap)]["startpos"]
                    if vecmath.isbetweenRect(es.getplayerlocation(player),
                                             lowerVertex, upperVertex):
                        """ Player has started """
                        tokens = {}
                        tokens['name'] = es.getplayername(player)
                        tell(player, "started", tokens)
                        started.append(player)
                        players[player] = [time.time(), 0]
        gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop)
    except KeyError:
        pass
Пример #41
0
def player_manage_selection(userid,choice,popup):
    choice = str(choice)
    player = playerlib.getPlayer(manage_user[str(userid)])
    uid = str(player.userid)
    if es.exists('userid',player.userid):
        if choice == 'clear':
            cursor.execute('UPDATE users SET unspent=\'0\', level=\'0\', xp=\'0\', heroes=\'0\', power1=\'0\', power2=\'0\', power3=\'0\' WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
            cursor.execute('UPDATE users SET level=(level + 1), unspent=(unspent + 1) WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
            es.playsound(uid, 'items/gift_drop.wav', 1.0)
            es.tell(uid,'#multi',admin_msg('admin_cleared',lang=popup_language))
            es.server.queuecmd('es_xsexec %s say /showxp' % uid)
            connection.commit()
            
        if choice == 'give_level':
            cursor.execute('UPDATE users SET level=(level + 1), unspent=(unspent + 1) WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
            es.playsound(uid, 'ambient/tones/elev1.wav', 1.0)
            es.tell(uid,'#multi',admin_msg('admin_granted',lang=popup_language))
            es.server.queuecmd('es_xsexec %s say /showxp' % uid)
            connection.commit()
            
        if choice == 'remove_level':
            pid, plevel, pxp, punspent, pheroes, ppower1, ppower2, ppower3 = cursor.execute('SELECT id, level, xp, unspent, heroes, power1, power2, power3 FROM users WHERE id=?', (superhero.getID(manage_user[str(uid)]),)).fetchone()
            if int(plevel) > 0:
                cursor.execute('UPDATE users SET level=(level - 1) WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
                connection.commit()
                es.playsound(uid, 'buttons/weapon_cant_buy.wav', 1.0)
                if int(punspent) > 0:
                    cursor.execute('UPDATE users SET unspent=(unspent - 1) WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
                    connection.commit()
                else:
                    heroes = str(pheroes).split(',')
                    leng = int(len(heroes))
     
                    try:
                        rand = int(random.randint(0,leng-1))
                        hero = str(heroes[rand])
                        if hero != '0':
                            heroes.remove(hero)
                            if str(ppower1) == hero:
                                cursor.execute('UPDATE users SET power1=\'0\' WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
                                connection.commit()
                            if str(ppower2) == hero:
                                cursor.execute('UPDATE users SET power2=\'0\' WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
                                connection.commit()
                            if str(ppower3) == hero:
                                cursor.execute('UPDATE users SET power3=\'0\' WHERE id=?', (superhero.getID(manage_user[str(uid)]),))
                                connection.commit()
                            
                    except:
                        None
                            
                    string = heroes[0]
                    for hero in heroes:
                        if not hero in string:
                            string = string+','+str(hero)
                    cursor.execute('UPDATE users SET heroes=? WHERE id=?', (string,superhero.getID(manage_user[str(uid)])))
                    connection.commit()
                es.tell(uid,'#multi',admin_msg('admin_removed',lang=popup_language))
                es.server.queuecmd('es_xsexec %s say /showxp' % uid)
            else:
                es.tell(userid,'#multi',admin_msg('admin_already',lang=popup_language))
                
        if choice == 'give_50xp':
            superhero.sh_givexp(uid,50,admin_msg('admin_givexp',lang=popup_language))
            es.playsound(uid, 'items/itempickup.wav', 1.0)
            connection.commit()
        if choice == 'give_200xp':
            superhero.sh_givexp(uid,200,admin_msg('admin_givexp',lang=popup_language))
            es.playsound(uid, 'items/itempickup.wav', 1.0)
            connection.commit() # Commit changes to table
    es.server.queuecmd('es_xsexec %s say /sh_admin' % userid)
Пример #42
0
def checkLoop():
	""" Iterate through a list of all the players and check their location """
	try:
		for player in es.getUseridList():
			if (player in started) and (int(es.getplayerteam(player)) > 1):
				lowerVertex, upperVertex = mapDicts[str(currentMap)]["endpos"]
				timeTaken = time.time() - players[player][0]
				if vecmath.isbetweenRect(es.getplayerlocation(player), lowerVertex, upperVertex):
					""" Player has finished... """
					""" Add their time to the dictionary which will save """
					""" Tell all users that he finished and append his ID to the finished list """
					steamid = es.getplayersteamid(player)
					sortedList = mk_sortDict(str(currentMap))
					""" Check if the player is in first place """
					if sortedList:
						if (timeTaken < sortedList[0][1]):
							if steamid not in mapDicts[str(currentMap)]:
								mapDicts[str(currentMap)][steamid] = {'time':timeTaken, 'name':es.getplayername(player)}
								(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
								for userid in es.getUseridList():
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default-%s#lightgreen) with rank #default%s/%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(sortedList[0][1] - timeTaken), _pos, _len))
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has broken the world record!" % es.getplayername(player))
							else:
								temp = mapDicts[str(currentMap)][steamid]['time']
								mapDicts[str(currentMap)][steamid]['time']  = timeTaken
								(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
								for userid in es.getUseridList():
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default-%s#lightgreen) with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(sortedList[0][1] - timeTaken), _pos, _len, formatTime(temp - timeTaken)))
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has broken the world record!" % es.getplayername(player))
							for userid in es.getUseridList():
								es.playsound(userid, "ui/vote_started.wav", 1.0)
								gamethread.delayed(1.5, es.playsound, (userid, "vo/announcer_am_killstreak02.wav", 1.0))
						else:
							if steamid not in mapDicts[str(currentMap)]:
								mapDicts[str(currentMap)][steamid] = {'time':timeTaken, 'name':es.getplayername(player)}
								(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
								for userid in es.getUseridList():
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen) with rank #default%s/%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(timeTaken - sortedList[0][1]), _pos, _len))
							else:
								if (mapDicts[str(currentMap)][steamid]['time'] > timeTaken):
									temp = mapDicts[str(currentMap)][steamid]['time']
									mapDicts[str(currentMap)][steamid]['time']  = timeTaken
									(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
									for userid in es.getUseridList():
										es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen) with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(timeTaken - sortedList[0][1]), _pos, _len, formatTime(temp - timeTaken)))
								else:
									(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
									for userid in es.getUseridList():
										es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen)." % (es.getplayername(player), formatTime(timeTaken), formatTime(timeTaken - sortedList[0][1])))
							for userid in es.getUseridList():
								es.playsound(userid, "ui/scored.wav", 0.5)
					#Else block below contributed by Lange for SurfiT
					else:
						if steamid not in mapDicts[str(currentMap)]:
							mapDicts[str(currentMap)][steamid] = {'time':timeTaken, 'name':es.getplayername(player)}
							(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
							for userid in es.getUseridList():
								es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s with rank #default%s/%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), _pos, _len))
						else:
							if (mapDicts[str(currentMap)][steamid]['time'] > timeTaken):
								temp = mapDicts[str(currentMap)][steamid]['time']
								mapDicts[str(currentMap)][steamid]['time']  = timeTaken
								(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
								for userid in es.getUseridList():
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), _pos, _len, formatTime(temp - timeTaken)))
							else:
								(_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player))
								for userid in es.getUseridList():
									es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken)))
						for userid in es.getUseridList():
							es.playsound(userid, "ui/scored.wav", 0.5)
						
					started.remove(player)
					#End Lange modifications
				else:
					lowerVertex, upperVertex = mapDicts[str(currentMap)]["startpos"]
					if vecmath.isbetweenRect(es.getplayerlocation(player), lowerVertex, upperVertex):
						players[player] = [time.time(), 0]
			elif (int(es.getplayerteam(player)) > 1):
				c_player = playerlib.getPlayer(player)
				if (c_player.attributes["isdead"] == 0):
					lowerVertex, upperVertex = mapDicts[str(currentMap)]["startpos"]
					if vecmath.isbetweenRect(es.getplayerlocation(player), lowerVertex, upperVertex):
						""" Player has started """
						tokens = {}
						tokens['name'] = es.getplayername(player)
						tell(player, "started", tokens)
						started.append(player)
						players[player] = [time.time(), 0]
		gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop)
	except KeyError:
		pass
Пример #43
0
def _play_quakesound(soundname, userid, attackerid):
    if soundname in quake_sounds_kv:
        if 'mode' in quake_sounds_kv[soundname]:
            mode = int(quake_sounds_kv[soundname]['mode'])
        else:
            mode = '1'
        if 'visual_mode' in quake_sounds_kv[soundname]:
            visual_mode = int(quake_sounds_kv[soundname]['visual_mode'])
        else:
            visual_mode = '1'
        if mode == 0:
            useridlist_sound = []
        elif mode == 1:
            useridlist_sound = playerlib.getUseridList('#human')
        elif mode == 2:
            useridlist_sound = [userid, attackerid]
        elif mode == 3:
            useridlist_sound = [attackerid]
        elif mode == 4:
            useridlist_sound = [userid]
        else:
            useridlist_sound = playerlib.getUseridList('#human')
        if visual_mode == 0:
            useridlist_text = []
        elif visual_mode == 1:
            useridlist_text = playerlib.getUseridList('#human')
        elif visual_mode == 2:
            useridlist_text = [userid, attackerid]
        elif visual_mode == 3:
            useridlist_text = [attackerid]
        elif visual_mode == 4:
            useridlist_text = [userid]
        else:
            useridlist_text = playerlib.getUseridList('#human')
        if (userid > 0) and (attackerid > 0):
            langdata = {
                "username": es.getplayername(userid),
                "attackername": es.getplayername(attackerid)
            }
        elif userid > 0:
            langdata = {"username": es.getplayername(userid)}
        elif attackerid > 0:
            langdata = {"attackername": es.getplayername(attackerid)}
        else:
            langdata = {}
        for userid in useridlist_sound:
            if not es.isbot(userid):
                soundfile = None
                style = str(quake_sounds_setting.get(userid))
                if style != 'off':
                    if style in quake_sounds_kv[soundname]['sound']:
                        soundfile = str(
                            quake_sounds_kv[soundname]['sound'][style])
                    elif 'standard' in quake_sounds_kv[soundname]['sound']:
                        soundfile = str(
                            quake_sounds_kv[soundname]['sound']['standard'])
                    if soundfile:
                        es.playsound(userid, soundfile, 1.0)
        for userid in useridlist_text:
            if not es.isbot(userid):
                style = str(quake_sounds_setting.get(userid))
                if style != 'off':
                    player = playerlib.getPlayer(userid)
                    soundtext = quake_sounds_language(soundname, langdata,
                                                      player.get("lang"))
                    usermsg.centermsg(userid, str(soundtext))
Пример #44
0
 def playSound(sound):
     if not str(sound): return
     for userid in playerlib.getUseridList('#human'):
         es.playsound(userid,sound,1.0)
Пример #45
0
def playsound(argv):
    es.playsound(*argv)
Пример #46
0
def playsound(argv):
  es.playsound(*argv)