Exemplo n.º 1
0
    def __init__(self, userid, weaponslist):
        if playerlib.getPlayer(userid).isbot:
            es.give(userid, "weapon_" + weaponslist[0])
            return None

        if len(weaponslist) == 1:
            es.give(userid, "weapon_" + weaponslist[0])
            return None

        self.userid = userid
        self.weaponslist = weaponslist
        menuid = random.randint(0, 1000)
        if es.exists("popup", "ultilib_weaponmenu%d" % menuid):
            popuplib.delete("ultilib_weaponmenu%d" % menuid)

        weaponMenu = popuplib.create("ultilib_weaponmenu%d" % menuid)
        weaponMenu.addline("Choose a weapon:")
        weaponMenu.addline(" ")
        if len(self.weaponslist) < 9:
            for i in range(0, len(self.weaponslist)):
                weaponMenu.addline("->%d. %s" % (i + 1, self.weaponslist[i]))
        else:
            for i in range(0, 9):
                weaponMenu.addline("->%d. %s" % (i + 1, self.weaponslist[i]))

        weaponMenu.addline(" ")
        weaponMenu.addline("0. Cancel")
        weaponMenu.menuselect = self.select

        popuplib.send("ultilib_weaponmenu%d" % menuid, userid)
Exemplo n.º 2
0
def giveWeapon(userid, weapon):
    """
    Gives a player a named weapon. The reason we have a custom function for
    this is so we can alter the method.
    
    @param int userd The ID of the user
    @param str weapon The Weapon name to give to the player
    """
    es.give(userid, weapon)
Exemplo n.º 3
0
 def replacePrimaryWeapon(self, prim_wep):
     """Replace the primary weapon
     prim_wep - the name of a primary weapon"""
     validwep = tuple(weaponlib.getWeaponList("#primary"))
     if prim_wep not in validwep:
         raise TypeError("You must have a valid weapon to switch a secondary weapon")
     else:
         currentprim = self.getPrimary()
         if currentprim:
             if currentprim == prim_wep:
                 return
             self.removePrimary()
         es.give(self.userid, prim_wep)
Exemplo n.º 4
0
 def replaceSecondaryWeapon(self, sec_wep):
     """Replace the secondary weapon
     sec_wep - the name of a secondary weapon"""
     validwep = ("weapon_glock", "weapon_usp", "weapon_p228", "weapon_deagle", "weapon_elite", "weapon_fiveseven")
     if sec_wep not in validwep:
         raise TypeError("You must have a valid weapon to switch a secondary weapon")
     else:
         currentsec = self.getSecondary()
         if currentsec:
             if currentsec == sec_wep:
                 return
             self.removeSecondary()
         es.give(self.userid, sec_wep)
Exemplo n.º 5
0
 def prepare(self, match):
     """ prepares the player for a match """
     self.switchTeam(int(es.ServerVar("uam_vipteam")))
     self.removePrimary()
     self.replaceSecondaryWeapon("weapon_deagle")
     ultilib.WeaponSelectionMenu(self.userid, GuardWeapons)
     self.resetColor()
     es.give(self.userid, "item_assaultsuit")
     self.health = es.ServerVar("uam_guardhealth")
     self.nightvision = 1
     self.giveSmoke(1)
     self.giveFlash(2)
     self.giveHE(1)
     es.centertell(self.userid, "You're a guard! Protect %s! Kill %s!" % (match.vip.name, match.assassin.name))
Exemplo n.º 6
0
 def prepare(self, match):
     """ prepares the player for a match """
     self.switchTeam(int(es.ServerVar("uam_vipteam")))
     self.removePrimary()
     self.setColor(0, 255, 255, 255)
     self.replaceSecondaryWeapon("weapon_deagle")
     es.give(self.userid, "item_assaultsuit")
     self.armor = 150
     self.health = es.ServerVar("uam_viphealth")
     self.nightvision = 1
     self.giveSmoke(1)
     self.giveFlash(0)
     self.giveHE(0)
     self.setSpeed(1.2)
     es.centertell(self.userid, "You're the VIP. Survive at all cost. The assassin is %s." % match.assassin.name)
     es.dbgmsg(0, "The VIP id is %s" % self.userid)
Exemplo n.º 7
0
def player_hurt(ev):
	userid = ev['userid']
	if superhero.hasHero(userid,'Magneto'):
		attacker = ev['attacker']
		weapon = ev['weapon']
		weapon = 'weapon_%s'%weapon
		dice = random.randint(1,1)
		if dice == 1:
			if not weapon in ['weapon_glock','weapon_usp','weapon_p228','weapon_fiveseven','weapon_deagle','weapon_elite','weapon_knife','weapon_flashbang','weapon_hegrenade','weapon_smokegrenade']:
				wep_remove(attacker)
				for wep in ['weapon_glock','weapon_usp','weapon_p228','weapon_fiveseven','weapon_deagle','weapon_elite']:
					es.sexec(attacker, 'use %s'%wep)
				if ev['health'] > 0:
					if ev['es_userweapon'] in ['weapon_glock','weapon_usp','weapon_p228','weapon_fiveseven','weapon_deagle','weapon_elite','weapon_knife','weapon_flashbang','weapon_hegrenade','weapon_smokegrenade']:
						es.give(userid, weapon)
						es.tell(userid, '#multi', '#green[SH]#lightgreen You have taken#green',ev['es_attackername'],'#lightgreenprimary weapon')
				es.tell(attacker, '#multi', '#green[SH]#lightgreen Magneto has taken your primary weapon')
