Exemple #1
0
def voteSendcmd(userid, args):
    # If the map vote isn't running, then stop here
    ggRepeat = repeat.find('gg_map_vote')
    if not ggRepeat:
        return

    # Make sure the popup exists
    if not ggVote:
        return

    # Make sure the player is eligable to vote
    if userid not in voteUserids:
        return

    # Make sure the player has not recently used the cmd (prevent spam)
    if userid in voteCmdUserids:
        return

    # Add userid to list of cmd ussage
    voteCmdUserids.append(userid)

    # Remove from list in 3 seconds
    gamethread.delayed(3, voteCmdUserids.remove, userid)

    # Send the menu to the player
    ggVote.send(userid)
Exemple #2
0
def loopStart():
    myRepeat = repeat.find('gungameHandicapLoop')
    status = repeat.status('gungameHandicapLoop')

    # If the gg_handicap_update is removed
    if int(gg_handicap_update) == 0:

        # If the repeat exists, delete it
        if status > 0:
            myRepeat.delete()

        # Stop here
        return

    # Loop running ?
    if status == 0:
        # Create loop
        myRepeat = repeat.create('gungameHandicapLoop', handicapUpdate)
        myRepeat.start(int(gg_handicap_update), 0)
        return

    # If the gg_handicap_update was changed, re-create the loop
    if int(myRepeat['interval']) != float(gg_handicap_update):
        loopStop()
        gamethread.delayed(0.1, loopStart)
        return

    # Is the loop stopped?
    if status == 2:
        # Start loop
        myRepeat.start(int(gg_handicap_update), 0)
Exemple #3
0
def voteSendcmd(userid, args):
    # If the map vote isn't running, then stop here
    ggRepeat = repeat.find("gg_map_vote")
    if not ggRepeat:
        return

    # Make sure the popup exists
    if not ggVote:
        return

    # Make sure the player is eligable to vote
    if userid not in voteUserids:
        return

    # Make sure the player has not recently used the cmd (prevent spam)
    if userid in voteCmdUserids:
        return

    # Add userid to list of cmd ussage
    voteCmdUserids.append(userid)

    # Remove from list in 3 seconds
    gamethread.delayed(3, voteCmdUserids.remove, userid)

    # Send the menu to the player
    ggVote.send(userid)
Exemple #4
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)
def round_end(event_var):
    '''
    On the round end delete the keys from our dict of ghosters and also end the repeat to minimize server load
    '''
    global blinded
    if repeat.status("xaip") > 0:
        r = repeat.find("xaip")
        r.stop()
        r.delete()
    blinded = {}
def round_end(event_var):
    '''
    On the round end delete the keys from our dict of ghosters and also end the repeat to minimize server load
    '''
    global blinded
    if repeat.status("xaip") > 0:
        r = repeat.find("xaip")
        r.stop()
        r.delete()
    blinded = {}
Exemple #7
0
def voteCountDown():
    ggRepeat = repeat.find('gg_map_vote')
    if not ggRepeat:
        return

    timeleft = ggRepeat['remaining']

    # Stop the vote ?
    if timeleft == 0:
        voteEnd()
        return

    votes = len(reduce(lambda a, b: a + b, mapVoteOptions.values()))

    voteInfo = ""
    mapsAdded = 0
    # For the map with the most votes to the least
    sortItems = []
    for map in mapVoteOptions.items():
        sortItems.append((map[0], len(map[1])))

    for map in sorted(sortItems, key=itemgetter(1), reverse=True):
        # Add up to three maps
        voteInfo += langstring('MapVotes',
                               tokens={
                                   'map': map[0],
                                   'votes': map[1]
                               })
        mapsAdded += 1
        if mapsAdded >= 3:
            break

    # Should we play the countdown beep
    if timeleft <= 5:
        for userid in getUseridList('#human'):
            Player(userid).playsound('countDownBeep')

        # Show the singular hudhint and stop here
        if timeleft == 1:
            hudhint(
                '#human', 'Countdown_Singular', {
                    'time': timeleft,
                    'voteInfo': voteInfo,
                    'votes': votes,
                    'totalVotes': len(voteUserids)
                })
            return
    # Show the normal hudhint
    hudhint(
        '#human', 'Countdown_Plural', {
            'time': timeleft,
            'voteInfo': voteInfo,
            'votes': votes,
            'totalVotes': len(voteUserids)
        })
