예제 #1
0
   def removeWeapon(self, weapon):
      """
      Executes "lastinv" on the client if the weapon to remove is the player's active weapon
      Removes the weapon by index
      Creates a new weapon at the player's feet if necessary
      Announces the restricted pickup
      """
      longname = 'weapon_' + weapon

      if es.createplayerlist(self.userid)[self.userid]['weapon'] == longname:
         es.cexec(self.userid, 'lastinv')

      for index in es.createentitylist(longname):
         if es.getindexprop(x, 'CBaseEntity.m_hOwnerEntity') <> self.handle: continue

         gamethread.delayedname(0.2, 'saferemove_%s'%index, saferemove, index)

         if (getTeam(2).isRestricted(weapon) and getTeam(3).isRestricted(weapon)) if int(removebanned) else False:
            lastgive = -1

         else:
            eye_angles = tuple(es.getplayerprop(self.userid, eyeangle_prop % x) for x in range(3))
            es.server.cmd('es_xsetang %s 90 0 0' % self.userid)

            es.server.cmd('es_xentcreate %s %s' % (self.userid, longname))
            lastgive = int(es.ServerVar('eventscripts_lastgive'))
            setNPCWeapon(longname)

            es.server.cmd('es_xsetang %s %s %s %s' % ((self.userid,) + eye_angles))

         self.announceRestrictedPickup(weapon, lastgive)

         break
예제 #2
0
def addAdvert(args, userid=None):
   if not args:
      if userid:
         es.cexec(userid, 'echo Syntax: add_advert <color>|<advert>') 
      else:
         print('Syntax: add_advert <color>|<advert>')
      return
   global adverts
   args = str(args)
   a_split = args.split('|', 1)
   if len(a_split) == 1:
      ad =  args.replace('\n', '')
      color = str(SA_DEFAULT_COLOR)
      new_adverts.append(color + "|" + ad)
   else:  
      color = a_split[0]
      if color not in COLORS:
         color = str(SA_DEFAULT_COLOR)
      ad = a_split[1].replace('\n', '')
      new_adverts.append(color + "|" + ad)
   if userid:
      es.cexec(userid, "echo Added the advert: --%s-- in the color: --%s--" %(ad, color))
   else:
      print('Added the advert: "%s" in the color: "%s"' %(ad, color))
   adverts = cycle(new_adverts)
   with CFG_ADVERTS_PATH.open('a') as file:
      file.write(args + '\n')
예제 #3
0
    def removeWeapon(self, weapon):
        """
      Executes "lastinv" on the client if the weapon to remove is the player's active weapon
      Removes the weapon by index
      Creates a new weapon at the player's feet if necessary
      Announces the restricted pickup
      """
        longname = "weapon_" + weapon
        xarestrict.logging.log("Weapon %s has been removed from user %s" % (weapon, es.getplayername(self.userid)))
        if es.createplayerlist(self.userid)[self.userid]["weapon"] == longname:
            es.cexec(self.userid, "lastinv")

        for index in es.createentitylist(longname):
            if es.getindexprop(x, "CBaseEntity.m_hOwnerEntity") <> self.handle:
                continue

            gamethread.delayedname(0.2, "saferemove_%s" % index, saferemove, index)

            if (getTeam(2).isRestricted(weapon) and getTeam(3).isRestricted(weapon)) if int(removebanned) else False:
                lastgive = -1

            else:
                eye_angles = tuple(es.getplayerprop(self.userid, eyeangle_prop % x) for x in range(3))
                es.server.cmd("es_xsetang %s 90 0 0" % self.userid)

                es.server.cmd("es_xentcreate %s %s" % (self.userid, longname))
                lastgive = int(es.ServerVar("eventscripts_lastgive"))
                setNPCWeapon(longname)

                es.server.cmd("es_xsetang %s %s %s %s" % ((self.userid,) + eye_angles))

            self.announceRestrictedPickup(weapon, lastgive)

            break
