Пример #1
0
def player_say(event_var):
    # probably the best way
    if event_var['text'] == "!menu":
        dlg = msglib.VguiDialog(title="menu1",
                                msg="themessage",
                                mode=msglib.VguiMode.MENU)
        dlg["msg"] = "This is a long message.\nYes it is! Never forget me!\n\n\nNo!\n"
        dlg.addOption(msg="Hello", command="echo Hello")
        dlg.addOption(msg="Hello1", command="echo Hello1")
        dlg.addOption(msg="Hello2", command="echo Hello2")
        dlg.addOption(msg="Hello3", command="echo Hello3")
        dlg.addOption(msg="Hello4", command="echo Hello4")
        dlg = msglib.VguiDialog(title="My Title",
                                msg="My Message",
                                mode=msglib.VguiMode.TEXT)
        dlg.send(event_var['userid'])

    # keyvalue way if you want
    if event_var['text'] == "!go":
        kv = keyvalues.KeyValues(name="message")
        kv["msg"] = "THIS IS THE MESSAGE"
        kv["title"] = "TITLE!"
        kv["level"] = 5
        kv["color"] = "255 255 0 255"
        kv["time"] = 20
        for x in kv:
            print x.getName(), kv[x.getName()]
        msglib.sendVguiDialog(event_var['userid'], msglib.VguiType.TEXT, kv)
Пример #2
0
def printAdverts():
   duration = int(SA_DURATION)
   if adverts:
      advert = adverts.next()
      advert_split = advert.split('|', 1)
      ad = advert_split[1]
      color = advert_split[0]
      msg = msglib.VguiDialog(title=ad, level=5, color=COLORS[color]+" 255", time=duration, mode=msglib.VguiMode.MSG)
      for userid in playerlib.getUseridList('#human'):
         msg.send(userid)
   gamethread.delayedname(duration, 'adverts_delay', printAdverts)
Пример #3
0
 def sendAllPlayersMessages(message,tokens,message_types,reminder=False):
     for player in playerlib.getPlayerList('#human'):
         pmessage = lmv['lang'](message,tokens,player.lang)
         if 'chat' in message_types:
             es.tell(player.userid,'#multi',pmessage)
         for color in ('#default','#green','#lightgreen','[LooneyMapVote]'):
             pmessage = pmessage.replace(color,'')
         ptime = 1 if reminder else lmv_announce_time
         if 'hudhint' in message_types:
             usermsg.hudhint(player.userid,pmessage)
         if 'center' in message_types:
             for second in range(ptime):
                 gamethread.delayed(second,usermsg.centermsg,(player.userid,pmessage))
         if 'toptext' in message_types:
             msglib.VguiDialog(pmessage,pmessage,5,'%s %s %s 255'%(lmv_top_red,lmv_top_green,lmv_top_blue),ptime).send(player.userid)
Пример #4
0
def send_prompt(int_userid, str_ip, int_kick, float_delay):
    """
    Sends the redirect prompt
    Creates a delay for kicking the client
    """
    global list_delays

    msglib.VguiDialog(title=str_ip, time=float_delay, mode=msglib.VguiMode.ASKCONNECT).send(int_userid)

    if int_kick:
        if int_userid in list_delays:
            gamethread.cancelDelayed('xaredirect_%s' % int_userid)
        else:
            list_delays.append(int_userid)
        gamethread.delayedname(float_delay, 'xaredirect_%s' % int_userid, kick_player, (int_userid, str_ip))