def remove_from_spec(uid):
    '''
    Removes the user from the spec dict and stops the repeat if the dict is empty
    '''
    global spec_blinded
    spec_blinded.pop(uid)
    if len(spec_blinded) < 1:
        # no one IP ghosting as spec so kill the repeat
        if repeat.status("xaip_spec") > 0:
            r = repeat.find("xaip_spec")
            r.stop()
            r.delete()
def remove_from_spec(uid):
    '''
    Removes the user from the spec dict and stops the repeat if the dict is empty
    '''
    global spec_blinded
    spec_blinded.pop(uid)
    if len(spec_blinded) < 1:
        # no one IP ghosting as spec so kill the repeat
        if repeat.status("xaip_spec") > 0:
            r = repeat.find("xaip_spec")
            r.stop()
            r.delete()
Exemple #10
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)
Exemple #11
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)
Exemple #12
0
def voteCountDown():
    ggRepeat = repeat.find("gg_map_vote")
    if not ggRepeat:
        return

    timeleft = ggRepeat["remaining"]

    # Stop the vote ?
    if timeleft == 0:
        voteEnd()
        return

    votes = len(reduce(lambda a, b: a + b, mapVoteOptions.values()))

    voteInfo = ""
    mapsAdded = 0
    # For the map with the most votes to the least
    sortItems = []
    for map in mapVoteOptions.items():
        sortItems.append((map[0], len(map[1])))

    for map in sorted(sortItems, key=itemgetter(1), reverse=True):
        # Add up to three maps
        voteInfo += langstring("MapVotes", tokens={"map": map[0], "votes": map[1]})
        mapsAdded += 1
        if mapsAdded >= 3:
            break

    # Should we play the countdown beep
    if timeleft <= 5:
        for userid in getUseridList("#human"):
            Player(userid).playsound("countDownBeep")

        # Show the singular hudhint and stop here
        if timeleft == 1:
            hudhint(
                "#human",
                "Countdown_Singular",
                {"time": timeleft, "voteInfo": voteInfo, "votes": votes, "totalVotes": len(voteUserids)},
            )
            return
    # Show the normal hudhint
    hudhint(
        "#human",
        "Countdown_Plural",
        {"time": timeleft, "voteInfo": voteInfo, "votes": votes, "totalVotes": len(voteUserids)},
    )
Exemple #13
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)
Exemple #14
0
def cleanVote():
    # Clear options
    mapVoteOptions.clear()

    # Clear voters
    votedUserids.clear()

    # Delete popup ?
    if popuplib.exists('gg_map_vote'):
        popuplib.delete('gg_map_vote')

    # Delete repeat ?
    if repeat.find('gg_map_vote'):
        repeat.delete('gg_map_vote')

    # Clear userid lists
    del voteSentUserids[:]
    del voteCmdUserids[:]
    del voteUserids[:]

    global ggVote
    ggVote = None
Exemple #15
0
def cleanVote():
    # Clear options
    mapVoteOptions.clear()

    # Clear voters
    votedUserids.clear()

    # Delete popup ?
    if popuplib.exists("gg_map_vote"):
        popuplib.delete("gg_map_vote")

    # Delete repeat ?
    if repeat.find("gg_map_vote"):
        repeat.delete("gg_map_vote")

    # Clear userid lists
    del voteSentUserids[:]
    del voteCmdUserids[:]
    del voteUserids[:]

    global ggVote
    ggVote = None
def player_disconnect(event_var):
    userid = event_var['userid']
    if repeat.status('hpk_track_' + userid) != 0:
        repeat.find('hpk_track_' + userid).delete()
Exemple #17
0
def round_start(ev):
    global checkTeabag
    if repeat.find('checkForTeabag') > 0:
        checkTeabag.stop
def unload(): 
    for userid in map(str, es.getUseridList()):
        if repeat.status('hpk_track_' + userid) != 0:
            repeat.find('hpk_track_' + userid).delete()
    xahighpingkick.unregister() 
Exemple #19
0
def unload():
    for userid in map(str, es.getUseridList()):
        if repeat.status('hpk_track_' + userid) != 0:
            repeat.find('hpk_track_' + userid).delete()
    xahighpingkick.unregister()
