コード例 #1
0
ファイル: Icestab.py プロジェクト: The-Sky/infinity-rpg
def player_hurt(ev):
    attacker = ev['attacker']
    player = playerlist[ev['attacker']]
    # If damage is not NULL
    if ev['damage'].isdigit():
        damage = int(ev['damage'])
    elif ev['dmg_health'].isdigit():
        damage = int(ev['dmg_health'])
    player = playerlist[ev['userid']]
    userid = player.userid  
    # If Attacker and Victim are not frozen: 
    if ev['weapon'] == 'knife':
        if attacker and int(attacker) in frozen:
            quit()
        if damage >= 35:
            player = playerlist[ev['attacker']]
            level = player.GetSkillLevel(skillname)
            if level:
                if userid not in frozen:
                    frozen.append(userid)
                # Freeze the player
                gamethread.cancelDelayed('rpg_%s_%s' % (skillname, userid))
                es.emitsound('player', userid, 'physics/glass/glass_impact_bullet%s.wav' % random.randint(1,4), '1.0', '0.5')
                player = playerlib.getPlayer(userid)
                player.freeze(True)
                player.setColor(0, 0, 255)
                # Delay
                delayname = 'rpg_%s_%s' %(skillname, userid)
                gamethread.cancelDelayed(delayname)
                gamethread.delayedname(0.42 * level, delayname, rpg_unfreeze, (player.userid))   
    if ev['weapon'] != 'knife':
        if userid in frozen:
            player = playerlib.getPlayer(userid)
            player.health += int(damage / 100 * 98)
コード例 #2
0
ファイル: est_effect.py プロジェクト: hojjke/wowmod
def regEffect2(args):
    if len(args) != 12:
        log.log(
            "est_effect 2 <player Filter> <delay> <model> <start userid> <end userid> <life> <width> <end width> <Red> <Green> <Blue> <Alpha>"
        )
        log.log("est_effect 2: get: " + " ".join(args))
        return
    users = str(args[0])
    if users == "#a":
        users = "#all"
    delay = float(args[1])
    model = str(args[2])
    sid = int(args[3])
    eid = int(args[4])
    life = float(args[5])
    width = int(args[6])
    ewidth = int(args[7])
    red = int(args[8])
    green = int(args[9])
    blue = int(args[10])
    alpha = int(args[11])
    if sid != 0 and es.exists("userid", sid):
        sid = playerlib.getPlayer(sid).index
    else:
        log.log("est_effect 2: unkown id: %s !" % sid)
        return
    if eid != 0 and es.exists("userid", eid):
        eid = playerlib.getPlayer(eid).index
    else:
        log.log("est_effect 2: unkown id: %s !" % eid)
        return
    spe_effects.beamEntPoint(
        users, delay, sid, 0, eid, 0, model, 0, 0, 255, life, width, ewidth, 0, 0, red, green, blue, alpha, 0
    )
コード例 #3
0
def speed_set(userid):
    userid = str(userid)
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        if gusers[userid]['crawl'] != 0:
            player.set("speed", 1.0)
            gamethread.delayed(0.2,speed_set,userid)
コード例 #4
0
ファイル: adminlisten.py プロジェクト: ninjalf2/adminlisten
def sayFilter(userid, text, teamonly):
    player = getPlayer(userid)
    if (teamonly or player.isdead):
        for id in admins:
            admin = getPlayer(es.getuserid(id))
            if(int(userid) == int(admin.userid)):
                continue

            if((teamonly and (admin.team != player.team)) or (player.isdead and not admin.isdead)):
                text = text.strip('"')
                if (player.isdead and not admin.isdead) or (player.isdead and (teamonly and admin.team != player.team)):
                    dead = "*SPEC* " if player.team == 1 or player.team == 0 else "*DEAD* "
                else:
                    dead = ""
                if teamonly and admin.team != player.team:
                    if player.team == 0 or player.team == 1:
                        team = "(Spectator) "
                    elif player.team == 2:
                        team = "(Terrorist) "
                    else:
                        team = "(Counter-Terrorist) "
                else:
                    team = ""
                newtext = "\x01%s\x03%s\x01 %s:  %s"%(dead, player.name, team, text)
                saytext2(admin.userid, player.index, newtext)
    return (userid, text, teamonly)
コード例 #5
0
def power():
    userid = str(es.getcmduserid())
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        if int(time.time()) >= int(gusers[userid]['nc_cooldown']):
            es.server.queuecmd('es_xsetplayerprop %s "CBaseEntity.movetype" 8' % userid)
            if not 'speed' in gusers[userid]: 
                gusers[userid]['speed'] = 1.0
            player.set("speed", 1.0)
            gusers[userid]['nc_cooldown'] = int(time.time()) + 10
            es.centertell(userid,'Noclip activated, do not get Stuck!')
            es.tell(userid,'#multi','#green[SH]#lightgreen Nightcrawler is partially blinded. You now are aswell.')
            gusers[userid]['crawl'] = 1
            fade(userid, 1, 0.5, 2.8, 0, 0, 0, 254)
            speed_set(userid)
            #es.server.cmd('ezrestrict %s #all' % userid)
            #es.server.cmd('ezrestrict_removeidle #all')
            #es.server.cmd('ezunrestrict %s knife' % userid)
            gamethread.delayed(0.1, es.server.queuecmd, 'es_xgive %s weapon_knife' % userid)
            es.delayed(1,'es_centertell %s 6 seconds left...' % userid)
            es.delayed(2,'es_centertell %s 5 seconds left...' % userid)
            es.delayed(3,'es_centertell %s 4 seconds left...' % userid)
            es.delayed(4,'es_centertell %s 3 seconds left...' % userid)
            es.delayed(5,'es_centertell %s 2 seconds left...' % userid)
            es.delayed(6,'es_centertell %s 1 seconds left...' % userid)
            gamethread.delayed(7,undo,(player))
        else:
            es.tell(userid,'#multi','#green[SH]#lightgreen Cannot activate Nightcrawler #green',int(gusers[userid]['nc_cooldown'])-int(time.time()),'#lightgreenseconds left')