Пример #5
0
def send_prompt(int_userid, str_ip, int_kick, float_delay):
    """
    Sends the redirect prompt
    Creates a delay for kicking the client
    """
    global list_delays

    msglib.VguiDialog(title=str_ip,
                      time=float_delay,
                      mode=msglib.VguiMode.ASKCONNECT).send(int_userid)
    xaredirect.logging.log("is being redirected to %s" % str_ip, int_userid)
    if int_kick:
        xaredirect.logging.log(
            "will be kicked in %s seconds if they don't respond" % float_delay,
            int_userid)
        if int_userid in list_delays:
            gamethread.cancelDelayed('xaredirect_%s' % int_userid)
        else:
            list_delays.append(int_userid)
        gamethread.delayedname(float_delay, 'xaredirect_%s' % int_userid,
                               kick_player, (int_userid, str_ip))
Пример #6
0
def display_advert():
    global next_advert

    # repeat the timer
    gamethread.delayedname(float(time_between_advert), 'adverts',
                           display_advert)

    if adverts and xaadvertlist and es.ServerVar(
            'eventscripts_currentmap') != '':
        # start at the beginning
        if next_advert >= len(xaadvertlist):
            next_advert = 0

        # get advert
        advert_text = xaadvertlist[next_advert]

        tags = re.compile(r'(?P<tag>\{\w+\})')
        for tag in tags.findall(advert_text):
            advert_text = advert_text.replace(tag, tag.upper())

        # set color
        color = '%s %s %s 255' % (str(advert_col_red), str(advert_col_green),
                                  str(advert_col_blue))
        for k in colors:
            if k in advert_text:
                color = colors[k]
                advert_text = advert_text.replace(k, '')

        # set tags
        if str(es.ServerVar('eventscripts_nextmapoverride')) != '':
            advert_text = advert_text.replace(
                '{NEXTMAP}', str(es.ServerVar('eventscripts_nextmapoverride')))
        else:
            if len(mapcycle) == 1:
                advert_text = advert_text.replace(
                    '{NEXTMAP}', str(es.ServerVar('eventscripts_currentmap')))
            elif currentmap + 1 > len(mapcycle):
                # fix for when we are at the end of the maplist
                advert_text = advert_text.replace('{NEXTMAP}', mapcycle[0])
            else:
                advert_text = advert_text.replace('{NEXTMAP}',
                                                  mapcycle[currentmap + 1])

        advert_text = advert_text.replace(
            '{CURRENTMAP}', str(es.ServerVar('eventscripts_currentmap')))
        advert_text = advert_text.replace('{TICKRATE}', 'UNKNOWN')

        if int(es.ServerVar('mp_friendlyfire')):
            advert_text = advert_text.replace('{FF}', 'on')
        else:
            advert_text = advert_text.replace('{FF}', 'off')

        advert_text = advert_text.replace(
            '{THETIME}', str(time.strftime("%H:%M:%S", time.localtime())))
        advert_text = advert_text.replace('{SERVERHOST}', 'UNKNOWN')

        # send top text
        if int(adverts_top_left):
            if int(advert_dead_only) == 1:
                xaadvert_playerlist = playerlib.getPlayerList('#human,#dead')
            else:
                xaadvert_playerlist = playerlib.getPlayerList('#human')

            toptext = msglib.VguiDialog(title=advert_text,
                                        level=5,
                                        time=25,
                                        mode=msglib.VguiMode.MSG)
            toptext['color'] = color

            for k in xaadvert_playerlist:
                toptext.send(k.userid)

        # send chat text
        if int(adverts_chat_area):
            if int(advert_dead_only) == 1:
                xaadvert_playerlist = playerlib.getPlayerList('#human,#dead')
                for k in xaadvert_playerlist:
                    es.tell(k.userid, '#lightgreen', advert_text)
            else:
                es.msg('#lightgreen', advert_text)

        # send bottom text
        if int(adverts_bottom_area):
            if int(advert_dead_only) == 1:
                xaadvert_playerlist = playerlib.getPlayerList('#human,#dead')
            else:
                xaadvert_playerlist = playerlib.getPlayerList('#human')

            for k in xaadvert_playerlist:
                usermsg.hudhint(k.userid, advert_text)

        next_advert = next_advert + 1
Пример #7
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)