Example #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
Example #2
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
Example #3
0
def clientFilter(userid, args):
    if args[0].lower() == 'drop':
        weapon = es.createplayerlist(userid)[userid]['weapon']
        if weapon not in ('weapon_knife', 'weapon_flashbang', 'weapon_smokegrenade', 'weapon_hegrenade'):
            if weapon in weaponlib.getWeaponList('#primary'):
                del weaponList[int(userid)]['primary']
            elif weapon in weaponlib.getWeaponList('#secondary'):
                del weaponList[int(userid)]['secondary']  
    return True
def tracker(userid, info = None):
    if es.exists('userid',userid):
        ping = es.createplayerlist(userid)[int(userid)]['ping']
        if maxping and ping >= int(maxping):
            gInfo[userid]+=1
        if exceedlimit and gInfo[userid] >= int(exceedlimit):
            slowguy = playerlib.getPlayer(userid)
            slowguy.kick(reason=text('kick', {}, slowguy.get('lang')))
    elif info is not None:
        info[0].delete()
Example #5
0
def tracker(userid, info=None):
    if es.exists('userid', userid):
        ping = es.createplayerlist(userid)[int(userid)]['ping']
        if maxping and ping >= int(maxping):
            gInfo[userid] += 1
        if exceedlimit and gInfo[userid] >= int(exceedlimit):
            slowguy = playerlib.getPlayer(userid)
            slowguy.kick(reason=text('kick', {}, slowguy.get('lang')))
    elif info is not None:
        info[0].delete()
Example #6
0
def checkplayer(uid):
    '''
    Checks if a player is ghosting and blinds them if so (does not test bots)
    '''
    if not es.isbot(uid):
        if str(uid).isdigit():
            uid = int(uid)
        else:
            return False
        plist = es.createplayerlist()
        if uid not in plist:
            return False
        uip   = plist[uid]["address"]   
        for userid in plist:
            if not userid == int(uid) and plist[userid]["address"]== uip: 
                return True
    return False
def checkplayer(uid):
    '''
    Checks if a player is ghosting and blinds them if so (does not test bots)
    '''
    if not es.isbot(uid):
        if str(uid).isdigit():
            uid = int(uid)
        else:
            return False
        plist = es.createplayerlist()
        if uid not in plist:
            return False
        uip = plist[uid]["address"]
        for userid in plist:
            if not userid == int(uid) and plist[userid]["address"] == uip:
                return True
    return False
Example #8
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
Example #9
0
def createplayerlist(argv):
  dict_to_keyvalues(argv[0], es.createplayerlist(*argv[1:]))
Example #10
0
 def update_attributes(self):
     """Update the cached attribute values for the player."""
     self._attributes = es.createplayerlist(self.user_ID)[self.user_ID]
Example #11
0
 def update_attributes(self):
     """Update the cached attribute values for the player."""
     self._attributes = es.createplayerlist(self.user_ID)[self.user_ID]