コード例 #6
0
def selected():
    userid = es.getcmduserid()
    if not superhero.hasHero(userid,'HobGoblin'):
        return
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        check_nade(userid)
コード例 #7
0
def KI_regen(userid):
    global gusers
    userid = str(userid)
    if not superhero.hasHero(userid, 'Goku'):
        return
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        gusers[userid] = {}
        gusers[userid]['GokuJump'] = 1.0
        if player.armor < 450:
            player.armor = player.armor + 5
        if player.armor < 150:
            hsay(userid, 'Your LVL is 0!\nKI = %i'%player.armor)
            gusers[userid]['LVL'] = 0
        if player.armor in range(150, 226):
            hsay(userid, 'Your LVL is 1!\nKI = %i'%player.armor)
            gusers[userid]['LVL'] = 1
        elif player.armor in range(227, 301):
            hsay(userid, 'Your LVL is 2!\nKI = %i'%player.armor)
            gusers[userid]['LVL'] = 2
        elif player.armor in range(302, 376):
            hsay(userid, 'Your LVL is 3!\nKI = %i'%player.armor)
            gusers[userid]['LVL'] = 3
        elif player.armor > 375:
            hsay(userid, 'Your LVL is 4!\nKI = %i'%player.armor)
            gusers[userid]['LVL'] = 4
        gamethread.delayedname(KI_REGEN_DELAY, delayname % player, KI_regen, player)
コード例 #8
0
ファイル: xateleport.py プロジェクト: StarsGame/source_addons
def sendSecondMenu(userid, choice, popupid):
    oldChoice, target = choice
    if oldChoice == 2:
        steamid           = playerlib.uniqueid(userid, False)
        lang              = playerlib.getPlayer(userid).get("lang")
        if steamid not in locations:
            es.tell(userid, "#green", xalanguage("no locations", {}, lang) )
            return
        currentMap = str(es.ServerVar('eventscripts_currentmap'))
        if currentMap not in locations[steamid]:
            es.tell(userid, "#green", xalanguage("no map locations", {}, lang) )
            return
        if es.getplayerprop(target, 'CBasePlayer.pl.deadflag'):
            es.tell(userid, xalanguage('one player died', {}, playerlib.getPlayer(userid).get("lang") ) )
            return
        x, y, z = locations[steamid][currentMap]
        es.server.queuecmd('es_xsetpos %s %s %s %s' % (target, x, y, z + 10) )
        if not int(xa_anonymous):
            args           = {}
            args["player"] = es.getplayername(target)
            args["admin"]  = es.getplayername(userid)
            for player in playerlib.getPlayerList("#all"):
                es.tell(int(player), xalanguage("teleport to location", args, player.get("lang") ) )
        xateleport.logging.log("has teleported user %s [%s] to their saved location" % (es.getplayername(target), es.getplayersteamid(target)), userid)
    else:
        lang = playerlib.getPlayer(userid).get("lang")
        popupMenu = popuplib.easymenu("xa_teleport_players", "_popup_choice", teleportPlayerToPlayer)
        popupMenu.settitle(xalanguage["player select to send to"])
        for player in filter(lambda x: not es.getplayerprop(x, "CBasePlayer.pl.deadflag"), es.getUseridList()):
            popupMenu.addoption([target, player], es.getplayername(player), lang=lang)
        popupMenu.send(userid)
コード例 #9
0
ファイル: xasounds.py プロジェクト: StarsGame/source_addons
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)
コード例 #10
0
def player_hurt(ev):
    if ip_trainingserver_enable > 0:
        
        victim   = playerlib.getPlayer(ev['userid'])
        attacker = playerlib.getPlayer(ev['attacker'])
        
        if training_report_damage > 0:
            es.centertell(ev['attacker'], "Hurt %s for %s " % (victim.name, ev['dmg_health']))
コード例 #11
0
def check_nade(userid):
    userid = str(userid)
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        if int(es.getplayerprop(userid, "CBasePlayer.localdata.m_iAmmo.011")) != 1:
            gamethread.delayed(0.1, es.server.cmd, 'es_xgive %s weapon_hegrenade' % userid)
        gamethread.cancelDelayed(delayname % player)
        gamethread.delayedname(GOBHE_DELAY, delayname % player, check_nade, player)
コード例 #12
0
def _switch_setting(userid):
    if int(xaplayerdata_quakesounds.get(userid)) == 1:
        xaplayerdata_quakesounds.set(userid, 0)
        player = playerlib.getPlayer(userid)
        es.tell(userid, xalanguage('turn off', {}, player.get("lang")))
    else:
        xaplayerdata_quakesounds.set(userid, 1)
        player = playerlib.getPlayer(userid)
        es.tell(userid, xalanguage('turn on', {}, player.get("lang")))
コード例 #13
0
def power():
    userid = str(es.getcmduserid())
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        if jub[userid] < MAX_POW:
            es.tell(userid, '#multi', '#green[SH]#lightgreen Jubilee pink shades now protect you from flashbangs')
            fade(userid, 0, 5, 5, 64, 0, 64, 130)
            gamethread.delayed(12, Unblind, userid)
            jub[userid] += 1
コード例 #14
0
def player_spawn(ev):
    userid = ev['userid']
    if not superhero.hasHero(userid,'Superman'):
        return
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        health = player.health
        player.health = health + 75
        armor = player.armor
        player.set("armor", "120")