예제 #4
0
 def announceRestrictedPickup(self, weapon, lastgive=-1):
    """
    Announces to the player the weapon is restricted
    """
    announce = int(cvar_announce)
    if announce == 2:
       es.tell(self.userid, '#multi', lang_text('restricted pick up', {'weapon':weapon}, playerlib.getPlayer(self.userid).get('lang')))
    elif announce:
       es.cexec(self.userid, 'echo ' + self.__removeTags(lang_text('restricted pick up', {'weapon':weapon}, playerlib.getPlayer(self.userid).get('lang'))))
예제 #5
0
 def announceRestrictedPickup(self, weapon, lastgive=-1):
     """
   Announces to the player the weapon is restricted
   """
     announce = int(cvar_announce)
     if announce == 2:
         es.tell(
             self.userid, '#multi',
             lang_text('restricted pick up', {'weapon': weapon},
                       playerlib.getPlayer(self.userid).get('lang')))
     elif announce:
         es.cexec(
             self.userid, 'echo ' + self.__removeTags(
                 lang_text('restricted pick up', {'weapon': weapon},
                           playerlib.getPlayer(self.userid).get('lang'))))
예제 #6
0
def player_spawn(ev):
    PlayerP = playerlib.getPlayer(ev['userid'])
    if (ev['es_userteam'] == "2"):
        es.setplayerprop(ev['userid'], "CBasePlayer.m_iHealth", 4000)
        es.setplayerprop(ev['userid'],
                         "CBasePlayer.localdata.m_flLaggedMovementValue", 1.2)
        es.server.queuecmd("es_xgive %s %s" %
                           (ev['userid'], "player_weaponstrip"))
        es.server.queuecmd("es_xfire %s player_weaponstrip strip" %
                           (ev['userid']))
        es.server.queuecmd("es_xfire %s player_weaponstrip kill" %
                           (ev['userid']))
        es.server.queuecmd("es_xgive %s %s" % (ev['userid'], "weapon_knife"))
    if (ev['es_userteam'] == "3"):
        es.setplayerprop(ev['userid'], "CBasePlayer.m_iHealth", 100)
        es.cexec(ev['userid'], "play vo/npc/male01/zombies01.wav")
        ammo(ev['userid'])
예제 #7
0
def round_end(event_var):
    '''Fired every time a round is ending...'''
    
    # Loop through all players...
    for userid in es.getUseridList():
        
        # Is the player death?
        if es.getplayerprop(userid, 'CBasePlayer.pl.deadflag'):
            
            # No need to go further...
            continue
            
        # Undrug the player...
        es.cexec(userid, 'r_screenoverlay off')
        
    # Cancel the delays...
    gamethread.cancelDelayed('_wcs_delay')
예제 #8
0
 def announceRestrictedPickup(self, weapon, lastgive=-1):
     """
   Announces to the player the weapon is restricted
   """
     announce = int(cvar_announce)
     if announce == 2:
         es.tell(
             self.userid,
             "#multi",
             lang_text("restricted pick up", {"weapon": weapon}, playerlib.getPlayer(self.userid).get("lang")),
         )
     elif announce:
         es.cexec(
             self.userid,
             "echo "
             + self.__removeTags(
                 lang_text("restricted pick up", {"weapon": weapon}, playerlib.getPlayer(self.userid).get("lang"))
             ),
         )
예제 #9
0
    def removeWeapon(self, weapon):
        """
      Executes "lastinv" on the client if the weapon to remove is the player's active weapon
      Removes the weapon by index
      Creates a new weapon at the player's feet if necessary
      Announces the restricted pickup
      """
        longname = 'weapon_' + weapon
        xarestrict.logging.log("Weapon %s has been removed from user %s" %
                               (weapon, es.getplayername(self.userid)))
        if es.createplayerlist(self.userid)[self.userid]['weapon'] == longname:
            es.cexec(self.userid, 'lastinv')

        for index in es.createentitylist(longname):
            if es.getindexprop(x, 'CBaseEntity.m_hOwnerEntity') <> self.handle:
                continue

            gamethread.delayedname(0.2, 'saferemove_%s' % index, saferemove,
                                   index)

            if (getTeam(2).isRestricted(weapon)
                    and getTeam(3).isRestricted(weapon)
                ) if int(removebanned) else False:
                lastgive = -1

            else:
                eye_angles = tuple(
                    es.getplayerprop(self.userid, eyeangle_prop % x)
                    for x in range(3))
                es.server.cmd('es_xsetang %s 90 0 0' % self.userid)

                es.server.cmd('es_xentcreate %s %s' % (self.userid, longname))
                lastgive = int(es.ServerVar('eventscripts_lastgive'))
                setNPCWeapon(longname)

                es.server.cmd('es_xsetang %s %s %s %s' %
                              ((self.userid, ) + eye_angles))

            self.announceRestrictedPickup(weapon, lastgive)

            break
