Exemple #1
0
def healingwarden():
    userid = str(es.ServerVar('wcs_userid'))
    count = int(wcsgroup.getUser(userid, 'ability_count'))

    if count:
        param = str(wcsgroup.getUser(userid, 'ability_parameter'))

        if param:
            param = param.split('_')
            team = int(es.getplayerteam(userid))

            if team == 2:
                teamtarget = '2'
                teamtargetn = '#t'
                color = '255 0 10 150'

            elif team == 3:
                teamtarget = '3'
                teamtargetn = '#ct'
                color = '10 0 255 150'

            x, y, z = es.getplayerlocation(userid)
            es.server.queuecmd('wcs_healingwarden ' + userid + ' ' + param[0] +
                               ' ' + param[1] + ' ' + param[2] + ' ' +
                               teamtarget + ' ' + teamtargetn + ' ' + str(x) +
                               ' ' + str(y) + ' ' + str(z) + ' ' +
                               str(es.ServerVar('wcs_roundcounter')))

            tell(userid, 'a_wardencreated')

        if count and not count == -1:
            wcsgroup.setUser(userid, 'ability_count', count - 1)

    else:
        tell(userid, 'a_failed')
Exemple #2
0
def round_end(ev):
    for user in repeat_dict:
        if valid_repeat(repeat_dict[user]):
            repeat_dict[user].stop()
            repeat_dict[user] = 0
    for player in PlayerIter('all'):
        for weapon in weapon_list:
            wcsgroup.setUser(player.userid, 'resist_' + weapon, 0.0)
Exemple #3
0
def player_spawn(ev):
    wcsgroup.setUser(ev['userid'], 'absorb', 0.0)
    wcsgroup.setUser(ev['userid'], 'noflash', 0)
    if ev['userid'] not in repeat_dict:
        repeat_dict[ev['userid']] = 0
    if repeat_dict[ev['userid']] != 0:
        repeat_dict[ev['userid']].stop()
        repeat_dict[ev['userid']] = 0
Exemple #4
0
def set_cooldown(command):
    userid = int(command[1])
    amount = int(command[2])
    timed = int(float(time.time()))
    if exists(userid):
        cooldown = wcs.wcs.get_cooldown(userid)
        if cooldown == None:
            cooldown = 0
        wcsgroup.setUser(userid, 'player_ultimate_cooldown',
                         timed + amount - cooldown)
Exemple #5
0
def player_death(ev):
    atk_play = Player.from_userid(ev['attacker'])
    vic_play = Player.from_userid(ev['userid'])
    if vic_play.userid == atk_play.userid or not atk_play.userid or not teambounty and vic_play.team == atk_play.team:
        return
    kills = int(wcsgroup.getUser(atk_play.userid, "wcs_bounty_kills")) + 1
    wcsgroup.setUser(atk_play.userid, "wcs_bounty_kills", kills)
    bounty = int(wcsgroup.getUser(atk_play.userid, "wcs_bounty_bounty"))
    if kills == int(streak):
        wcsgroup.setUser(atk_play.userid, "wcs_bounty_bounty", int(xpstart))
        if int(telltype):
            wcs.wcs.tell(
                atk_play.userid,
                "\x04[WCS]\x05 You started a bounty of \x04%s\x05." % xpstart)
        else:
            for player in PlayerIter():
                wcs.wcs.tell(
                    player.userid,
                    "\x04[WCS]\x05 Player \x04%s \x05has started a bounty of \x04%s\x05."
                    % (atk_play.name, xpstart))
    elif kills > int(streak):
        bounty += int(xpincrease)
        wcsgroup.setUser(atk_play.userid, "wcs_bounty_bounty", bounty)
        if int(telltype):
            wcs.wcs.tell(
                atk_play.userid,
                "\x04[WCS]\x05 Your bounty increased to \x04%s\x05." % bounty)
        else:
            for player in PlayerIter():
                wcs.wcs.tell(
                    player.userid,
                    "\x04[WCS]\x05Player \x04%s \x05bounty has increased to \x04%s\x05."
                    % (atk_play.name, bounty))
    bounty = int(wcsgroup.getUser(ev["userid"], "wcs_bounty_bounty"))
    kills = int(wcsgroup.getUser(ev["userid"], "wcs_bounty_kills"))
    if bounty and kills:
        wcs.wcs.getPlayer(atk_play.userid).giveXp(bounty, "bounty experience")
        if int(telltype):
            wcs.wcs.tell(
                atk_play.userid,
                "\x04[WCS]\x05 You stole \x05%s bounty of \x04%s\x05." %
                (vic_play.name, bounty))
            wcs.wcs.tell(
                vic_play.userid,
                "\x04[WCS]\x05 \x04%s \x05stole your bounty of \x04%s\x05." %
                (atk_play.name, bounty))
        else:
            for player in PlayerIter():
                wcs.wcs.tell(
                    player.userid,
                    "\x04[WCS]\x05 Player \x04%s\x05 has stolen \x04%s\x05 bounty of \x04%s\x05."
                    % (atk_play.name, vic_play.name, bounty))
    wcsgroup.setUser(vic_play.userid, "wcs_bounty_kills", 0)
    wcsgroup.setUser(vic_play.userid, "wcs_bounty_bounty", 0)