コード例 #15
0
def _select_player(userid, choice, popupid):
    command = admins[userid]['command']
    if command.startswith('weapon_') or command.startswith('item_'):
        if 'vest' not in command:
            if str(admingive_stripfirst) == '1':
                if command.replace('weapon_','') in pistols:
                    secondary = playerlib.getPlayer(choice).get('secondary') 
                    if secondary:
                        RemoveWeapon(choice, secondary)
                elif command.replace('weapon_','') in (list(shotguns) + list(smgs) + list(rifles) + list(snipers) + ['m249']):
                    primary = playerlib.getPlayer(choice).get('primary') 
                    if primary:
                        RemoveWeapon(choice, primary)
            gamethread.delayed(0.1, es.server.queuecmd, 'es_xgive %s %s'%(choice, command))
        else:
            if 'helm' in command:
                es.setplayerprop(choice, 'CCSPlayer.m_bHasHelmet', 1)
            es.setplayerprop(choice, 'CCSPlayer.m_ArmorValue', 100)
        if str(admingive_anonymous) == '0':
            tokens = {}
            tokens['admin'] = es.getplayername(userid)
            tokens['user']  = es.getplayername(choice)
            for myplayer in playerlib.getPlayerList('#human'):
                tokens['item'] = '#greena #lightgreen' + str(xalanguage(command.replace('weapon_','').replace('item_',''), lang=myplayer.get("lang")))
                es.tell(int(myplayer), '#multi', xalanguage('admin give', tokens, myplayer.get("lang")))
    elif command.startswith('health_'):
        if str(admingive_anonymous) == '0':
            tokens = {}
            tokens['admin'] = es.getplayername(userid)
            tokens['user']  = es.getplayername(choice)
            health = command.replace('health_','')
            c = ''
            while len(health) > 3:
                c = ',' + health[-3:]
                health = health[0:-3]
            c = health + c
            tokens['item'] = '#green' + c + ' #lightgreenhealth'
            for myplayer in playerlib.getPlayerList('#human'):
                es.tell(int(myplayer), '#multi', xalanguage('admin give', tokens, myplayer.get("lang")))
        es.setplayerprop(choice, 'CBasePlayer.m_iHealth', es.getplayerprop(choice, 'CBasePlayer.m_iHealth') + int(command.replace('health_','')))
    elif command.startswith('cash_'):
        if str(admingive_anonymous) == '0':
            tokens = {}
            tokens['admin'] = es.getplayername(userid)
            tokens['user']  = es.getplayername(choice)
            cash = command.replace('cash_','')
            c = ''
            while len(cash) > 3:
                c = ',' + cash[-3:]
                cash = cash[0:-3]
            c = '$' + cash + c
            tokens['item'] = '#green' + c
            for myplayer in playerlib.getPlayerList('#human'):
                es.tell(int(myplayer), '#multi', xalanguage('admin give', tokens, myplayer.get("lang")))
        es.setplayerprop(choice, 'CCSPlayer.m_iAccount', es.getplayerprop(choice, 'CCSPlayer.m_iAccount') + int(command.replace('cash_','')))
コード例 #16
0
def selected():
    global gusers
    userid = es.getcmduserid()
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        if not superhero.hasHero(player,'Goku'):
            return
        gusers[userid] = {}
        gusers[userid]['LVL'] = 0
        player.armor = 100
        KI_regen(userid)
コード例 #17
0
def player_spawn(ev):
    global gct #T General count
    global gcct #CT General count 
    global gusers #General users
    gct = 0
    gcct = 0
    userid = ev['userid']
    if not superhero.hasHero(userid,'General'):
        return
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        gamethread.delayed(1, GeneralHelp, userid)
コード例 #18
0
def nominate():
    """ Executed when a user types 'nominate' in chat """
    userid = es.getcmduserid() 
    if allowVoting: 
        steamid = es.getplayersteamid(userid) 
        entry(steamid) 
        if not players[steamid][1]: 
            popuplib.send("nomination_menu", userid) 
        else:
            es.tell(userid, '#multi', lang('1nominate', lang=playerlib.getPlayer(userid).get('lang') ) )
    else:
        es.tell(userid, '#multi', lang('no_nominate', lang=playerlib.getPlayer(userid).get('lang') ) )
コード例 #19
0
 def plant(self, userid, site, mapname):
     if active:
         if site != bombsitesNum[self.defaultSiteLetter]:
             if es.getplayersteamid(userid) != 'BOT':
                 playerlib.getPlayer(userid).set("push", (0, 300, 1))
                 es.tell(userid, '#multi', '#green[#lightgreenBombsite#green-#lightgreenLimiter#lightgreen]#default Due to the low number of CT\'s this round, you must #lightgreenonly plant at site #green%s#lightgreen!'%self.defaultSiteLetter)
                 es.centertell(userid, 'You must only plant at %s site!'%self.defaultSiteLetter)
                 gamethread.delayed(1, es.centertell, (userid, 'You must only plant at %s site!'%self.defaultSiteLetter))
             else:
                 x, y, z = random.choice(coords)
                 es.server.queuecmd('es_xsetpos %s %s %s %s'%(userid, x, y, z))
                 es.msg('#multi','#green[#lightgreenBombsite#green-#lightgreenLimiter#green]#lightgreen %s #defaultwas teleported for planting at the wrong bombsite and being a bot!' % es.getplayername(userid))
コード例 #20
0
ファイル: est_effect.py プロジェクト: hojjke/wowmod
def preRegEffect7(args):
    if len(args) != 15:
        log.log(
            "est_effect_07 <player Filter> <delay> <model> <start ent> <end ent> <framerate> <life> <width> <spread> <amplitude> <R> <G> <B> <A> <speed>"
        )
        log.log("est_effect_07: get: " + " ".join(args))
        return
    users = str(args[0])
    if users == "#a":
        users = "#all"
    delay = float(args[1])
    model = str(args[2])
    if not es.exists("userid", args[3]):
        log.log("est_effect_07: unkown id: %s !" % args[3])
        return
    StartEntityIndex = playerlib.getPlayer(args[3]).index
    if not es.exists("userid", args[4]):
        log.log("est_effect_07: unkown id: %s !" % args[4])
        return
    EndEntityIndex = playerlib.getPlayer(args[4]).index
    rate = int(args[5])
    life = float(args[6])
    width = int(args[7])
    spread = int(args[8])
    amplitude = int(args[9])
    red = int(args[10])
    green = int(args[11])
    blue = int(args[12])
    alpha = int(args[13])
    speed = int(args[14])
    if amplitude > 60:
        amplitude = 60
    spe_effects.beamRing(
        users,
        delay,
        StartEntityIndex,
        EndEntityIndex,
        model,
        0,
        0,
        rate,
        life,
        width,
        spread,
        amplitude,
        red,
        green,
        blue,
        alpha,
        speed,
        0,
    )