예제 #10
0
def thanks(userid, args):
    msg(userid, 'CheckConsole')
    es.cexec(userid, 'echo [GG Thanks] ')

    # Loop through the credits
    for x in credits:

        # Print category
        es.cexec(userid, 'echo [GG Thanks] %s:' % (x))

        # Show all in this category
        for y in credits[x]:
            es.cexec(userid, 'echo [GG Thanks] \t%s' % y)

        es.cexec(userid, 'echo [GG Thanks] ')
예제 #11
0
def thanks(userid, args):
    msg(userid, 'CheckConsole')
    es.cexec(userid, 'echo [GG Thanks] ')

    # Loop through the credits
    for x in credits:

        # Print category
        es.cexec(userid, 'echo [GG Thanks] %s:' % (x))

        # Show all in this category
        for y in credits[x]:
            es.cexec(userid, 'echo [GG Thanks] \t%s' % y)

        es.cexec(userid, 'echo [GG Thanks] ')
예제 #12
0
def drug(users, lifetime=0):
    '''Drug a player for the given time...'''
    
    # Loop through all matching players...
    for userid in _get_matching_players(users):
        
        # Is the player a bot?
        if es.isbot(userid):
            
            # Don't go further...
            continue
            
        # Drug the player...
        es.cexec(userid, 'r_screenoverlay effects/tp_eyefx/tp_eyefx')
        
        # Is there any time given?
        if not lifetime:
            
            # Don't go further...
            continue
            
        # Undrug the player after the given time...
        gamethread.delayedname(
            lifetime, '_wcs_delay', es.cexec, (userid, 'r_screenoverlay off'))
예제 #13
0
def deleteAdvert(args, userid=None):
   if not args:
      if userid:
         es.cexec(userid, 'echo Syntax: delete_advert <partial advert>') 
      else:
         print('Syntax: delete_advert <partial advert>')
      return
   global adverts
   args = str(args)
   for ad in new_adverts:
      if args in ad:
         new_adverts.remove(ad)
         ad_split = ad.split('|', 1)
         if len(ad_split) == 2:
            pure_ad = ad_split[1]
         else:
            pure_ad = ad_split[0]
         if userid:
            es.cexec(userid, "echo Deleted the advert: --%s--" %pure_ad) 
         else:
            print('Deleted the advert: "%s"' %pure_ad)
         adverts = cycle(new_adverts)
         with CFG_ADVERTS_PATH.open('r') as file:
            lines = file.readlines()
         with CFG_ADVERTS_PATH.open('w') as file:
            for line in lines:
               if not line.startswith('//'):
                  line_split = line.replace('\n', '').split('|', 1)
                  if len(line_split) == 2:
                     line = line_split[1]
                  else:
                     line = line_split[0]
               if line != pure_ad:
                  if line.endswith('\n'):
                     file.write(line)
                  else:
                     file.write(line + '\n')
         if new_adverts:
            adverts = cycle(new_adverts)
         else:
            adverts = None
         break
   else:
      if userid:
         es.cexec(userid, "echo No advert found") 
      else:
         print('No advert found')
예제 #14
0
def es_client_command(event_var):
    if (str(event_var['command']) == '!hunter_bomb_timer_ver') or (str(event_var['command']) == '!hunter_all_ver'):
        es.cexec(int(event_var['userid']), 'echo '+hunter_bomb_timer_text)
예제 #15
0
def es_client_command(event_var):
    if (str(event_var['command']) == '!hunter_bomb_timer_ver') or (str(
            event_var['command']) == '!hunter_all_ver'):
        es.cexec(int(event_var['userid']), 'echo ' + hunter_bomb_timer_text)
예제 #16
0
def player_death(event_var):
    '''Fired every time a player is dying...'''
    
    # Undrug the player...
    es.cexec(event_var['userid'], 'r_screenoverlay off')
