示例#1
0
def smokegrenade_detonate(ev): 
    userid = ev['userid']
    level = playerlist[userid].GetSkillLevel(skillname)
    if level > 0:
        team = int(ev['es_userteam'])
        save = (float(ev['x']), float(ev['y']), float(ev['z']), team, level) 
        nades.append(save)
        gamethread.delayed(19.0, rpg_remove_poison, (save,))
        
        # Make the smoke colourfull
        index = es.createentity("light_dynamic","mylight%s" % userid)
        es.entitysetvalue(index, "angles", "-90 0 0")
        if team == 3:
            es.entitysetvalue(index,"_light", "0 0 255")
        elif team == 2:
            es.entitysetvalue(index,"_light", "255 0 0")
        es.entitysetvalue(index, "_inner_cone","-89")
        es.entitysetvalue(index, "_cone","-89")
        es.entitysetvalue(index, "pitch","-90")
        es.entitysetvalue(index, "distance","256")
        es.entitysetvalue(index, "spotlight_radius","96")
        es.entitysetvalue(index, "origin","%s %s %s"% (ev['x'], ev['y'], ev['z']))
        es.entitysetvalue(index, "brightness","5")
        es.entitysetvalue(index, "style","6")
        es.entitysetvalue(index, "spawnflags","1")
        es.spawnentity(index)
        gamethread.delayed(20.0, es.remove, index)
        es.server.queuecmd('es_xfire %s mylight%s DisableShadow' % (userid,userid))
        es.server.queuecmd('es_xfire %s mylight%s addoutput "OnUser1 !self,kill,-1,24"' %  (userid,userid))
        es.server.queuecmd('es_xfire %s mylight%s addoutput "OnUser2 !self,Toggle,-1,21"' %  (userid,userid))
        es.server.queuecmd('es_xfire %s mylight%s addoutput "OnUser3 !self,TurnOff,-1,23"' %  (userid,userid))
        es.server.queuecmd('es_xfire %s mylight%s addoutput "OnUser4 !self,spawnflags,3,19"' %  (userid,userid))            
示例#2
0
def make_blood(userid, color=0, amount=5, spawnflags=1, randomdir=1, headshot=1, valueat=0):
    index = es.createentity("env_blood")
    if spawnflags == 1:
        if headshot:
            es.entitysetvalue(index, "spawnflags", 4|8|40)
        else:
            es.entitysetvalue(index, "spawnflags", 8|40)
    elif spawnflags == 2:
        if headshot:
            es.entitysetvalue(index, "spawnflags", 4|8|20|40)
        else:
            es.entitysetvalue(index, "spawnflags", 8|20|40)
    es.entitysetvalue(index, "amount", amount)
    es.entitysetvalue(index, "color", color)
    if headshot:
        x,y,z = geteyelocation(userid)
    else:
        x,y,z = es.getplayerlocation(userid)
        z += random.randint(20,60)
    if randomdir == 1:
        if valueat > 0:
            vx,vy,vz = playerlib.getPlayer(valueat).viewVector()
            es.entitysetvalue(index, "spraydir", "%s %s %s" %(vx, vy, vz))
        else:
            es.entitysetvalue(index, "spraydir", "%s %s %s" %(random.randint(-90, 90), random.randint(-90, 90), random.randint(-90, 90)))
    es.entitysetvalue(index, "origin", "%s %s %s" %(x, y, z))
    es.entitysetvalue(index, "classname", "env_blood_%s" %(index))
    es.fire(userid, "env_blood_%s" %(index), "emitblood")
    es.fire(userid, "env_blood_%s" %(index), "kill")
	def Overlay(self):
		index = es.createentity('env_screenoverlay')
		es.setentityname(index,self.NAME)
		es.entitysetvalue(index,'OverlayTime1',self.duration)
		es.entitysetvalue(index,'OverlayName1',str(self.path))
		es.spawnentity(index)
		gamethread.queue(es.fire,(es.getUseridList()[0],self.NAME,'StartOverlays'))
		gamethread.delayed(self.duration,self.Shutdown,())
示例#4
0
文件: Damage.py 项目: dretax/MeowRPG
def rpg_damage(userid, damage, attacker, weapon):
    player = playerlib.getPlayer(userid)
    index = es.createentity('point_hurt')
    es.entitysetvalue(index, 'targetname', index)
    es.entitysetvalue(index, 'damage', damage)
    es.entitysetvalue(index, 'damagetype', 2)
    es.entitysetvalue(index, 'classname', weapon)
    targetname = es.entitygetvalue(player.index, 'targetname')
    es.entitysetvalue(player.index, 'targetname', player)
    es.fire(attacker, index, 'addoutput', 'damagetarget %s' % (userid))
    es.fire(attacker, index, 'hurt')
    es.fire(userid, '!self', 'addoutput', 'targetname %s' % (targetname))
    es.fire(userid, index, 'kill')