コード例 #21
0
def player_spawn(event_var):
    # Is spectator?
    if int(event_var["es_userteam"]) < 2:
        return

    # Set player's id
    userid = int(event_var["userid"])

    # Is player dead?
    if getPlayer(userid).isdead:
        return

    # Enable noblock for this player
    getPlayer(userid).noblock = 1
コード例 #22
0
ファイル: ip_teabag.py プロジェクト: Gues7/ip-eventscripts
def doWork(arg1, arg2):
    global checkTeabag
    victim      = playerlib.getPlayer(arg1)
    attacker    = playerlib.getPlayer(arg2)
    isDucking   = es.getplayerprop(arg2, 'CBasePlayer.localdata.m_Local.m_bDucked')
    
    victimPos   = victim.x + victim.y + victim.z
    attackerPos = attacker.x + attacker.y + attacker.z
    if (attackerPos - victimPos) <= 50: # Change this to change sensitivity
        if isDucking > 0:
            checkTeabag.stop
            es.centermsg("%s just got teabagged!!!" % victim.name)
            es.emitsound(player, arg2, 'bot/owned.wav', 1.0, 0.5)
            es.msg("#multi", "#lightgreen[#greenTea-Bag#lightgreen] %s#default has just tea-bagged #lightgreen%s#default!" % (attacker.name, victim.name))
コード例 #23
0
def undo(player):
    userid = str(es.getcmduserid())
    player = playerlib.getPlayer(userid)
    if not playerlib.getPlayer(userid).isdead:
        es.centertell(player.userid,'Noclip deactivated')
        gusers[str(player.userid)]['crawl'] = 0
        if not 'speed' in gusers[str(player.userid)]: 
            gusers[str(player.userid)]['speed'] = 1.0
        player.set("speed", float(gusers[str(player.userid)]['speed']))
        es.server.queuecmd('es_xsetplayerprop %s "CBaseEntity.movetype" 1' % player.userid)
        gusers[str(player.userid)]['nc_cooldown'] = int(time.time()) + 10
        gusers[str(player.userid)]['on_ground'] = 0
        #es.server.cmd('ezunrestrict %s #all' % player.userid)
        gamethread.delayed(0.5,check_stuck,(player))
コード例 #24
0
def nomination_result(userid, choice, popupname):
    """ Append the nomination to the nomination list """
    if allowVoting:
        steamid = es.getplayersteamid(userid)
        players[steamid][1] = True
        if choice not in nominations:
            nominations.append(choice)

        tokens = {}
        tokens["player"] = es.getplayername(userid)
        tokens["mapname"] = choice
        for user in es.getUseridList():
            es.tell(user, "#multi", lang("nominated", tokens, playerlib.getPlayer(user).get("lang")))
    else:
        es.tell(userid, "#multi", lang("no_nominate", lang=playerlib.getPlayer(userid).get("lang")))
コード例 #25
0
def nomination_result(userid, choice, popupname):
    """ Append the nomination to the nomination list """
    if allowVoting:
        steamid = es.getplayersteamid(userid)
        players[steamid][1] = True
        if choice not in nominations:
            nominations.append(choice)
        xartv.logging.log("has nominated map %s for Rock The Vote" % choice, userid )            
        tokens = {}
        tokens['player']  = es.getplayername(userid)
        tokens['mapname'] = choice 
        for user in es.getUseridList():
            es.tell(user, '#multi', lang('nominated', tokens, playerlib.getPlayer(user).get('lang') ) )
    else:
        es.tell(userid, '#multi', lang('no_nominate', lang=playerlib.getPlayer(userid).get('lang') ) )
コード例 #26
0
def wep_remove(userid):
    player = playerlib.getPlayer(userid)
    if int(player.isdead) != 1:
        if userid != '0':
            player = playerlib.getPlayer(userid)
            primary = player.getPrimary()
            for x in xrange(7):
                handle = es.getplayerprop(userid, 'CBaseCombatCharacter.m_hMyWeapons.%03d' % x)
                if handle > 0:
                    index = es.getindexfromhandle(handle)
                    weapon = weaponlib.getWeapon(es.entitygetvalue(index, 'classname'))
                    if weapon is not None and 'primary' in weapon.tags:
                        es.entitysetvalue(index, 'targetname', 'kill_me')
                        es.server.queuecmd('es_xfire %s kill_me kill'%userid)
                        
コード例 #27
0
def display_feedback(int_cmd_userid, str_text, dict_tokens):
    """Displays command feedback to the player or console"""
    if int_cmd_userid:
        es.tell(int_cmd_userid, func_lang_text(str_text, dict_tokens, playerlib.getPlayer(int_cmd_userid).get('lang')))

    else:
        es.dbgmsg(0, func_lang_text(str_text, dict_tokens))
コード例 #28
0
ファイル: afk.py プロジェクト: robtomlinson/GunGame
    def teleport(self, x, y, z, eyeangle0=0, eyeangle1=0):
        '''
        Teleport the player.

        Recalculates the player's location automatically for the scripter.
        '''
        # Make sure player is on a team
        if es.getplayerteam(self.userid) < 2:
            raise ValueError('Unable to teleport player (%s): not on a team.'
                % self.userid)

        # Make sure the player is alive
        if getPlayer(userid).isdead:
            raise ValueError('Unable to teleport player (%s): not alive.'
                % self.userid)

        # Set position
        es.server.queuecmd('es_xsetpos %d %s %s %s' % (self.userid, x, y, z))

        # Set eye angles
        if eyeangle0 != 0 or eyeangle1 != 0:
            es.server.queuecmd('es_xsetang %d %s %s' % (self.userid, eyeangle0,
                                                       eyeangle1))

        # Reset player AFK calculation
        gamethread.delayed(0.1, self.reset, ())