Exemple #20
0
def voteEnd():
    # Stop repeat ?
    ggRepeat = repeat.find("gg_map_vote")
    if ggRepeat:
        ggRepeat.stop()

    # Unsend all menus
    ggVote.unsend(voteUserids)

    winner = []
    win_votes = None
    total_votes = len(reduce(lambda a, b: a + b, mapVoteOptions.values()))

    if not total_votes:
        msg("#human", "NotEnoughVotes", {}, True)

        # Choose a random map
        winner = random.choice(mapVoteOptions.keys())

        # Set the server up for map change
        set_nextmap(winner)

        # Win message for the map that we randomely chose
        msg("#human", "WinningMap", {"map": winner.lower(), "totalVotes": 0, "votes": 0}, True)
        cleanVote()
        return

    # Find winner
    for option in mapVoteOptions:
        votes = len(mapVoteOptions[option])
        # No votes ?
        if not votes:
            continue

        # First option with any votes ?
        if not winner:
            winner.append(option)
            continue

        win_votes = len(mapVoteOptions[winner[0]])

        # Loser ?
        if votes < win_votes:
            continue

        # Winner ?
        if votes > win_votes:
            del winner[:]
            winner.append(option)
            continue

        # Tie
        winner.append(option)

    # Make sure we have a winning vote count
    if not win_votes:
        win_votes = len(mapVoteOptions[winner[0]])

    # Random winner
    winner = random.choice(winner)

    # Win message
    msg("#human", "WinningMap", {"map": winner.lower(), "totalVotes": total_votes, "votes": win_votes}, True)

    # Set the server up for map change
    set_nextmap(winner)

    # Play sound
    for userid in getUseridList("#human"):
        Player(userid).playsound("endofvote")

    # If this was a RTV, end the map
    if voteRocked:
        userid = es.getuserid()
        es.ServerVar("mp_chattime").set(5)
        es.server.queuecmd("es_xgive %s game_end" % userid)
        es.server.queuecmd("es_xfire %s game_end EndGame" % userid)

    cleanVote()
Exemple #21
0
def voteEnd():
    # Stop repeat ?
    ggRepeat = repeat.find('gg_map_vote')
    if ggRepeat:
        ggRepeat.stop()

    # Unsend all menus
    ggVote.unsend(voteUserids)

    winner = []
    win_votes = None
    total_votes = len(reduce(lambda a, b: a + b, mapVoteOptions.values()))

    if not total_votes:
        msg('#human', 'NotEnoughVotes', {}, True)

        # Choose a random map
        winner = random.choice(mapVoteOptions.keys())

        # Set the server up for map change
        set_nextmap(winner)

        # Win message for the map that we randomely chose
        msg('#human', 'WinningMap', {
            'map': winner.lower(),
            'totalVotes': 0,
            'votes': 0
        }, True)
        cleanVote()
        return

    # Find winner
    for option in mapVoteOptions:
        votes = len(mapVoteOptions[option])
        # No votes ?
        if not votes:
            continue

        # First option with any votes ?
        if not winner:
            winner.append(option)
            continue

        win_votes = len(mapVoteOptions[winner[0]])

        # Loser ?
        if votes < win_votes:
            continue

        # Winner ?
        if votes > win_votes:
            del winner[:]
            winner.append(option)
            continue

        # Tie
        winner.append(option)

    # Make sure we have a winning vote count
    if not win_votes:
        win_votes = len(mapVoteOptions[winner[0]])

    # Random winner
    winner = random.choice(winner)

    # Win message
    msg('#human', 'WinningMap', {
        'map': winner.lower(),
        'totalVotes': total_votes,
        'votes': win_votes
    }, True)

    # Set the server up for map change
    set_nextmap(winner)

    # Play sound
    for userid in getUseridList('#human'):
        Player(userid).playsound('endofvote')

    # If this was a RTV, end the map
    if voteRocked:
        userid = es.getuserid()
        es.ServerVar("mp_chattime").set(5)
        es.server.queuecmd("es_xgive %s game_end" % userid)
        es.server.queuecmd("es_xfire %s game_end EndGame" % userid)

    cleanVote()
Exemple #22
0
def player_disconnect(event_var):
    userid = event_var['userid']
    if repeat.status('hpk_track_' + userid) != 0:
        repeat.find('hpk_track_' + userid).delete()
Exemple #23
0
def unload():
    global checkTeabag
    es.msg("#multi", "#lightgreen[#greenTea-Bag#lightgreen]#default has been unloaded")
    if repeat.find('checkForTeabag') > 0:
        checkTeabag.stop