Exemple #6
0
def _regeneration(command):
    #<userid> <amount> <time> <maxhp> <maxheal> <radius>
    userid = int(command[1])
    amount = int(command[2])
    time = float(command[3])
    maxhp = int(command[4])
    maxheal = int(command[5])
    radius = float(command[6])
    if exists(userid):
        wcsgroup.setUser(userid, 'regeneration_active', 1)
        player = Player.from_userid(userid)
        repeat_dict[player.userid] = Repeat(
            _regeneration_repeat, (player, amount, maxhp, maxheal, radius))
        repeat_dict[player.userid].start(time)
Exemple #7
0
def set_resist(command):
    userid = int(command[1])
    amount = float(command[2])
    weapon = str(command[3])
    if exists(userid):
        wcsgroup.setUser(userid, 'resist_' + weapon, amount)
Exemple #8
0
def absorb(command):
    userid = int(command[1])
    amount = float(command[2])
    if exists(userid):
        wcsgroup.setUser(userid, 'absorb', amount)
Exemple #9
0
def noflash(command):
    userid = int(command[1])
    on_off = int(command[2])
    if exists(userid):
        wcsgroup.setUser(userid, 'noflash', on_off)
Exemple #10
0
def wcs_evasion(command):
    userid = int(command[1])
    onoff = int(command[2])
    chance = int(command[3])
    wcsgroup.setUser(userid, 'evasion', onoff)
    wcsgroup.setUser(userid, 'evasion_chance', chance)
Exemple #11
0
def removefx(todo, player, amount):
    if todo == 'disguise':
        if int(amount) == 3:
            player.model = Model(
                "models/player/custom_player/legacy/tm_leet_variantB.mdl")
        if int(amount) == 2:
            player.model = Model(
                "models/player/custom_player/legacy/ctm_idf_variantC.mdl")
    if todo == "god":
        if int(amount) == 1:
            player.godmode = 0
        else:
            player.godmode = 1
    if todo == "invis":
        player.color = Color(player.color[0], player.color[1], player.color[2],
                             player.color[3] + int(amount))
    if todo == "invisp":
        player.color = Color(player.color[0], player.color[1], player.color[2],
                             player.color[3] + int(amount))
    if todo == "freeze":
        if amount == "1":
            player.move_type = MoveType.WALK
        else:
            player.move_type = MoveType.NONE
    if todo == 'speed':
        player.speed += float(amount)
    if todo == 'jetpack':
        player.set_jetpack(1 - int(amount))
        wcsgroup.setUser(player.userid, 'jetpack', int(player.jetpack))
    if todo == 'gravity':
        player.gravity -= float(amount)
        wcsgroup.setUser(player.userid, 'gravity', player.gravity)
    if todo == 'health':
        player.health -= int(amount)
    if todo == 'cash':
        player.cash -= int(amount)
    if todo == 'flicker':
        if amount == 0:
            player.set_key_value_int("renderfx", 13)
        if amount == 1:
            player.set_key_value_int("renderfx", 0)

    if todo == "size":
        if operator == "=":
            old_size = player.get_property_float("m_flModelScale")
            player.set_property_float("m_flModelScale", float(amount))
            if time:
                Delay(time, player.set_property_float,
                      ("m_flModelScale", old_size))
        if operator == "+":
            player.set_property_float(
                "m_flModelScale",
                player.get_property_float("m_flModelScale") + float(amount))
            if time:
                Delay(time, player.set_property_float,
                      ("m_flModelScale",
                       player.get_property_float("m_flModelScale") -
                       float(amount)))
        if operator == "-":
            player.set_property_float(
                "m_flModelScale",
                player.get_property_float("m_flModelScale") - float(amount))
            if time:
                Delay(time, player.set_property_float,
                      ("m_flModelScale",
                       player.get_property_float("m_flModelScale") +
                       float(amount)))