コード例 #29
0
def endProtect(userid):
    # Are they even protected?
    if not userid in protectedList:
        return

    # Check the client hasn't left during the protection period
    if not es.exists('userid', userid) and userid != 0:
        # Fix potential memory leak:
        protectedList.remove(userid)
        return

    # Retrieve player objects
    pPlayer = getPlayer(userid)

    # Remove the player from the list of protected players
    protectedList.remove(userid)

    # Color
    pPlayer.color = (255, 255, 255, 255)

    # End Invincible
    pPlayer.godmode = 0

    # Remove PreventLevel if it was enabled
    if not int(gg_spawn_protect_can_level_up):
        ggPlayer = Player(userid)

        if 'gg_spawn_protect' in ggPlayer.preventlevel():
            ggPlayer.preventlevel.remove('gg_spawn_protect')
コード例 #30
0
def hegrenade_detonate(event_var):
    # Get the userid as int
    userid = int(event_var['userid'])

    # If the player is not on an active team, return
    if int(event_var['es_userteam']) < 2:
        return

    # If the player is not on hegrenade level, return
    if Player(userid).weapon != 'hegrenade':
        return

    # If the player is dead, return
    if getPlayer(userid).isdead:
        return

    # If there is a limit to the number of nades a player can get...
    if int(gg_multi_nade_max_nades) > 0:

        # Don't keep counting if the player has already hit the max
        if Player(userid).grenades_detonated < int(gg_multi_nade_max_nades):
            # Increment the player's grenades_detonated count
            Player(userid).grenades_detonated += 1

        # Find out if they exceeded the limit and break out if so
        if Player(userid).grenades_detonated >= int(gg_multi_nade_max_nades):
            return

    # Give the player a new hegrenade
    spe.giveNamedItem(userid, "weapon_hegrenade")
コード例 #31
0
def teleportPlayerToPlayer(userid, choice, popupid):
    target, recipient = choice
    if es.getplayerprop(target, 'CBasePlayer.pl.deadflag') or es.getplayerprop(
            recipient, 'CBasePlayer.pl.deadflag'):
        es.tell(
            userid,
            xalanguage('one player died', {},
                       playerlib.getPlayer(userid).get("lang")))
        return

    if not es.exists('userid', target) or not es.exists('userid', recipient):
        """ One of the player's doesn't exists... Return early and break the function """
        return
    x, y, z = es.getplayerlocation(recipient)
    z += 100
    es.server.queuecmd('es_xsetpos %s %s %s %s' % (target, x, y, z))
    if not int(xa_anonymous):
        args = {}
        args["admin"] = es.getplayername(userid)
        args["target"] = es.getplayername(target)
        args["recipient"] = es.getplayername(recipient)
        for player in playerlib.getPlayerList("#all"):
            es.tell(
                int(player),
                xalanguage("player sent to player", args, player.get("lang")))
    xateleport.logging.log(
        "has teleported user %s [%s] to user %s [%s]" %
        (es.getplayername(target), es.getplayersteamid(target),
         es.getplayername(recipient), es.getplayersteamid(recipient)), userid,
        True)
コード例 #32
0
ファイル: Frost Pistol.py プロジェクト: Grimston/sourcerpg-es
def player_spawn(event_var):
    """
    Occurs when a player spawns. Assing a key to their dictionary value so we
    can hold if they're currently slowed or not

    @PARAM event_var - an automatically passed event instance
    """
    userid = event_var['userid']
    if not es.getplayerprop(userid, 'CBasePlayer.pl.deadflag'):
        """ If they're color is not default, force it """
        playerlibInstance = playerlib.getPlayer(userid)
        if playerlibInstance.getColor()[0] != 255:
            playerlib.getPlayer(userid).setColor(255, 255, 255)
        player = sourcerpg.players[userid]
        if player is not None:
            player['slowed'] = False
コード例 #33
0
ファイル: __init__.py プロジェクト: robtomlinson/GunGame
    def __format_string(self, string, tokens, userid=0):
        '''Retrieves and formats the string.'''
        # Make the userid an int
        userid = int(userid)

        if userid > 0:
            language = getPlayer(userid).getLanguage()
        else:
            # Is the console, use the value of "eventscripts_language"
            language = str(es.ServerVar('eventscripts_language'))

            # Get language and get the string
            language = getLangAbbreviation(language)

        string = __strings__(string, tokens, language)

        # Format it
        string = string.replace('#lightgreen',
                                '\3').replace('#green', '\4').replace(
                                    '#default',
                                    '\1').replace('#darkgreen',
                                                  '\5').replace('"', "'")
        '''
        # Not sure what this does, so I will leave it commented out for now:
        string = encodings.codecs.escape_decode(rtnStr)
        '''
        # Return the string
        return string
コード例 #34
0
def player_death(ev):
    usersteam = ev['es_steamid']
    steam = ev['es_attackersteamid']
    if steam == usersteam == 'BOT': return
    userid = ev['userid']
    attacker = ev['attacker']
    if attacker != userid and attacker.isdigit() and int(attacker):
        headshot = int(ev['headshot'])
        weapon = ev['weapon']
        team = int(ev['es_attackerteam'])
        userteam = int(ev['es_userteam'])
        killtype = 'Killer' if not userteam == team else 'TeamKilled'
        killtype = 'Suicide' if userid in ['0', attacker] else killtype
        distance = playerlib.getPlayer(userid).get(
            'distance', attacker) if userid != attacker else 0
        feet = '%0.2fft' % (distance * 0.0375)
        meters = '%0.2fm' % (distance * 0.01278)
        dist = feet if victimstats_distance == 1 else meters
        dist = str('%s (%s)' %
                   (meters, feet)) if victimstats_distance == 3 else dist
        if usersteam != 'BOT':
            victim = PlayerList[userid]
            if victim.setting:
                victim.sendStats((killtype, headshot, ev['es_attackername'],
                                  weapon, dist, ev['es_attackerhealth']))
        if steam == 'BOT': return
        killer = PlayerList[attacker]
        if killer.setting and userteam != team in [2, 3]:
            killer.playerKilled(ev['es_username'], weapon, headshot, dist)