def color_correct(path,userid):
	#Constructer for Color Correction
	NAME = str("BLUEZM_COLOR_CORRECT")
	index = es.createentity('color_correction')
	es.setentityname(index,NAME)
	es.entitysetvalue(index,'fadeInDuration',0.1)
	es.entitysetvalue(index,'StartDisabled',1)
	es.entitysetvalue(index,'fadeOutDuration',0.1)
	es.entitysetvalue(index,'minfalloff',0)
	es.entitysetvalue(index,'maxfalloff',-1)
	es.entitysetvalue(index,'filename',str(path))
	es.entitysetvalue(index,'maxweight',.6)
	es.spawnentity(index)
	gamethread.delayed(2,es.fire,(userid,NAME,'enable'))
	Msg("Color Correction Enabled")
示例#6
0
def OnTick():
    for i in amounts:
        if i not in parachuted and not es.getplayerprop(i, "CBasePlayer.pl.deadflag") and spe.getLocVal("i", spe.getPlayer(i) + buttonPressedOffset) & 32 and es.getplayerprop(i, "CBasePlayer.localdata.m_Local.m_flFallVelocity") >= 1.0 and amounts[i] > 0:
            index = es.createentity("prop_dynamic_override")
            parachuted[i] = index
            es.entitysetvalue(index, "solid", 0)
            es.entitysetvalue(index, "model", random.choice(rpgParachuteModels))
            es.server.insertcmd("es_xspawnentity %i" % index)
            amounts[i] -= 1             
    for i in parachuted.copy():
        if not es.exists("userid", i) or es.getplayerprop(i, "CBasePlayer.pl.deadflag") or es.getplayerprop(i, "CBasePlayer.localdata.m_hGroundEntity") != -1 or es.getplayerprop(i, "CBasePlayer.localdata.m_nWaterLevel") > 1 or not spe.getLocVal("i", spe.getPlayer(i) + buttonPressedOffset) & 32:
            spe.removeEntityByIndex(parachuted[i])
            del parachuted[i]
        else:
            es.entitysetvalue(parachuted[i], "angles", "0 %f 0" % es.getplayerprop(i, "CCSPlayer.m_angEyeAngles[1]"))
            es.entitysetvalue(parachuted[i], "origin", es.getplayerprop(i, "CBaseEntity.m_vecOrigin").replace(",", " "))
            es.setplayerprop(i, "CBasePlayer.localdata.m_vecBaseVelocity", "0,0,%f" % es.getplayerprop(i, "CBasePlayer.localdata.m_Local.m_flFallVelocity"))
示例#7
0
def smokegrenade_detonate(ev):
    userid = ev['userid']
    level = playerlist[userid].GetSkillLevel(skillname)
    if level > 0:
        team = int(ev['es_userteam'])
        save = (float(ev['x']), float(ev['y']), float(ev['z']), team, level)
        nades.append(save)
        gamethread.delayed(19.0, rpg_remove_poison, (save, ))

        # Make the smoke colourfull
        index = es.createentity("light_dynamic", "mylight%s" % userid)
        es.entitysetvalue(index, "angles", "-90 0 0")
        if team == 3:
            es.entitysetvalue(index, "_light", "0 0 255")
        elif team == 2:
            es.entitysetvalue(index, "_light", "255 0 0")
        es.entitysetvalue(index, "_inner_cone", "-89")
        es.entitysetvalue(index, "_cone", "-89")
        es.entitysetvalue(index, "pitch", "-90")
        es.entitysetvalue(index, "distance", "256")
        es.entitysetvalue(index, "spotlight_radius", "96")
        es.entitysetvalue(index, "origin",
                          "%s %s %s" % (ev['x'], ev['y'], ev['z']))
        es.entitysetvalue(index, "brightness", "5")
        es.entitysetvalue(index, "style", "6")
        es.entitysetvalue(index, "spawnflags", "1")
        es.spawnentity(index)
        gamethread.delayed(20.0, es.remove, index)
        es.server.queuecmd('es_xfire %s mylight%s DisableShadow' %
                           (userid, userid))
        es.server.queuecmd(
            'es_xfire %s mylight%s addoutput "OnUser1 !self,kill,-1,24"' %
            (userid, userid))
        es.server.queuecmd(
            'es_xfire %s mylight%s addoutput "OnUser2 !self,Toggle,-1,21"' %
            (userid, userid))
        es.server.queuecmd(
            'es_xfire %s mylight%s addoutput "OnUser3 !self,TurnOff,-1,23"' %
            (userid, userid))
        es.server.queuecmd(
            'es_xfire %s mylight%s addoutput "OnUser4 !self,spawnflags,3,19"' %
            (userid, userid))