Exemplo n.º 8
0
 def prepare(self):
     if int(es.ServerVar("uz_select")):
         ultilib.WeaponSelectionMenu(self.userid, weaponsToGive)
     else:
         for weapon in weaponsToGive:
             es.give(self.userid, "weapon_%s" % weapon)
             
     if self.teamid == 3:
         self.defuser = 1
     
     if int(es.ServerVar("uz_grenade")) > 0:
         self.giveHE(1)
         
     self.nightvision = 1
     es.give(self.userid, "item_assaultsuit")
     self.health = int(es.ServerVar("uz_humanhealth"))
     self.cash = 16000
Exemplo n.º 9
0
 def prepare(self, match):
     """ prepares the player for a match """
     self.switchTeam(int(es.ServerVar("uam_assassinteam")))
     self.removePrimary()
     self.setColor(0, 0, 0, AssassinAlpha)
     self.replaceSecondaryWeapon("weapon_deagle")
     es.give(self.userid, "item_assaultsuit")
     self.armor = 150
     self.health = es.ServerVar("uam_assassinhealth")
     self.nightvision = 1
     self.giveSmoke(2)
     self.giveFlash(3)
     self.giveHE(2)
     self.setSpeed(0.8)
     ultilib.WeaponSelectionMenu(self.userid, AssassinWeapons)
     es.centertell(self.userid, "You're the Assassin. Kill %s!" % match.vip.name)
     es.dbgmsg(0, "The Assassin id is %s" % self.userid)
Exemplo n.º 10
0
def player_hurt(ev):
    userid = ev['userid']
    if superhero.hasHero(userid, 'Magneto'):
        attacker = ev['attacker']
        weapon = ev['weapon']
        weapon = 'weapon_%s' % weapon
        dice = random.randint(1, 1)
        if dice == 1:
            if not weapon in [
                    'weapon_glock', 'weapon_usp', 'weapon_p228',
                    'weapon_fiveseven', 'weapon_deagle', 'weapon_elite',
                    'weapon_knife', 'weapon_flashbang', 'weapon_hegrenade',
                    'weapon_smokegrenade'
            ]:
                wep_remove(attacker)
                for wep in [
                        'weapon_glock', 'weapon_usp', 'weapon_p228',
                        'weapon_fiveseven', 'weapon_deagle', 'weapon_elite'
                ]:
                    es.sexec(attacker, 'use %s' % wep)
                if ev['health'] > 0:
                    if ev['es_userweapon'] in [
                            'weapon_glock', 'weapon_usp', 'weapon_p228',
                            'weapon_fiveseven', 'weapon_deagle',
                            'weapon_elite', 'weapon_knife', 'weapon_flashbang',
                            'weapon_hegrenade', 'weapon_smokegrenade'
                    ]:
                        es.give(userid, weapon)
                        es.tell(userid, '#multi',
                                '#green[SH]#lightgreen You have taken#green',
                                ev['es_attackername'],
                                '#lightgreenprimary weapon')
                es.tell(
                    attacker, '#multi',
                    '#green[SH]#lightgreen Magneto has taken your primary weapon'
                )
Exemplo n.º 11
0
 def giveSmoke(self, amount):
     """Gives smoke grenade to player
     amount - the amount of smoke grenade in integer"""
     self.sg = amount
     if amount > 0:
         es.give(self.userid, "weapon_smokegrenade")
Exemplo n.º 12
0
 def select(self, userid, choice, popupid):
     if choice < 11:
         es.give(userid, "weapon_" + self.weaponslist[choice - 1])
Exemplo n.º 13
0
 def giveFlash(self, amount):
     """Gives flash bang to player
     amount - the amount of flashbangs"""
     self.fb = amount
     if amount > 0:
         es.give(self.userid, "weapon_flashbang")
Exemplo n.º 14
0
def give(argv):
  es.give(*argv)
Exemplo n.º 15
0
def give(argv):
    sv.save()
    es.give(*argv)
Exemplo n.º 16
0
def give(argv):
    es.give(*argv)
Exemplo n.º 17
0
 def giveHE(self, amount):
     """Gives he grenade to player
     amount - the amount of he grenades"""
     self.he = amount
     if amount > 0:
         es.give(self.userid, "weapon_hegrenade")