コード例 #35
0
ファイル: xavotekickban.py プロジェクト: fizek/source_addons
def voteBan():
    """
    Executed when a player types 'voteban' in either console or chat. Build
    a popup of all the valid players they can ban.
    """
    userid = str(es.getcmduserid())
    if es.getplayercount() >= minBanPlayers:
        """ There are enough players to run the command """
        myPopupInstance = popuplib.easymenu("xa_voteban_%s" % userid,
                                            "_popup_choice", voteBanCheck)
        myPopupInstance.settitle("Select a player to ban")
        for player in es.getUseridList():
            """ Loop through all the players in the server """
            if str(player) != userid:
                """ The current iteration is not equal to the user who executed the command """
                myPopupInstance.addoption(
                    player, es.getplayername(player),
                    bool(player not in userids[userid]["bans"]))
        myPopupInstance.send(userid)
    else:
        """ There are not enough players, notify the user """
        es.tell(
            userid, '#green',
            xalanguage("not enough players", {},
                       playerlib.getPlayer(userid).get("lang")))
コード例 #36
0
def choosePlayer():
    '''
    Used by chooseKick() to determine a player to kick
    '''
    kicklist = playerlib.getPlayerList("#res")
    kickuid = playerlib.getPlayer(es.getuserid(
    ))  # get a random player to return if none of the others return anything.
    if int(xareserveslots.setting.getVariable(
            "reserve_slots_kick_method")) == 1:
        timelowest = None
        for id in kicklist:
            time = id.attributes["timeconnected"]
            if timelowest is None or time < timelowest:
                timelowest = time
                kickuid = id
        return kickuid
    else:
        ping = -1
        for id in kicklist:
            pping = id.attributes["ping"]
            if pping > ping:
                ping = pping
                kickuid = id
        return kickuid
    return kickuid
コード例 #37
0
def player_hurt(ev):
    armor = int(ev['es_userarmor'])
    if armor < 150 and armor + int(ev['dmg_armor']) >= 150:
        player = getPlayer(ev['userid'])
        gamethread.cancelDelayed(delayname % player)
        gamethread.delayedname(FUEL_REGEN_DELAY, delayname % player,
                               fuel_regen, player)
コード例 #38
0
def startProtect(userid):
    # Retrieve player objects
    pPlayer = getPlayer(userid)

    # Add them to the list of protected players
    protectedList.append(userid)

    # Set color
    pPlayer.color = (gg_spawn_protect_red,
                     gg_spawn_protect_green,
                     gg_spawn_protect_blue,
                     gg_spawn_protect_alpha)

    # Start Invincible
    pPlayer.godmode = 1

    # Set PreventLevel if needed
    if not int(gg_spawn_protect_can_level_up):
        ggPlayer = Player(userid)

        if not 'gg_spawn_protect' in ggPlayer.preventlevel():
            ggPlayer.preventlevel.append('gg_spawn_protect')

    # Start the delay to cancel spawn protection
    gamethread.delayedname(int(gg_spawn_protect),
        'ggSpawnProtect%s' % userid, endProtect, (userid))
コード例 #39
0
ファイル: quake_sounds.py プロジェクト: madPO/es_plugin-depot
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))
コード例 #40
0
def endProtect(userid):
    # Are they even protected?
    if not userid in protectedList:
        return

    # Check the client hasn't left during the protection period
    if not es.exists('userid', userid) and userid != 0:
        # Fix potential memory leak:
        protectedList.remove(userid)
        return

    # Retrieve player objects
    pPlayer = getPlayer(userid)

    # Remove the player from the list of protected players
    protectedList.remove(userid)

    # Color
    pPlayer.color = (255, 255, 255, 255)

    # End Invincible
    pPlayer.godmode = 0

    # Remove PreventLevel if it was enabled
    if not int(gg_spawn_protect_can_level_up):
        ggPlayer = Player(userid)

        if 'gg_spawn_protect' in ggPlayer.preventlevel():
            ggPlayer.preventlevel.remove('gg_spawn_protect')
コード例 #41
0
ファイル: ultirank.py プロジェクト: bihicheng/playground
 def setRankDataToZero(self, userid):
     uniqueid = self.identifyPlayer(userid)
     self.ranksData[uniqueid] = {"name" : str(playerlib.getPlayer(userid).name), 
                                     "points" : 0, 
                                     "kills" : 0, 
                                     "deaths" : 0,
                                     "resettime" : time.time()}
コード例 #42
0
 def sendglobal(self, pUsers, prio=False, locked=False):
     try:
         # try if pUsers is just a single userid
         userid = int(pUsers)
         pUsers = [userid]
     except TypeError:
         pass
     if locked:
         optionstate = 0
     else:
         optionstate = 1
     for userid in pUsers:
         player = playerlib.getPlayer(userid)
         if player:
             helpline = self.languages('setting '+self.keyvalues['config']['type']+' help', (), player.get('lang'))
             self.popup['global'] = popuplib.easymenu('_setting_%s_user%s_global' % (self.name, userid), '_setting_choice', settinglib._submitGlobal)
             self.popup['global'].settingid = self.name
             self.popup['global'].c_titleformat = self.keyvalues['config']['descr'] + (' '*(30-len(self.keyvalues['config']['descr']))) + ' (%p/%t)\n' + helpline
             for option in self.keyvalues['options']:
                 display = self.keyvalues['options'][option]['display']
                 userdata = self.keyvalues['options']
                 if option in userdata:
                     if userdata[option]['globstate']:
                         active = self.languages('setting list active', (), player.get('lang'))
                         self.popup['global'].addoption(int(option), display + ' ('+active+')', optionstate)
                         continue
                 self.popup['global'].addoption(int(option), display, optionstate)
             if self.backmenuvar:
                 self.popup['global'].submenu(10, self.backmenuvar)
             self.popup['global'].send(userid, prio)
コード例 #43
0
def customVoteTitle():
    userid = es.getcmduserid()
    title = es.getargs()
    lang = playerlib.getPlayer(userid).get("lang")
    es.escinputbox(30, userid, xalanguage("vote options", lang=lang),
                   xalanguage("select vote options", lang=lang),
                   'xa_set_options %s ^^^' % title)