示例#8
0
def make_blood(userid,
               color=0,
               amount=5,
               spawnflags=1,
               randomdir=1,
               headshot=1,
               valueat=0):
    index = es.createentity("env_blood")
    if spawnflags == 1:
        if headshot:
            es.entitysetvalue(index, "spawnflags", 4 | 8 | 40)
        else:
            es.entitysetvalue(index, "spawnflags", 8 | 40)
    elif spawnflags == 2:
        if headshot:
            es.entitysetvalue(index, "spawnflags", 4 | 8 | 20 | 40)
        else:
            es.entitysetvalue(index, "spawnflags", 8 | 20 | 40)
    es.entitysetvalue(index, "amount", amount)
    es.entitysetvalue(index, "color", color)
    if headshot:
        x, y, z = geteyelocation(userid)
    else:
        x, y, z = es.getplayerlocation(userid)
        z += random.randint(20, 60)
    if randomdir == 1:
        if valueat > 0:
            vx, vy, vz = playerlib.getPlayer(valueat).viewVector()
            es.entitysetvalue(index, "spraydir", "%s %s %s" % (vx, vy, vz))
        else:
            es.entitysetvalue(
                index, "spraydir",
                "%s %s %s" % (random.randint(-90, 90), random.randint(
                    -90, 90), random.randint(-90, 90)))
    es.entitysetvalue(index, "origin", "%s %s %s" % (x, y, z))
    es.entitysetvalue(index, "classname", "env_blood_%s" % (index))
    es.fire(userid, "env_blood_%s" % (index), "emitblood")
    es.fire(userid, "env_blood_%s" % (index), "kill")
示例#9
0
def createentity(argv):
    sv['eventscripts_lastgive'] = es.createentity(*argv)
示例#10
0
def damage(users, _damage, attacker=None, armor=False, weapon=None):
    '''Damage a player...'''
    
    # Is there no player on the server?
    if not es.getplayercount():
        
        # Don't go further...
        return
        
    # Create a 'point_hurt' entity...
    index = es.createentity('point_hurt')
    
    # Set the entity name...
    es.setentityname(index, index)
    
    # Does we need to apply damage on the player's armor?
    if armor:
        
        # Set the damage type to fall...
        es.entitysetvalue(index, 'damagetype', 32)
        
    # Is any weapon specified?
    if weapon:
        
        # Set the classname to the given weapon...
        es.entitysetvalue(index, 'classname', weapon)
        
    # Set the given damage...
    es.entitysetvalue(index, 'damage', _damage)
    
    # Loop through all matching players...
    for userid in _get_matching_players(users):
        
        # Is the player dead?
        if es.getplayerprop(userid, 'CBasePlayer.pl.deadflag'):
            
            # Don't go further...
            continue
            
        # Is the given damage need to be the player health?
        if _damage == '#health':
            
            # Set the damage to the player health...
            es.entitysetvalue(index, 'damage',
                es.getplayerprop(userid, 'CBasePlayer.m_iHealth'))
                
        # Get the player index...
        player_index = es.getindexfromhandle(es.getplayerhandle(userid))
        
        # Store the actual player name...
        targetname = es.entitygetvalue(index, 'targetname')
        
        # Set the player name to his index...
        es.setentityname(player_index, player_index)
        
        # Set the damage target...
        es.entitysetvalue(index, 'damagetarget', player_index)
        
        # Is there's no attacker?
        if not attacker:
            
            # Damage the player...
            es.fire(userid, index, 'Hurt')
            
        # Otherwise...
        else:
            
            # Damage the player...
            es.fire(attacker, index, 'Hurt')
            
        # Set back the player name...
        es.fire(userid, player_index, 'AddOutput', 'targetname %s' % targetname)
        
    # Remove the entity later...
    gamethread.delayedname(0.5, '_wcs_delay', _remove_entity, index)
示例#11
0
def getgametime():
   index = es.createentity("env_particlesmokegrenade")
   gametime = es.getindexprop(index, "ParticleSmokeGrenade.m_flSpawnTime")
   spe.removeEntityByIndex(index)
   return gametime
示例#12
0
def createentity(argv):
  sv['eventscripts_lastgive'] = es.createentity(*argv)
示例#13
0
def getgametime():
    index = es.createentity("env_particlesmokegrenade")
    gametime = es.getindexprop(index, "ParticleSmokeGrenade.m_flSpawnTime")
    spe.removeEntityByIndex(index)
    return gametime