예제 #17
0
def _player_spawn(ev):
	userid = int(ev['userid'])
	es.cexec(userid, 'r_screenoverlay off')
	es.setplayerprop(userid, 'CBasePlayer.m_iDefaultFOV', 90)
	es.setplayerprop(userid, 'CBasePlayer.m_iFOV', 90)
예제 #18
0
def changename(userid, newName):
    if es.exists("userid",userid) == 0:
        echo("[UltiTool] %s is not a valid userid!" % userid)
    else:
        es.cexec(userid,"name %s" % newName)
예제 #19
0
def es_client_command(event_var):
    if (str(event_var['command']) == '!hunter_quake_sounds_ver') or (str(event_var['command']) == '!hunter_all_ver'):
        es.cexec(int(event_var['userid']), 'echo '+hunter_quake_sounds_text)
    _check_event(event_var)
예제 #20
0
def cexec(argv):
    es.cexec(*argv)
예제 #21
0
def es_client_command(event_var):
    if (str(event_var['command']) == '!hunter_quake_sounds_ver') or (str(
            event_var['command']) == '!hunter_all_ver'):
        es.cexec(int(event_var['userid']), 'echo ' + hunter_quake_sounds_text)
    _check_event(event_var)
예제 #22
0
def cexec(argv):
  es.cexec(*argv)
예제 #23
0
def trikz_menu_select(userid, choice, popupid):
    steamid = es.getplayersteamid(userid)
    player = playerlib.getPlayer(userid)
    timer = es.import_addon("queue_timer/plugins/timer")
    """
    if int(choice) == 1:
        if player.getFB() in (0, 1):
            client[steamid]['auto_flash'] = "On"
            esc.tell(userid, '#124,252,0[ Trikz] #snowYou got a #yellowrefill #245,61,0flash')
        trikz_menu(userid)

    if int(choice) == 1:
        if not client[steamid]['auto_flash'] == "On":
            client[steamid]['auto_flash'] = "On"
            auto_switch(userid)
            esc.tell(userid, '#124,252,0[ Trikz] #245,61,0AutoFlash#snow is now #yellowON')
        else:
            client[steamid]['auto_flash'] = "Off"
            auto_switch(userid)
            esc.tell(userid, '#124,252,0[ Trikz] #245,61,0AutoFlash#snow is now #yellowOFF')
        trikz_menu(userid)
    """
    if int(choice) == 1:
        if not client[steamid]['auto_switch'] == "On":
            client[steamid]['auto_switch'] = "On"
            esc.tell(userid, '#124,252,0[ Trikz] #245,61,0AutoSwitch#snow is now #yellowON')
        else:
            client[steamid]['auto_switch'] = "Off"
            esc.tell(userid, '#124,252,0[ Trikz] #245,61,0AutoSwitch#snow is now #yellowOFF')
        trikz_menu(userid)

    if int(choice) == 2:
        if not client[steamid]['auto_jump'] == "On":
            client[steamid]['auto_jump'] = "On"
            es.cexec(userid, 'sm_%s' % "autojump")

        else:
            client[steamid]['auto_jump'] = "Off"
            es.cexec(userid, 'sm_%s' % "autojump")
        trikz_menu(userid)

    if int(choice) == 3:

        if client[steamid]['auto_stuck'] == "Off":
            esc.tell(userid,
                     '#124,252,0[Trikz] #245,61,0Anti-Stuck #snowis now #yellowON')
            client[steamid]['auto_stuck'] = "On"
            gamethread.cancelDelayed("auto_stuck_%s" % userid)
            auto_stuck(userid)
        else:
            esc.tell(userid,
                     '#124,252,0[ Trikz] #245,61,0Anti-Stuck #snowis now #yellowOFF #255,0,0(NOT Recommended)')
            client[steamid]['auto_stuck'] = "Off"
            gamethread.cancelDelayed("auto_stuck_%s" % userid)
        trikz_menu(userid)

    if int(choice) == 4:
        toggle(userid)
        trikz_menu(userid)

    if int(choice) == 5:
        cp_menu(userid)

    if int(choice) == 6:
        es.cexec(userid, 'sm_delay')