コード例 #44
0
def player_spawn(event_var):
    """
    This function is called when a player spawns.  It gets the player's current level
    Check if the player is in the database yet
    If not in the database then go create a record
    """
    if es.getplayerprop(event_var['userid'], 'CBasePlayer.pl.deadflag'):
        """ This accounts for the spawn event which runs before player_activate """
        return
    create_record(event_var)
    """ then gets the team and then the model and sets it """
    if event_var['es_steamid'] != "BOT":
        if event_var['es_userteam'] in ("2", "3"):
            if xaskins.isUseridAuthorized(int(event_var['userid']),
                                          "skin_admin"):
                level = "admin"
            elif xaskins.isUseridAuthorized(int(event_var['userid']),
                                            "skin_reserved"):
                level = "reserved"
            else:
                level = "public"
            team = {"2": "t", "3": "ct"}[event_var['es_userteam']]
            xaplayerdata_skin = skins[level + '_' + team + '_skin']
            model = xaplayerdata_skin.get(int(event_var['userid']))
            if str(model) != "None":
                xaskins.logging.log("has had his skin changed to '%s'" % model,
                                    event_var['userid'])
                myPlayer = playerlib.getPlayer(event_var['userid'])
                myPlayer.set('model', model)
コード例 #45
0
def clientFilter(userid, args):
    """
    Executed when a client command is issued from a player. Test to see if drop
    was the command; if so, then remove the weapon.

    @PARAM userid - the id of the user who issued the client command
    @PARAM args - a list of arguments, with index 0 being the command.
    """
    if args and args[0].lower() == "drop":
        """ Player is about to issue the drop command """
        player = sourcerpg.players[userid]
        level  = player[skillName]
        if level:
            """ The player has recover weapons, get their active weapn and remove it """
            weapon = weaponlib.getWeapon(playerlib.getPlayer(userid).get("weapon"))
            if weapon is None:
                # The user has no weapons, allow them to run the drop command
                return True

            weapon = weapon.name # return formated weapon
            
            if level >= 3 and weapon in weaponlib.getWeaponNameList("#primary"):
                player['primary'] = None

            elif level >= 2 and weapon in weaponlib.getWeaponNameList("#secondary"):
                player['secondary'] = None

    return True
コード例 #46
0
def Set_Location(userid):
    check = es.getplayerprop(userid, 'CBasePlayer.m_fFlags')
    location = es.getplayerlocation(userid)
    steamid = es.getplayersteamid(userid)
    player = playerlib.getPlayer(userid)
    velocity = int(
        round(
            vector(
                (float(
                    es.getplayerprop(
                        userid, 'CBasePlayer.localdata.m_vecVelocity[0]')),
                 float(
                     es.getplayerprop(
                         userid, 'CBasePlayer.localdata.m_vecVelocity[1]')),
                 float(
                     es.getplayerprop(
                         userid,
                         'CBasePlayer.localdata.m_vecVelocity[2]')))).length(),
            2))
    if not check & 1:
        if not playerOnTop(userid)[0] == "True":
            if velocity < 400:
                gamethread.cancelDelayed("Check_Runboost_%s" % userid)
                gamethread.cancelDelayed("Check_Ground_%s" % userid)
                Check_When_Grounded(userid, False, False)

            else:
                gamethread.cancelDelayed("Check_Runboost_%s" % userid)
                gamethread.cancelDelayed("Check_Ground_%s" % userid)
                Check_When_Grounded(userid, True, False)
        else:
            gamethread.cancelDelayed("Check_Runboost_%s" % userid)
            gamethread.cancelDelayed("Check_Ground_%s" % userid)
            Check_Runboost(userid)

        return
    else:
        client[steamid]['loc'] = location
        client[steamid]['time'] = 0
        client[steamid]['avs'] = []
        client[steamid]['pre'] = velocity
        gamethread.cancelDelayed("Check_Runboost_%s" % userid)
        gamethread.cancelDelayed("Check_Ground_%s" % userid)

    if player.isdead:
        gamethread.cancelDelayed("Check_Runboost_%s" % userid)
        gamethread.cancelDelayed("Check_Ground_%s" % userid)
        gamethread.cancelDelayed("Set_Location_%s" % userid)
        esc.tell(
            userid,
            "#255,51,0[#255,137,0LJStats#255,51,0] #snowis no longer tracking you!"
        )
        client[steamid]['lj'] = 0
        return

    gamethread.delayedname(0.001,
                           'Set_Location_%s' % userid,
                           Set_Location,
                           args=(userid))
コード例 #47
0
def tell(userid, message, options={}, tellMessage=True):
    """ Just a simple wrapper to send a multi language text or return it if tellMessage is False """
    message = text(message, options, playerlib.getPlayer(userid).get("lang"))
    if tellMessage:
        es.tell(userid, '#multi',
                '#green[Surf Timer] #default- #lightgreen%s' % message)
    else:
        return message
コード例 #48
0
 def __init__(self, userid): 
     # set up a player instance of playlib 
     self.uid = int(userid) 
     # some more stuff of use 
     self.plib = playerlib.getPlayer(self.uid) 
     self.steamid = es.getplayersteamid(self.uid) 
     # get some initial data 
     self.spawntime = False 
コード例 #49
0
def compass(userid):
    player = playerlib.getPlayer(userid)
    view_angles = player.viewVector()

    view_x = player.viewVector()[0] * 360

    if view_x >= 300:
        return True
コード例 #50
0
 def getPlayerVote(self,userid,choice,popupid):
     player = playerlib.getPlayer(userid)
     self.current_user_votes[player.uniqueid(True)] = choice
     if not choice in self.votes:
         self.votes[choice] = 0
     self.votes[choice] += 1
     if lmv_announce_each_vote:
         self.sendAllPlayersMessages('Player Vote',{'player':player.name,'choice':choice},'chat')