Exemple #12
0
def _setfx_command(command):
    todo = str(command[1])
    userid = int(command[2])
    operator = str(command[3])
    amount = command[4]
    if len(command) > 5:
        time = float(command[5])
    else:
        time = 0
    player = Player(index_from_userid(userid))

    if todo == "blind":
        if operator == "=":
            if time == 0.0:
                time == 10000.0
            color = Color(255, 255, 255, int(amount))
            Fade(int(time), int(time), color,
                 FadeFlags.PURGE).send(player.index)
    if todo == "flicker":
        if time == 0.0:
            time == 10000.0
        if int(amount) == 1:
            player.set_key_value_int("renderfx", 13)
        if int(amount) == 0:
            player.set_key_value_int("renderfx", 0)
        if time:
            Delay(time, removefx, ("flicker", player, int(amount)))

    if todo == "1stclip":
        clip = player.get_weapon(is_filters="primary").clip
        if operator == "=":
            player.get_weapon(is_filters="primary").clip = int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (clip, ))
        if operator == "+":
            player.get_weapon(is_filters="primary").clip += int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (player.get_weapon(is_filters="primary").clip -
                       int(amount), ))
        if operator == "-":
            player.get_weapon(is_filters="primary").clip -= int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (player.get_weapon(is_filters="primary").clip +
                       int(amount), ))

    if todo == "2ndclip":
        clip = player.get_weapon(is_filters="secondary").clip
        if operator == "=":
            player.get_weapon(is_filters="secondary").clip = int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="secondary").set_clip,
                      (clip, ))
        if operator == "+":
            player.get_weapon(is_filters="secondary").clip += int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (player.get_weapon(is_filters="secondary").clip -
                       int(amount), ))
        if operator == "-":
            player.get_weapon(is_filters="secondary").clip -= int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (player.get_weapon(is_filters="secondary").clip +
                       int(amount), ))

    if todo == "1stammo":
        ammo = player.get_weapon(is_filters="primary").ammo
        if operator == "=":
            player.get_weapon(is_filters="primary").ammo = int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_ammo,
                      (ammo, ))
        if operator == "+":
            player.get_weapon(is_filters="primary").ammo += int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (player.get_weapon(is_filters="primary").ammo -
                       int(amount), ))
        if operator == "-":
            player.get_weapon(is_filters="primary").ammo -= int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="primary").set_clip,
                      (player.get_weapon(is_filters="primary").ammo +
                       int(amount), ))

    if todo == "2ndammo":
        ammo = player.get_weapon(is_filters="secondary").ammo
        if operator == "=":
            player.get_weapon(is_filters="secondary").ammo = int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="secondary").set_ammo,
                      (ammo, ))
        if operator == "+":
            player.get_weapon(is_filters="secondary").ammo += int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="secondary").set_ammo,
                      (player.get_weapon(is_filters="primary").ammo -
                       int(amount), ))
        if operator == "-":
            player.get_weapon(is_filters="secondary").ammo -= int(amount)
            if time:
                Delay(time,
                      player.get_weapon(is_filters="secondary").set_ammo,
                      (player.get_weapon(is_filters="primary").ammo +
                       int(amount), ))

    if todo == "invisp":
        old_color = player.color
        if operator == "=":
            old_invisp = float(player.color.a) / 2.55
            amount = float(amount) * 2.55
            amount = 255 - amount
            player.color = Color(old_color[0], old_color[1], old_color[2],
                                 int(amount))
            if time:
                old_invisp = float(old_invisp) * 2.55 - float(amount)
                Delay(time, removefx, ('invisp', player, old_invisp))
        if operator == "-":
            old_invisp = float(player.color.a) / 2.55
            amount = float(amount) * 2.55
            if (player.color.a - int(amount)) <= 0:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     0)
            else:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     old_color[3] - int(amount))
            if time:
                Delay(time, removefx, ('invisp', player, old_invisp))
        if operator == "+":
            old_invisp = float(player.color.a) / 2.55
            amount = float(amount) * 2.55
            if (player.color.a + int(amount)) >= 255:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     255)
            else:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     old_color[3] + int(amount))
            if time:
                Delay(time, removefx, ('invisp', player, -old_invisp))

    if todo == "invis":
        old_color = player.color
        amount = int(amount)
        if operator == "=":
            old_invisp = player.color.a
            player.color = Color(old_color[0], old_color[1], old_color[2],
                                 int(amount))
            if time:
                old_invisp = old_invisp - amount
                Delay(time, removefx, ('invis', player, old_invisp))
        if operator == "-":
            old_invisp = player.color.a
            if (player.color.a - amount) <= 0:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     0)
            else:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     old_color[3] - int(amount))
            if time:
                Delay(time, removefx, ('invis', player, old_invisp))
        if operator == "+":
            old_invisp = player.color.a
            amount = amount
            if (player.color.a + amount) >= 255:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     255)
            else:
                player.color = Color(old_color[0], old_color[1], old_color[2],
                                     old_color[3] + int(amount))
            if time:
                Delay(time, removefx, ('invis', player, -amount))

    if todo == "longjump":
        longjump = wcsgroup.getUser(userid, 'longjump')
        if longjump != None:
            longjump = float(longjump)
        else:
            longjump = 1.0
        if operator == "=":
            wcsgroup.setUser(userid, 'longjump', amount)
            if time > 0:
                Delay(time, wcsgroup.setUser, (userid, 'longjump', 0))
        if operator == "+":
            wcsgroup.setUser(userid, 'longjump', longjump + float(amount))
            if time > 0:
                Delay(time, wcsgroup.setUser,
                      (userid, 'longjump',
                       float(wcsgroup.getUser(userid, 'longjump')) -
                       float(amount)))
        if operator == "-":
            wcsgroup.setUser(userid, 'longjump', longjump - float(amount))
            if time > 0:
                Delay(time, wcsgroup.setUser,
                      (userid, 'longjump',
                       float(wcsgroup.getUser(userid, 'longjump')) +
                       float(amount)))

    if todo == "speed":
        current_speed = player.speed
        if time:
            time = float(time)
        if operator == "=":
            oldspeed = player.speed
            player.speed = float(amount)
            dif = oldspeed - player.speed
            if time:
                Delay(time, removefx, ('speed', player, float(dif)))
        if operator == "+":
            player.speed += float(amount)
            if time:
                Delay(time, removefx, ('speed', player, -float(amount)))
        if operator == "-":
            player.speed -= float(amount)
            if time:
                Delay(time, removefx, ('speed', player, float(amount)))

    if todo == 'jetpack':
        if operator == "=":
            player.set_jetpack(int(amount))
            if time:
                Delay(time, removefx, ('jetpack', player, amount))
        wcsgroup.setUser(player.userid, 'jetpack', int(player.jetpack))

    if todo == 'gravity':
        old_grav = player.gravity
        if operator == "=":
            player.gravity = float(amount)
            if time:
                return_value = float(amount) - old_grav
                Delay(time, removefx, ('gravity', player, return_value))
        if operator == "-":
            player.gravity -= float(amount)
            if time:
                Delay(time, removefx, ('gravity', player, -amount))
        if operator == "+":
            player.gravity += float(amount)
            if time:
                Delay(time, removefx, ('gravity', player, amount))
        wcsgroup.setUser(player.userid, 'gravity', player.gravity)

    if todo == 'health':
        old_health = player.health
        if operator == "=":
            player.health = int(round(float(amount)))
            if time:
                Delay(time, removefx, ('health', player, old_health))
        if operator == "-":
            player.health -= int(round(float(amount)))
            if time:
                Delay(time, removefx, ('health', player, -amount))
        if operator == "+":
            player.health += int(round(float(amount)))
            if time:
                Delay(time, removefx, ('health', player, amount))
    if todo == 'freeze':
        if operator == "=":
            if amount == "0":
                player.move_type = MoveType.WALK
            if amount == "1":
                player.move_type = MoveType.NONE
            if time:
                Delay(time, removefx, ('freeze', player, amount))

    if todo in "cash;money":
        if operator == "=":
            old_amount = player.cash
            old_amount = old_amount - int(amount)
            player.cash = int(amount)
            if time:
                Delay(time, removefx, ('cash', player, old_amount))
        if operator == "-":
            old_amount = player.cash
            player.cash -= int(amount)
            if time:
                Delay(time, removefx, ('cash', player, -amount))
        if operator == "+":
            old_amount = player.cash
            player.cash += int(amount)
            if time:
                Delay(time, removefx, ('cash', player, amount))
    if todo == "burn":
        if operator == "=":
            if int(amount) == 1:
                if time:
                    if time == 0:
                        time = 999
                else:
                    time = 999
                player.ignite_lifetime(float(time))
            else:
                player.ignite_lifetime(0)
    if todo == "god":
        if operator == "=":
            player.godmode = int(amount)
            if time:
                Delay(time, removefx, ('god', player, int(amount)))

    if todo == "disguise":
        if operator == "=":
            if int(amount) == 2:
                player.model = Model(
                    "models/player/custom_player/legacy/tm_leet_variantB.mdl")
            if int(amount) == 3:
                player.model = Model(
                    "models/player/custom_player/legacy/ctm_idf_variantC.mdl")
            if time:
                Delay(time, removefx, ('disguise', player, amount))
Exemple #13
0
def headshot_immunity(command):
    userid = int(command[1])
    amount = float(command[2])
    if exists(userid):
        wcsgroup.setUser(userid, 'headshot_immunity', amount)
Exemple #14
0
def cancel(userid, what):
    wcsgroup.setUser(userid, what + '_cooldown',
                     wcsgroup.getUser(userid, what + '_pre_cooldown'))
Exemple #15
0
def player_activate(ev):
    wcsgroup.setUser(ev["userid"], "wcs_bounty_kills", 0)
    wcsgroup.setUser(ev["userid"], "wcs_bounty_bounty", 0)