コード例 #51
0
def nominate():
    """ Executed when a user types 'nominate' in chat """
    userid = es.getcmduserid()
    if allowVoting:
        steamid = es.getplayersteamid(userid)
        entry(steamid)
        if not players[steamid][1]:
            popuplib.send("nomination_menu", userid)
        else:
            es.tell(
                userid, '#multi',
                lang('1nominate',
                     lang=playerlib.getPlayer(userid).get('lang')))
    else:
        es.tell(
            userid, '#multi',
            lang('no_nominate', lang=playerlib.getPlayer(userid).get('lang')))
コード例 #52
0
ファイル: gameevents.py プロジェクト: robtomlinson/GunGame
def player_spawn(event_var):
    '''Called any time a player spawns'''

    userid = int(event_var['userid'])

    # Is a spectator?
    if int(event_var['es_userteam']) < 2:
        return

    # Is player dead?
    if getPlayer(userid).isdead:
        return

    ggPlayer = Player(userid)

    # Do we need to give the player a defuser?
    if int(gg_player_defuser):

        # Is the player a CT?
        if int(event_var['es_userteam']) == 3:

            # Are we removing bomb objectives from map?
            if not int(gg_map_obj) in (1, 2):

                # Does the map have a bombsite?
                if len(es.getEntityIndexes('func_bomb_target')):

                    # Does the player already have a defuser?
                    if not getPlayer(userid).defuser:

                        # Give the player a defuser:
                        getPlayer(userid).defuser = 1

    # Strip bots (sometimes they keep previous weapons)
    if es.isbot(userid):
        delayed(0.25, give_weapon_check, (userid))
        delayed(0.35, ggPlayer.strip)

    # Player is human
    else:
        # Reset AFK
        delayed(0.60, ggPlayer.afk.reset)

        # Give the player their weapon
        delayed(0.05, give_weapon_check, (userid))
コード例 #53
0
def sendFirstPlayer(userid, choice, popupid):
    if 3 < choice < 10:
        xateleportmenu.send(userid)
    if choice == 1:
        steamid = playerlib.uniqueid(userid, False)
        if steamid not in locations:
            locations[steamid] = {}
        locations[steamid][str(es.ServerVar('eventscripts_currentmap'))] = es.getplayerlocation(userid)
        lang    = playerlib.getPlayer(userid).get("lang")
        saveDatabase()
        es.tell(userid, "#green", xalanguage("location saved", {}, lang) )
    elif 4 > choice > 1:
        lang = playerlib.getPlayer(userid).get("lang")
        popupMenu = popuplib.easymenu("xa_teleport_players", "_popup_choice", sendSecondMenu)
        popupMenu.settitle(xalanguage["player select"])
        for player in filter(lambda x: not es.getplayerprop(x, "CBasePlayer.pl.deadflag"), es.getUseridList()):
            popupMenu.addoption([choice, player], es.getplayername(player), lang=lang)
        popupMenu.send(userid)
コード例 #54
0
def weapon_fire(ev):
    userid = ev['userid']
    if not superhero.hasHero(userid, 'Invisible Man'):
        return
    player = playerlib.getPlayer(userid)
    r, g, b, a = player.getColor()
    player.set("color", [r, g, b, 255])
    if a != 255:
        es.centertell(userid, "You are not cloaked anymore!")
コード例 #55
0
def get_glock(userid, text, steamid, name):
    player = playerlib.getPlayer(userid)
    if not player.isdead:
        if not client[steamid]["spam"] > 3:
            esc.tell(userid, '#124,252,0[ Trikz] #snowYou have received an #yellowGlock.')
            es.server.queuecmd('es_xgive %s weapon_glock' % userid)
            client[steamid]["spam"] += 1
        else:
            esc.tell(userid, '#124,252,0[ Trikz] #snowStop spamming the command #yellow%s' % text)
コード例 #56
0
def weapon_fire(ev):
    userid = ev['userid']
    if not superhero.hasHero(userid, 'Agent Zero'):
        return
    player = playerlib.getPlayer(userid)
    es.setplayerprop(userid, 'CCSPlayer.cslocaldata.m_iShotsFired', 0)
    es.setplayerprop(userid,
                     'CCSPlayer.baseclass.localdata.m_Local.m_vecPunchAngle',
                     '0.000000,0.000000,0.000000')
コード例 #57
0
def wep_remove(userid):
    player = playerlib.getPlayer(userid)
    if int(player.isdead) != 1:
        if userid != '0':
            player = playerlib.getPlayer(userid)
            primary = player.getPrimary()
            for x in xrange(7):
                handle = es.getplayerprop(
                    userid, 'CBaseCombatCharacter.m_hMyWeapons.%03d' % x)
                if handle > 0:
                    index = es.getindexfromhandle(handle)

                    weapon = weaponlib.getWeapon(
                        es.entitygetvalue(index, 'classname'))
                    if weapon is not None and 'primary' in weapon.tags:
                        es.entitysetvalue(index, 'targetname', 'kill_me')

                        es.server.queuecmd('es_xfire %s kill_me kill' % userid)
コード例 #58
0
def player_spawn(ev):
    global gusers
    userid = int(ev['userid'])
    if not superhero.hasHero(userid, 'Goku'):
        return
    gamethread.cancelDelayed(delayname % ev['userid'])
    player = playerlib.getPlayer(userid)
    player.armor = 100
    KI_regen(userid)
コード例 #59
0
def _punishment_slay(userid, adminid, args, force):
    if str(xa_adminslay_anonymous) == '0' and not force:
        tokens = {}
        tokens['admin']   = es.getplayername(adminid)
        tokens['user']    = es.getplayername(userid)
        for user in playerlib.getPlayerList():
            es.tell(int(userid), xalanguage("admin slay", tokens, user.get("lang")))
    player = playerlib.getPlayer(userid)
    player.kill()
コード例 #60
0
def player_activate(event_var):
    userid = int(event_var['userid'])
    if not userid in gUserid:
        player = playerlib.getPlayer(userid)
        if not player.isbot:
            player._hpk_violations = 0
            gUserid[userid] = repeat.create('hpk_track_%s' % userid, _tracker,
                                            player)
            gUserid[userid].start(float(interval), float(check))