def wcs_ulti_roots(): userid = int(es.ServerVar('wcs_userid')) count = 0 if es.getplayerteam(userid) >= 2: if playerlib.getUseridList('#alive'): usermsg.fade(userid, 0, 1, 1, 10, 55, 5, 200) x,y,z = es.getplayerlocation(userid) radius = float(es.ServerVar('wcs_radius')) time = float(es.ServerVar('wcs_freezetime')) for user in playerlib.getUseridList('#alive,#'+['ct','t'][es.getplayerteam(userid)-2]): x1,y1,z1 = es.getplayerlocation(user) if ((x1 - x) ** 2 + (y1 - y) ** 2 + (z1 - z) ** 2) ** 0.5 <= radius: #check for wall between... if not tools.wcsgroup.wcsgroup.getUser(user, 'ulti_immunity'): playerlib.getPlayer(user).freeze = 1 gamethread.delayed(time, reset, (user, 'freeze', 0)) count += 1 else: es.tell(user, '#multi', '#lightgreenYour ultimate was blocked, the enemy is #greenimmune.') es.tell(userid, '#multi', '#lightgreenYou #greenblocked #lightgreenan ultimate skill.') if count: es.centertell('Entangling Roots: %s' % (count)) else: es.tell(userid, '#multi','#lightgreenEntangling Roots #greenfailed#lightgreen, because no enemy is close enough.') es.server.queuecmd('es wcs_reset_cooldown %s' % (userid))
def wcs_ulti_chain(): userid = int(es.ServerVar('wcs_userid')) count = 0 if es.getplayerteam(userid) >= 2: if playerlib.getUseridList('#alive'): usermsg.fade(userid, 0, 2, 1, 240, 240, 240, 100) x,y,z = es.getplayerlocation(userid) radius = float(es.ServerVar('wcs_radius')) es.ServerVar('vector1').set(','.join(map(str, (x,y,z)))) for user in playerlib.getUseridList('#alive,#'+['ct','t'][es.getplayerteam(userid)-2]): x1,y1,z1 = es.getplayerlocation(user) if ((x1 - x) ** 2 + (y1 - y) ** 2 + (z1 - z) ** 2) ** 0.5 <= radius: #check for wall between... if not tools.wcsgroup.wcsgroup.getUser(user, 'ulti_immunity'): tools.expand.expand.damage(user, 32, userid) count += 1 if es.ServerVar('wcs_cfg_graphicfx'): es.server.insertcmd('es_xset vector2 '+','.join(map(str, (x1,y1,z1)))+';es_xdoblock wcs/addons/effect/ChainLightning') else: es.tell(user, '#multi', '#lightgreenYour ultimate was blocked, the enemy is #greenimmune.') es.tell(userid, '#multi', '#lightgreenYou #greenblocked #lightgreenan ultimate skill.') if count: es.centertell('Chain Lightning: %s players damaged' % (count)) else: es.tell(userid, '#multi', '#lightgreenChain Lightning #greenfailed#lightgreen, because no enemy is close enough to be damaged.') es.server.queuecmd('es wcs_reset_cooldown %s' % (userid))
def bloodmana(): if dice <= 30: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) effect.est_Effect(3, '#a', 0, 'sprites/yellowglow1.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 10, 10, 100, 255, 248, es.ServerVar('wcs_alpha'))
def healTeamates(self): """ This is the actual function which will get the current level, and loop through all team players and if their positions are within range increment their armor / health. """ x, y, z = es.getplayerlocation(self.userid) team = es.getplayerteam(self.userid) player = sourcerpg.players[self.userid] if team not in (2, 3): return if player is not None: level = player[skillName] if level: """ The user is at least level one in the medic skill """ distance = (int(minDistance) + (level - 1) * float(distanceInc)) healing = int(healingInc) * level armor = 0 for teamPlayer in filter( lambda x: es.getplayerteam(x) == team and not es. getplayerprop(x, 'CBasePlayer.pl.deadflag'), es.getUseridList()): """ Loop through all the living players on their team """ xx, yy, zz = es.getplayerlocation(teamPlayer) if ((x - xx)**2 + (y - yy)**2 + (z - zz)**2)**0.5 <= distance: health = es.getplayerprop(teamPlayer, 'CBasePlayer.m_iHealth') sourcerpgPlayer = sourcerpg.players[teamPlayer] if health < sourcerpgPlayer['maxHealth']: if health + healing > sourcerpgPlayer['maxHealth']: armor = sourcerpgPlayer[ 'maxHealth'] - health - healing es.setplayerprop(teamPlayer, 'CBasePlayer.m_iHealth', sourcerpgPlayer['maxHealth']) else: es.setplayerprop(teamPlayer, 'CBasePlayer.m_iHealth', healing + health) else: armor = healing if armor and self.gameName == "cstrike": """ if we're playing CSS and we have armor to increment, do the task """ maxArmor = sourcerpgPlayer['maxArmor'] currentArmor = es.getplayerprop( teamPlayer, 'CCSPlayer.m_ArmorValue') currentArmor += armor if currentArmor > maxArmor: currentArmor = maxArmor es.setplayerprop(teamPlayer, 'CCSPlayer.m_ArmorValue', currentArmor)
def bloodflame(): if dice <= 30: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) effect.est_Effect(3, '#a', 0, 'sprites/c4.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 15, 15, 251, 255, 100, es.ServerVar('wcs_alpha')) effect.est_Effect(3, '#a', 0, 'sprites/crystal_beam1.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 10, 10, 232, 111, 0, es.ServerVar('wcs_alpha'))
def hualianz(): if dice <= 60: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) effect.est_Effect(3, '#a', 0, 'sprites/cbbl_smoke.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 10, 10, 255, 255, 255, es.ServerVar('wcs_alpha')) effect.est_Effect(10, '#a', 0, 'sprites/cbbl_smoke.vmt', q[0], q[1], q[2] + 25, 1, 10, 0.5, 40, 500, 255, 255, 255, 255, 100, 255)
def orc(): if dice <= 15: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) effect.est_Effect(3, '#a', 0, 'sprites/plasma.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 10, 10, 0, 255, 0, es.ServerVar('wcs_alpha')) effect.est_Effect(3, '#a', 0, 'sprites/heatwave.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 1, 1, 0, 255, 0, es.ServerVar('wcs_alpha'))
def bloodban(): if dice <= 30: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) effect.est_Effect(3, '#a', 0, 'sprites/xbeam2.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 10, 10, 199, 255, 248, es.ServerVar('wcs_alpha')) effect.est_Effect(3, '#a', 0, 'sprites/hydraspinalcord.vmt', v[0], v[1], v[2] + 20, q[0], q[1], q[2] + 20, 0.5, 6, 6, 111, 244, 157, es.ServerVar('wcs_alpha'))
def _count_down(amount, bombType, userid): if amount: es.centermsg(amount) amount -= 1 gamethread.delayedname(1, '%s_%s' % (bombType, userid), _count_down, (amount, bombType, userid)) es.emitsound('player', userid, xa_adminbomb_sound, '1.0', '0.7') r, g, b, a = str(xa_adminbomb_beaconcolor).split() location = es.getplayerlocation(userid) effectlib.drawCircle(location, 150, steps=50, model="materials/sprites/laser.vmt", seconds=0.2, width=20, endwidth=10, red=r, green=g, blue=b, brightness=a, speed=70) elif bombType == "timebomb": for index in es.createentitylist('env_explosion'): es.server.cmd('es_xremove %s' % index) es.server.cmd('es_xgive %s env_explosion' % userid) es.server.cmd('es_xfire %s env_explosion addoutput "imagnitude 300"' % userid) es.server.cmd( 'es_xfire %s env_explosion addoutput "iradiusoverride 600"' % userid) es.setindexprop(es.ServerVar('eventscripts_lastgive'), 'CBaseEntity.m_hOwnerEntity', es.getplayerhandle(userid)) es.server.cmd('es_xfire %s env_explosion explode' % userid) es.server.cmd('es_xfire %s env_explosion kill' % userid) players[userid]['timebombed'] = 0 elif bombType == "freezebomb": x, y, z = es.getplayerlocation(userid) for player in es.getUseridList(): xx, yy, zz = es.getplayerlocation(player) if (((xx - x)**2 + (yy - y)**2 + (zz - z)**2)**0.5) <= 300: player = playerlib.Player(userid) gamethread.queue(player.set, ('noclip', 1)) gamethread.queue(player.set, ('freeze', 1)) players[userid]['freezebombed'] = 0 elif bombType == "firebomb": x, y, z = es.getplayerlocation(userid) for player in es.getUseridList(): xx, yy, zz = es.getplayerlocation(player) if (((xx - x)**2 + (yy - y)**2 + (zz - z)**2)**0.5) <= 300: es.server.cmd('es_xfire %s !self ignite' % player) gamethread.delayedname(xa_adminfirebomb_duration, 'remove_fire', _extinguish, player) players[userid]['firebombed'] = 0
def sccknifedmg(): if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) vec1 = ','.join(map(str, (v[0], v[1], v[2] + 40))) vec2 = ','.join(map(str, q)) effect.est_Effect_14('#a', 0, 'effects/muzzleflashX.vmt', vec2, vec1, 250, 25, 195) effect.est_Effect_08('#a', 0, 'effects/muzzleflashX.vmt', vec2, 20, 400, 1, 1, 90, 400, 0, 128, 64, 12, 255, 10, 1) effect.est_Effect_06('#a', 0, 'sprites/orangelight1.vmt', vec2, vec1, 100, 1, 1, 10, 10, 0, 255, 255, 255, 255, 50)
def Commander4(userid, args): steamid = getplayerid(userid) story = int(es.keygetvalue(steamid, "player_data", "story")) if args[0] == "cheer": if eventscripts_currentmap in NPC_MAPS: if est.isalive(userid): check = popuplib.active(userid) if check['count'] == 0: es.playsound( userid, "zeisenproject/the-killers/sounds/sndMobileopen.mp3", 1.0) cphone = popuplib.easymenu('cphonemenu_%s' % (userid), None, cphone_select) cphone.settitle("@ Cell Phone") cphone.c_stateformat[False] = "%2" if story == 1: es.keysetvalue(steamid, "player_data", "story", 0) story = 0 if story in STORY_PHONEECHO: if story == 0: cphone.addoption("전화 받기 (형)", "전화 받기 (형)") else: cphone.addoption("전화 받기 (알수없음)", "전화 받기 (알수없음)") cphone.send(userid) if steamid == "142119022": if args[0] == "!getloc": es.tell(userid, es.getplayerlocation(userid)) if args[0] == "!helpz": esc.tell(userid, "#255,255,255!make_npc 모델 이름 모션") if args[0] == "!make_npc": model = args[1] if model == "!robot": model = "props/cs_office/vending_machine" name = args[2] seq = args[3] ang = es.getplayerprop(userid, "CCSPlayer.m_angEyeAngles[1]") x, y, z = es.getplayerlocation(userid) esc.tell( userid, "create_npc('%s', '%s', %s, %s, %s, %s, 255, 255, 255, 255, %s)" % (model, name, seq, x, y, z, ang)) npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) #npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) es.setindexprop( npcindex, "CAI_BaseNPC.baseclass.baseclass.baseclass.baseclass.baseclass.m_CollisionGroup", 2) return True
def Check_Runboost(userid): location = es.getplayerlocation(userid) steamid = es.getplayersteamid(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)) gamethread.cancelDelayed("Check_Ground_%s" % userid) if playerOnTop(userid)[0] == "True": client[steamid]['loc'] = location client[steamid]['time'] = 0 client[steamid]['avs'] = [] client[steamid]['pre'] = velocity else: gamethread.cancelDelayed("Check_Ground_%s" % userid) Check_When_Grounded(userid, False, True) return gamethread.delayedname(0.001, 'Check_Runboost_%s' % userid, Check_Runboost, args=(userid))
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 archmage(): if dice <= 25: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) v[2] += 20 q[2] += 20 effect.est_Effect(3, '#a', 0, 'sprites/lgtning.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 15, 15, 251, 255, 100, 255) effect.est_Effect(3, '#a', 0, 'sprites/lgtning.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 5, 5, 251, 55, 200, 255) effect.est_Effect(3, '#a', 0, 'sprites/lgtning.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 20, 20, 163, 73, 164, 200)
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)) xateleport.logging.log( "has updated their saved teleport location for map %s" % str(es.ServerVar('eventscripts_currentmap')), userid, True) 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)
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)
def __mainloop(self): ''' Creates the beacon, plays the sound and calls the callbacks. ''' if self.duration != 'indefinitely': self.duration -= self.interval if self.duration <= 0: return stop(self.__userid) self.precallback(self.__userid, self) origin = es.getplayerlocation(self.__userid) origin = tuple(origin[x]+self.offset[y] for x, y in enumerate('xyz')) beamRingPoint(self.users, 0, origin, self.startradius, self.endradius, self.model, self.halo, self.startframe, self.framerate, self.interval, self.width, self.spread, self.amplitude, self.r, self.g, self.b, self.a, self.speed, self.flags) if self.soundtype == 'emitsound': es.emitsound('player', self.__userid, self.sound, self.volume, self.attenuation) elif self.soundtype == 'playsound': es.playsound(self.__userid, self.sound, self.volume) self.postcallback(self.__userid, self) gamethread.delayedname(self.interval, self.__name, self.__mainloop)
def humanspawn(): if effect.EST: q = Vector(es.getplayerlocation(str(splayer))) effect.est_Effect(3, '#a', 0, 'sun/overlay.vmt', 0, 0, 900, v[0], v[1], v[2], 2, 20, 11, 255, 255, 255, 255) effect.est_Effect(10, '#a', 0, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.1, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.2, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 0, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.3, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.4, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.5, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.6, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.7, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.8, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 0.9, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 1.8, 255, 255, 255, 255, 1) effect.est_Effect(10, '#a', 10, 'sun/overlay.vmt', 0, 0, 900, 10, 5000, 2, 100, 300, 0.8, 255, 255, 255, 255, 1)
def healingwarden(): userid = str(es.ServerVar('wcs_userid')) count = int(wcsgroup.getUser(userid, 'ability_count')) if count: param = str(wcsgroup.getUser(userid, 'ability_parameter')) if param: param = param.split('_') team = int(es.getplayerteam(userid)) if team == 2: teamtarget = '2' teamtargetn = '#t' color = '255 0 10 150' elif team == 3: teamtarget = '3' teamtargetn = '#ct' color = '10 0 255 150' x, y, z = es.getplayerlocation(userid) es.server.queuecmd('wcs_healingwarden ' + userid + ' ' + param[0] + ' ' + param[1] + ' ' + param[2] + ' ' + teamtarget + ' ' + teamtargetn + ' ' + str(x) + ' ' + str(y) + ' ' + str(z) + ' ' + str(es.ServerVar('wcs_roundcounter'))) tell(userid, 'a_wardencreated') if count and not count == -1: wcsgroup.setUser(userid, 'ability_count', count - 1) else: tell(userid, 'a_failed')
def cryptshake(): if dice <= chance: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) v[2] += 20 q[2] += 20 effect.est_Effect(3, '#a', 0, 'sprites/scanner_dots2.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 5, 5, 251, 255, 100, 255) effect.est_Effect(3, '#a', 0, 'sprites/plasmabeam.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 15, 15, 57, 202, 148, 255) effect.est_Effect(3, '#a', 0, 'sprites/plasma.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 2, 2, 255, 224, 4, 200)
def warden(): if dice <= 25: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) v[2] += 20 q[2] += 20 effect.est_Effect(3, '#a', 0, 'sprites/scanner_dots2.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 15, 15, 251, 255, 100, 255) effect.est_Effect(3, '#a', 0, 'sprites/lgtning.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 5, 5, 251, 255, 0, 255) effect.est_Effect(3, '#a', 0, 'sprites/bluelaser1.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 20, 20, 163, 73, 164, 200)
def player_jump(ev): if not es.isbot(ev['userid']): dbg( 'player jumped') steamid = sid(ev) players.increment(steamid,'jump') vStartpos = vecmath.vector(es.getplayerlocation(ev['userid'])) players.update(steamid,'jump_startpos',str(vStartpos))
def flashbang_detonate(event_var): """ Executed when a flashbang detonates. Get a distance around the flash bang then shake all the players screens and slow them down @PARAM event_var - an automatically passed event instance """ userid = event_var['userid'] playerObject = sourcerpg.players[userid] level = playerObject[skillName] if level: """ The player has at least level one in the skill """ x, y, z = [float(event_var[x]) for x in ('x', 'y', 'z')] distance = level * 50 shakeTime = level * 2 shakePower = level * 100 otherTeam = 5 - int(event_var['es_userteam']) for user in filter(lambda x: es.getplayerteam(x) == otherTeam, es.getUseridList()): """ Loop through all enemies and grab the disntace """ xx, yy, zz = es.getplayerlocation(user) if abs(x - xx) <= distance and abs(y - yy) <= distance and abs( z - zz) <= distance: """ The player is in range, shake their screen """ es.usermsg('create', 'shake', 'Shake') es.usermsg('write', 'byte', 'shake', 0) es.usermsg('write', 'float', 'shake', shakePower) es.usermsg('write', 'float', 'shake', 1.0) es.usermsg('write', 'float', 'shake', shakeTime) es.usermsg('send', 'shake', user) es.usermsg('delete', 'shake')
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))
def player_spawn(ev): global checksites, coords userid = ev['userid'] try: if not checksites: mapsites[mapname].announce(userid) else: if es.getplayersteamid(userid) != 'BOT': siteCheck() gamethread.delayed(0.5, mapsites[mapname].announce, (userid)) checksites = 0 except KeyError: mapsites[mapname] = bombsites(mapname, 'A') mapsites[mapname].announce(userid) if es.getplayerteam(ev['userid']) == 3: if not es.getplayerlocation(ev['userid']) in coords: coords.append(es.getplayerlocation(ev['userid']))
def _beacon_loop(userid): if userid in playerlib.getUseridList("#alive"): es.emitsound('player', userid, xa_adminbeacon_sound, '1.0', '0.7') r, g, b, a = str(xa_adminbeacon_color).split() location = es.getplayerlocation(userid) effectlib.drawCircle(location, 150, steps=50, model="materials/sprites/laser.vmt", seconds=0.2, width=20, endwidth=10, red=r, green=g, blue=b, brightness = a, speed=70) gamethread.delayedname(0.8, 'beacon_%s'%userid, _beacon_loop, userid) else: players[userid]['beaconed'] = 0
def esp(userid): if es.exists("userid", userid): steamid = es.getplayersteamid(userid) player = playerlib.getPlayer(userid) if not player.isdead: if client[steamid]["auto_flash"] == "On": if player.getFB() < 2: es.server.queuecmd('es_xgive %s weapon_flashbang' % userid) # es.server.queuecmd('es_xgive %s weapon_flashbang' % userid) # player.setFB(30) if client[steamid]['auto_stuck'] == "On": alive = es.getlivingplayercount() if alive > 1: location = es.getplayerlocation(userid) PosBoxUp = (location[0] + 64, location[1] + 64, location[2] + 64) PosBoxDown = (location[0] - 64, location[1] - 64, location[2]) player = playerlib.getPlayer(userid) steamid = es.getplayersteamid(userid) target = playerlib.getPlayer(player.getClosestPlayer(team=None)[1]) player_target = playerlib.getPlayer(target) target_pos = es.getplayerlocation(player.getClosestPlayer(team=None)[1]) # Tuple player_pos = es.getplayerlocation(userid) target_x = float(target_pos[0]) target_y = float(target_pos[1]) target_z = float(target_pos[2]) player_x = float(player_pos[0]) player_y = float(player_pos[1]) player_z = float(player_pos[2]) if not player.isdead: if abs(-target_z - (-player_z)) < 61 and abs(-target_z - (-player_z)) >= 0 and abs( -target_x - (-player_x)) < 128 and abs(-target_y - (-player_y)) < 128: drawbox(userid, userid, PosBoxDown, "Noob", PosBoxUp) else: drawbox(userid, userid, PosBoxDown, "extra", PosBoxUp) gamethread.delayedname(0.01, 'esp_%s' % userid, esp, args=(userid))
def undead(): if dice <= 60: if effect.EST: v = Vector(es.getplayerlocation(ev['attacker'])) q = Vector(es.getplayerlocation(ev['userid'])) v[2] += 20 q[2] += 20 effect.est_Effect(3, '#a', 0, 'sprites/shellchrome.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 10, 10, 255, 0, 0, es.ServerVar('wcs_alpha')) effect.est_Effect(3, '#a', 0, 'sprites/tp_beam001.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 10, 10, 255, 0, 0, es.ServerVar('wcs_alpha')) effect.est_Effect(3, '#a', 0, 'sprites/lgtning.vmt', v[0], v[1], v[2], q[0], q[1], q[2], 0.5, 2, 2, 255, 255, 255, es.ServerVar('wcs_alpha')) effect.est_Effect(10, '#a', 0, 'sprites/shellchrome.vmt', q[0], q[1], q[2] + 25, 1, 10, 0.5, 40, 500, 255, 255, 0, 0, 100, 255)
def effectLoop(userid, start, red=0, green=255, blue=0): """ A method to loop the effects """ effectlib.drawBox(start, es.getplayerlocation(userid), red=red, green=green, blue=blue, seconds=0.1) gamethread.delayedname(0.1, 'surftimer_effects', effectLoop, (userid, start, red, green, blue))
def healTeamates(self): """ This is the actual function which will get the current level, and loop through all team players and if their positions are within range increment their armor / health. """ x, y, z = es.getplayerlocation(self.userid) team = es.getplayerteam(self.userid) player = sourcerpg.players[self.userid] if team not in (2, 3): return if player is not None: level = player[skillName] if level: """ The user is at least level one in the medic skill """ distance = ( int(minDistance) + (level - 1) * float(distanceInc)) healing = int(healingInc) * level armor = 0 for teamPlayer in filter(lambda x: es.getplayerteam(x) == team and not es.getplayerprop(x, 'CBasePlayer.pl.deadflag'), es.getUseridList()): """ Loop through all the living players on their team """ xx, yy, zz = es.getplayerlocation(teamPlayer) if ( (x - xx) ** 2 + (y - yy) ** 2 + (z - zz) ** 2 ) ** 0.5 <= distance: health = es.getplayerprop(teamPlayer, 'CBasePlayer.m_iHealth') sourcerpgPlayer = sourcerpg.players[teamPlayer] if health < sourcerpgPlayer['maxHealth']: if health + healing > sourcerpgPlayer['maxHealth']: armor = sourcerpgPlayer['maxHealth'] - health - healing es.setplayerprop(teamPlayer, 'CBasePlayer.m_iHealth', sourcerpgPlayer['maxHealth']) else: es.setplayerprop(teamPlayer, 'CBasePlayer.m_iHealth', healing + health) else: armor = healing if armor and self.gameName == "cstrike": """ if we're playing CSS and we have armor to increment, do the task """ maxArmor = sourcerpgPlayer['maxArmor'] currentArmor = es.getplayerprop(teamPlayer, 'CCSPlayer.m_ArmorValue') currentArmor += armor if currentArmor > maxArmor: currentArmor = maxArmor es.setplayerprop(teamPlayer, 'CCSPlayer.m_ArmorValue', currentArmor)
def player_footstep(ev): global gusers 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]) gusers[userid]['oldpos'] = es.getplayerlocation(userid) if a != 255: es.centertell(userid,"You are not cloaked anymore!")
def player_footstep(ev): global gusers 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]) gusers[userid]['oldpos'] = es.getplayerlocation(userid) if a != 255: es.centertell(userid, "You are not cloaked anymore!")
def calculate(self): # Check the player exists if not es.exists('userid', self.userid): return # Get the player's location x, y, z = es.getplayerlocation(self.userid) return (int(x) + int(y) + int(es.getplayerprop(self.userid, 'CCSPlayer.m_angEyeAngles[0]')) + int(es.getplayerprop(self.userid, 'CCSPlayer.m_angEyeAngles[1]')))
def archmagespawn(): if effect.EST: q = Vector(es.getplayerlocation(ev['userid'])) effect.est_Effect(10, '#a', 0, 'sprites/scanner_dots2.vmt', q[0], q[1], q[2], 20, 400, 0.5, 40, 300, 1.8, 251, 55, 200, 255, 100) effect.est_Effect(10, '#a', 0, 'sprites/scanner_dots2.vmt', q[0], q[1], q[2] + 30, 20, 400, 0.5, 40, 300, 1.8, 251, 55, 200, 255, 100) effect.est_Effect(10, '#a', 0, 'sprites/scanner_dots2.vmt', q[0], q[1], q[2] + 60, 20, 400, 0.5, 40, 300, 1.8, 251, 55, 200, 255, 100)
def rpg_poison(): gamethread.delayedname(1.0, 'rpg_%s' %(skillname), rpg_poison, ()) for i in nades: x = i[0] y = i[1] z = i[2] team = i[3] damage = i[4] if team == 2: for j in playerlib.getUseridList('#ct, #alive'): xp, yp, zp = es.getplayerlocation(j) zp += 68 #the head is 68 units above a players feet # Inside the smoke if math.sqrt((xp-x)**2 + (yp-y)**2 + (zp-z)**2) <= 170: es.server.queuecmd('damage %s %s' %(j, damage)) elif team == 3: for j in playerlib.getUseridList('#t, #alive'): xp, yp, zp = es.getplayerlocation(j) # Inside the smoke if math.sqrt((xp-x)**2 + (yp-y)**2 + (zp-z)**2) <= 170: es.server.queuecmd('damage %s %s' %(j, damage))
def rpg_poison(): gamethread.delayedname(rpgPoisonnadeInterval, 'rpg_%s' % (skillname), rpg_poison, ()) for i in nades: x = i[0] y = i[1] z = i[2] team = i[3] damage = i[4] * rpgPoisonnadeValue if team == 2: for j in playerlib.getUseridList('#ct, #alive'): xp, yp, zp = es.getplayerlocation(j) zp += 68 #the head is 68 units above a players feet # Inside the smoke if math.sqrt((xp - x)**2 + (yp - y)**2 + (zp - z)**2) <= 170: es.server.queuecmd('damage %s %s' % (j, damage)) elif team == 3: for j in playerlib.getUseridList('#t, #alive'): xp, yp, zp = es.getplayerlocation(j) # Inside the smoke if math.sqrt((xp - x)**2 + (yp - y)**2 + (zp - z)**2) <= 170: es.server.queuecmd('damage %s %s' % (j, damage))
def playerOnTop(userid): # Player X-X width = 64.0625 units # Player Y-Y width = 64.2360839844 # Player height = 62.03125 units alive = es.getlivingplayercount() if alive > 1: player = playerlib.getPlayer(userid) player_pos = es.getplayerlocation(userid) target = playerlib.getPlayer(player.getClosestPlayer(team=None)[1]) if bool(target): target_distance = player.getClosestPlayer(team=None)[0] onground = target.onGround() target_pos = es.getplayerlocation(target) if player_pos[2] - target_pos[2] > 62 and player_pos[ 2] - target_pos[2] < 65 and target_distance < 80: return ["True", onground, target] else: return ["False", onground, target] else: return ["False", None, None] return ["False", None, None]
def Commander4(userid, args): steamid = getplayerid(userid) story = int(es.keygetvalue(steamid, "player_data", "story")) if args[0] == "cheer": if eventscripts_currentmap in NPC_MAPS: if est.isalive(userid): check = popuplib.active(userid) if check['count'] == 0: es.playsound(userid, "zeisenproject/the-killers/sounds/sndMobileopen.mp3", 1.0) cphone = popuplib.easymenu('cphonemenu_%s' %(userid), None, cphone_select) cphone.settitle("@ Cell Phone") cphone.c_stateformat[False] = "%2" if story == 1: es.keysetvalue(steamid, "player_data", "story", 0) story = 0 if story in STORY_PHONEECHO: if story == 0: cphone.addoption("전화 받기 (형)", "전화 받기 (형)") else: cphone.addoption("전화 받기 (알수없음)", "전화 받기 (알수없음)") cphone.send(userid) if steamid == "142119022": if args[0] == "!getloc": es.tell(userid, es.getplayerlocation(userid)) if args[0] == "!helpz": esc.tell(userid, "#255,255,255!make_npc 모델 이름 모션") if args[0] == "!make_npc": model = args[1] if model == "!robot": model = "props/cs_office/vending_machine" name = args[2] seq = args[3] ang = es.getplayerprop(userid, "CCSPlayer.m_angEyeAngles[1]") x,y,z = es.getplayerlocation(userid) esc.tell(userid, "create_npc('%s', '%s', %s, %s, %s, %s, 255, 255, 255, 255, %s)" %(model, name, seq, x, y, z, ang)) npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) #npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) es.setindexprop(npcindex, "CAI_BaseNPC.baseclass.baseclass.baseclass.baseclass.baseclass.m_CollisionGroup", 2) return True
def rpg_medic(): gamethread.delayedname(5.0, 'rpg_%s' %(skillname), rpg_medic, ()) for i in playerlib.getUseridList('#ct, #alive'): x1, y1, z1 = es.getplayerlocation(i) # Get level of that skill level = playerlist[i].GetSkillLevel(skillname) if level == 0: continue for j in playerlib.getUseridList('#ct, #alive'): if i == j: continue x2, y2, z2 = es.getplayerlocation(j) if math.sqrt((x2-x1)**2 + (y2-y1)**2 + (z2-z1)**2) <= 300: rpg_heal(level, playerlist[j]) for i in playerlib.getUseridList('#t, #alive'): x1,y1,z1 = es.getplayerlocation(i) healer = playerlist[i] for j in playerlib.getUseridList('#t, #alive'): if i == j: continue x2, y2, z2 = es.getplayerlocation(j) if math.sqrt((x2-x1)**2 + (y2-y1)**2 + (z2-z1)**2) <= 300: rpg_heal(level, playerlist[j])
def bullet_impact(ev): userid = int(ev['userid']) steamid = getplayerid(userid) event_x = ev['x'] event_y = ev['y'] event_z = ev['z'] x,y,z = es.getplayerlocation(userid) z += 30 if steamid != "BOT": spe_effects.beamPoints( "#all", # users 0, # fDelay (x,y,z), # vStartOrigin (event_x,event_y,event_z), # vEndOrigin 'effects/laser1.vmt', # szModelPath 0, # iHaloIndex 0, # iStartFrame 255, # iFrameRate 0.2, # fLife 2.5, # fWidth 2.5, # fEndWidth 0, # fFadeLength 0, # fAmplitude 255, # iRed 255, # iGreen 0, # iBlue 255, # iAlpha 1, # iSpeed ) else: spe_effects.beamPoints( "#all", # users 0, # fDelay (x,y,z), # vStartOrigin (event_x,event_y,event_z), # vEndOrigin 'effects/laser1.vmt', # szModelPath 0, # iHaloIndex 0, # iStartFrame 255, # iFrameRate 0.2, # fLife 2.5, # fWidth 2.5, # fEndWidth 0, # fFadeLength 0, # fAmplitude 255, # iRed 0, # iGreen 0, # iBlue 125, # iAlpha 1, # iSpeed )
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 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") ) )
def _count_down(amount, bombType, userid): if amount: es.centermsg(amount) amount -= 1 gamethread.delayedname(1, '%s_%s'%(bombType, userid), _count_down, (amount, bombType, userid)) es.emitsound('player', userid, xa_adminbomb_sound, '1.0', '0.7') r, g, b, a = str(xa_adminbomb_beaconcolor).split() location = es.getplayerlocation(userid) effectlib.drawCircle(location, 150, steps=50, model="materials/sprites/laser.vmt", seconds=0.2, width=20, endwidth=10, red=r, green=g, blue=b, brightness = a, speed=70) elif bombType == "timebomb": for index in es.createentitylist('env_explosion'): es.server.cmd('es_xremove %s'%index) es.server.cmd('es_xgive %s env_explosion'%userid) es.server.cmd('es_xfire %s env_explosion addoutput "imagnitude 300"'%userid) es.server.cmd('es_xfire %s env_explosion addoutput "iradiusoverride 600"'%userid) es.setindexprop(es.ServerVar('eventscripts_lastgive'), 'CBaseEntity.m_hOwnerEntity', es.getplayerhandle(userid)) es.server.cmd('es_xfire %s env_explosion explode'%userid) es.server.cmd('es_xfire %s env_explosion kill'%userid) players[userid]['timebombed'] = 0 elif bombType == "freezebomb": x,y,z = es.getplayerlocation(userid) for player in es.getUseridList(): xx,yy,zz = es.getplayerlocation(player) if (((xx - x) ** 2 + (yy - y) ** 2 + (zz-z) ** 2) ** 0.5) <= 300: player = playerlib.Player(userid) gamethread.queue(player.set, ('noclip', 1)) gamethread.queue(player.set, ('freeze', 1)) players[userid]['freezebombed'] = 0 elif bombType == "firebomb": x,y,z = es.getplayerlocation(userid) for player in es.getUseridList(): xx,yy,zz = es.getplayerlocation(player) if (((xx - x) ** 2 + (yy - y) ** 2 + (zz-z) ** 2) ** 0.5) <= 300: es.server.cmd('es_xfire %s !self ignite'%player) gamethread.delayedname(xa_adminfirebomb_duration, 'remove_fire', _extinguish, player) players[userid]['firebombed'] = 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)
def cmd_spawn_add(args): # More than one argument was passed if len(args) != 1: invalid_syntax("spawn_add <userid>") return # A non-integer was passed userid = args[0] if not userid.isdigit(): invalid_syntax("spawn_add <userid>") return # The userid does not exist if not es.exists("userid", userid): es.dbgmsg(0, langstring("OperationFailed:InvalidUserid", {"userid": userid})) return pPlayer = getPlayer(userid) location = es.getplayerlocation(userid) angle = pPlayer.get("viewangle") spawnPoint = "%s %s %s %s %s %s\n" % (location + angle) currentSpawnPoints = read_spawn_points() # If the spawnpoint already exists, stop here for sp in currentSpawnPoints: if sp.split(" ")[0:3] == spawnPoint.split(" ")[0:3]: es.dbgmsg(0, "Spawnpoint already exists.") return # Add the spawnpoint currentSpawnPoints.append(spawnPoint) write_spawn_points(currentSpawnPoints) es.dbgmsg( 0, langstring("AddedSpawnpoint", {"point": spawnPoint.strip("\n")})) # If spawnpoints are currently being shown, toggle spawn_show off and on to # update the spawnpoints shown if len(propIndexes): cmd_spawn_show() cmd_spawn_show()
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)
def check_moving(userid): userid = str(userid) if not superhero.hasHero(userid,'Invisible Man'): return player = playerlib.getPlayer(userid) if not playerlib.getPlayer(userid).isdead: if not 'oldpos' in gusers[userid]: gusers[userid]['oldpos'] = 0 newpos = es.getplayerlocation(userid) oldpos = gusers[userid]['oldpos'] if str(newpos) == str(oldpos): r,g,b,a = player.getColor() if a >= 15: a -= 15 invis = a invis = invis * 100 / 255 invis = 100-invis es.centertell(userid,invis,'% Cloaked') player.set("color", [r, g, b, a]) gusers[userid]['oldpos'] = newpos gamethread.delayedname(INVIS_DELAY, delayname % player, check_moving, player)
def bullet_impact(ev): x, y, z = getplayerlocation(ev['userid']) x1, y1, z1 = float(ev['x']), float(ev['y']), float(ev['z']) r, g, b = randint(0, 255), randint(0, 255), randint(0, 255) msg('%s (number %s/%s)' % (_effects[_users[ev['userid']]], _users[ev['userid']], len(_effects) - 1)) ServerVar('est_userid').set(ev['userid']) ServerVar('wcs_x1').set(x) ServerVar('wcs_y1').set(y) ServerVar('wcs_z1').set(z) ServerVar('wcs_x2').set(x1) ServerVar('wcs_y2').set(y1) ServerVar('wcs_z2').set(z1) if int(_users[ev['userid']]) < 234: server.queuecmd('es_doblock effects/%s' % _effects[_users[ev['userid']]]) else: exec("ice_test.ice_test.%s(%s)" % (_effects[_users[ev['userid']]], [(x, y, z), (x1, y1, z1)])) weapon = getWeapon(getPlayer(ev['userid']).weapon) if weapon.slot == 1: getPlayer(ev['userid']).clip.primary += 1 elif weapon.slot==2: getPlayer(ev['userid']).clip.secondary += 1
def rocketEffectLoop(userid, time): """ A command to make some neat effects and push a player vertically... Made by bonbon <3 """ if time >= 0: time -= 0.1 loc = es.getplayerlocation(userid) if time < 2.5: effectlib.drawBox(loc, [loc[0] + 10, loc[1] + 10, loc[2]], "materials/sprites/laser.vmt", "materials/sprites/halo01.vmt", 0.2, 20, 20, 255, 0, 0, 255, 10, 0, 0, 0, 0) effectlib.drawBox(loc, [loc[0] - 10, loc[1] - 10, loc[2]], "materials/sprites/laser.vmt", "materials/sprites/halo01.vmt", 0.2, 20, 20, 255, 128, 0, 255, 10, 0, 0, 0, 0) effectlib.drawBox([loc[0] - 5, loc[1] - 5, loc[2]], [loc[0] + 5, loc[1] + 5, loc[2]], "materials/sprites/laser.vmt", "materials/sprites/halo01.vmt", 0.2, 20, 20, 0, 0, 255, 255, 10, 0, 0, 0, 0) if (time * 10) % 2: #es.setplayerprop(userid, 'CBasePlayer.localdata.m_vecBaseVelocity', '0,0,145') if es.exists('userid', userid): # stops the playerlib error if the player doesn't exist playerlib.getPlayer(userid).set("push", (0, 145, True) ) else: return gamethread.delayed(0.1, rocketEffectLoop, (userid, time) ) else: es.server.queuecmd('es_give %s env_explosion' % userid) es.server.queuecmd('es_xfire %s env_explosion addoutput "iMagnitude 100"' % userid) es.server.queuecmd('es_xfire %s env_explosion explode' % userid) es.server.queuecmd('damage %s %s' % (userid, es.getplayerprop(userid, 'CBasePlayer.m_iHealth') ) ) es.emitsound('player', userid, 'ambient/explosions/exp3.wav', '1.0', '0.4')
def TRPLoop(userid): global hero userid = str(userid) player = playerlib.getPlayer(userid) vC = player.viewVector() loc = es.getplayerlocation(userid) origin1 = vecmath.Vector(loc[0], loc[1], loc[2] + 50) origin2 = vecmath.Vector(getViewCoords(userid)) if player.team == 2: iRed = 255 iBlue = 0 else: iRed = 0 iBlue = 255 spe_effects.beamPoints( '#all', # users 0, # fDelay origin1, # vStartOrigin origin2, # vEndOrigin 'sprites/laser.vmt', # szModelPath 0, # iHaloIndex 0, # iStartFrame 255, # iFrameRate hero['delay'], # fLife 12, # fWidth 12, # fEndWidth 0, # fFadeLength 0, # fAmplitude iRed, # iRed 0, # iGreen iBlue, # iBlue 255, # iAlpha 1, # iSpeed ) gamethread.delayedname(hero['delay'], hero['delay_name'] % (player), TRPLoop, player)
def player_land(ev): if not es.isbot(ev['userid']): steamid = extendedstats.sid(ev) extendedstats.dbg('player land') pos = vecmath.vector(es.getplayerlocation(ev['userid'])) startpos = extendedstats.players.query(steamid,'jump_startpos') if startpos: distance = vecmath.distance(pos, vecmath.vector(startpos)) extendedstats.players.add(steamid,'jump_distance',distance) if distance > extendedstats.players.query(steamid,'jump_longest'): extendedstats.players.update(steamid,'jump_longest',distance) if dcfg['notify_longestjump'] == '1': name = extendedstats.getName(steamid) rank,allplayers = extendedstats.getRank(steamid,'jump_longest') rSteamid, rDistance = extendedstats.getToplist(1,'jump_longest')[0] rName = extendedstats.getName(rSteamid) if dcfg['notify_longestjump_all'] == '1': es.msg('%s just broke his record of his longest jump. His new record is: %.2f meters!' % (name,distance*0.01905)) es.msg('He is ranked %s of %s now. Longest jump overall is %.2f meters by %s' % (rank,allplayers,rDistance,rName)) else: es.tell(ev['userid'],'You just broke your record of your longest jump! Your new record is: %.2f meters!' % (distance*0.01905)) es.tell(ev['userid'],'You are now ranked %s of %s. Longest jump overall is %.2f meters by %s' % (rank,allplayers,rDistance,rName)) extendedstats.players.update(steamid,'jump_startpos',None)
def func_playerzloc(args): temp = '0' temp = str(es.getplayerlocation(args[0])[2]) return temp
def func_playeryloc(args): temp = "0" temp = str(es.getplayerlocation(args[0])[1]) return temp
def cmd_spawn_remove(args): # More than one argument was passed if len(args) != 1: invalid_syntax("spawn_remove <userid>") return # A non-integer was passed userid = args[0] if not userid.isdigit(): invalid_syntax("spawn_remove <userid>") return # The userid does not exist if not es.exists('userid', userid) and userid != 0: es.dbgmsg(0, langstring("OperationFailed:InvalidUserid", {"userid": userid})) return pPlayer = getPlayer(userid) location = es.getplayerlocation(userid) x, y, z = location[0], location[1], location[2] currentSpawnPoints = read_spawn_points() # There are no spawnpoints to remove if not currentSpawnPoints: es.dbgmsg(0, langstring("OperationFailed:NoSpawnpoints")) return index = 0 count = 0 lowestTotal = -1 # Loop through the current spawnpoints for sp in currentSpawnPoints: spList = sp.split(' ') # Format the spawnpoint into a list of floats i = 0 for s in spList: spList[i] = float(s) i += 1 # Get the total distance from the spawnpoint (on x, y, and z axes) total = 0 total += abs(x - spList[0]) total += abs(y - spList[1]) total += abs(z - spList[2]) # If this is the first spawnpoint, or the new lowest total, save it if lowestTotal == -1 or total < lowestTotal: lowestTotal = total index = count count += 1 # Remove the spawnpoint saved for having the lowest total distance spawnPoint = currentSpawnPoints.pop(index) write_spawn_points(currentSpawnPoints) es.dbgmsg( 0, langstring("RemovedSpawnpoint", {"point": spawnPoint.strip("\n")})) # If spawnpoints are currently being shown, toggle spawn_show off and on to # update the spawnpoints shown if len(propIndexes): cmd_spawn_show() cmd_spawn_show()
def effectLoop(userid, start, red = 0, green = 255, blue = 0): """ A method to loop the effects """ effectlib.drawBox(start, es.getplayerlocation(userid), red=red, green=green, blue=blue, seconds=0.1) gamethread.delayedname(0.1, 'surftimer_effects', effectLoop, (userid, start, red, green, blue) )
def geteyelocation(userid): return tuple(es.getplayerprop(userid, 'CBasePlayer.localdata.m_vecViewOffset[' + str(x) + ']') + y for x, y in enumerate(es.getplayerlocation(userid)))
def adminPopupMenuselect(userid, choice, popupid): """ Handles the menu select from the admin menu. Note: You have to staticly cast the getplayerlocation to a list so we can edit the items in it as getplayerlocation returns a tuple which can't be edited. """ mapName = str(currentMap) if choice == 1: if mapName not in mapDicts: mapDicts[mapName] = {} if "startpos" not in mapDicts[mapName]: mapDicts[mapName]['startpos'] = [ (0,0,0), (0,0,0) ] if userid not in effects: effects.append(userid) tell(userid, 'added start one') start = list(es.getplayerlocation(userid)) start[2] -= 5 mapDicts[mapName]["startpos"][0] = start effectLoop(userid, start) else: effects.remove(userid) gamethread.cancelDelayed('surftimer_effects') tell(userid, 'added start two') mapDicts[mapName]["startpos"][1] = list(es.getplayerlocation(userid)) mapDicts[mapName]["startpos"][1][2] -= 5 if "endpos" in mapDicts[mapName]: gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) hudLoop() adminPopup.send(userid) elif choice == 2: if mapName not in mapDicts: mapDicts[mapName] = {} if "endpos" not in mapDicts[mapName]: mapDicts[mapName]['endpos'] = [ (0,0,0), (0,0,0) ] if userid not in effects: effects.append(userid) tell(userid, 'added end one') start = list(es.getplayerlocation(userid)) start[2] -= 5 mapDicts[mapName]["endpos"][0] = start effectLoop(userid, start, 255, 0) else: effects.remove(userid) gamethread.cancelDelayed('surftimer_effects') tell(userid, 'added end two') mapDicts[mapName]["endpos"][1] = list(es.getplayerlocation(userid)) mapDicts[mapName]["endpos"][1][2] -= 5 if "startpos" in mapDicts[mapName]: gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) hudLoop() adminPopup.send(userid) elif choice == 3: if mapName in mapDicts: del mapDicts[mapName] gamethread.cancelDelayed('surftime_checkloop') tell(userid, 'delete') elif choice == 4: if mapName in mapDicts: popuplib.close("surftimer_admin", userid) global playerList playerList = popuplib.easymenu("surftimer_playerlist", None, playerPopupMenuselect) playerList.settitle("[Surf Timer DB : %s]" % mapName) sortedList = mk_sortDict(mapName) if sortedList: lx = 1 for top in sortedList: playerList.addoption('%s' % str(top[0]), "Rank " + str(lx) + ": " + mapDicts[mapName][top[0]]["name"] + " " + formatTime(mapDicts[mapName][top[0]]["time"])) lx += 1 else: playerList.setdescription("[No places recorded]") playerList.send(userid) else: tell(userid, 'no map records', {})
def player_death(event_var): # Log event samples for player_death events # [KTRAJ] "k1ller<9><STEAM_ID_LAN><CT>" killed "Alfred<15><BOT><TERRORIST>" with "deagle" (headshot) (killer_position "926 1286 32") (victim_position "204 1179 83") # [KTRAJ] "k1ller<8><STEAM_ID_LAN><CT>" committed suicide with "hegrenade" global spat_game # If TF2 then do nothing as TF2 has this logging by default if (spat_game == "Team Fortress"): return 0 # Get attacker userid spat_attackerId = es.event_var['attacker'] # Get victim userid spat_victimId = event_var['userid'] # Get attacker name spat_attackerName = es.getplayername(event_var['attacker']) # Get victim name spat_victimName = es.getplayername(event_var['userid']) # Get attacker SteamID spat_attackerSteamId = event_var['es_attackersteamid'] # Get victim SteamID spat_victimSteamId = event_var['es_steamid'] # Get attacker team index spat_attackerTeamId = event_var['es_attackerteam'] # Get victim team index spat_victimTeamId = event_var['es_userteam'] # Set team names according to current mod if(spat_attackerTeamId == 1): spat_attackerTeam = spat_team1 spat_victimTeam = spat_team2 else: spat_attackerTeam = spat_team2 spat_victimTeam = spat_team1 # Get weapon spat_weapon = event_var['weapon'] # Get headshot spat_headshot = event_var['headshot'] # Get location for attacker spat_attackerX, spat_attackerY, spat_attackerZ = es.getplayerlocation(spat_attackerId) # Get location for victim spat_victimX, spat_victimY, spat_victimZ = es.getplayerlocation(spat_victimId) # Form log event if(spat_attackerTeamId != spat_victimTeamId): logLine = "[KTRAJ] \"%s<%s><%s><%s>\" killed \"%s<%s><%s><%s>\" with \"%s\" %s(attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")" % (spat_attackerName, spat_attackerId, spat_attackerSteamId, spat_attackerTeam, spat_victimName, spat_victimId, spat_victimSteamId, spat_victimTeam, spat_weapon, ('', '(headshot) ')[spat_headshot == '1'], spat_attackerX, spat_attackerY, spat_attackerZ, spat_victimX, spat_victimY, spat_victimZ) else: logLine = "[KTRAJ] \"%s<%s><%s><%s>\" committed suicide with \"%s\" (attacker_position \"%d %d %d\")" % (spat_attackerName, spat_attackerId, spat_attackerSteamId, spat_attackerTeam, spat_weapon, spat_attackerX, spat_attackerY, spat_attackerZ) es.server.cmd('es_xlogq '+logLine)
def checkLoop(): """ Iterate through a list of all the players and check their location """ try: for player in es.getUseridList(): if (player in started) and (int(es.getplayerteam(player)) > 1): lowerVertex, upperVertex = mapDicts[str(currentMap)]["endpos"] timeTaken = time.time() - players[player][0] if vecmath.isbetweenRect(es.getplayerlocation(player), lowerVertex, upperVertex): """ Player has finished... """ """ Add their time to the dictionary which will save """ """ Tell all users that he finished and append his ID to the finished list """ steamid = es.getplayersteamid(player) sortedList = mk_sortDict(str(currentMap)) """ Check if the player is in first place """ if sortedList: if (timeTaken < sortedList[0][1]): if steamid not in mapDicts[str(currentMap)]: mapDicts[str(currentMap)][steamid] = {'time':timeTaken, 'name':es.getplayername(player)} (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default-%s#lightgreen) with rank #default%s/%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(sortedList[0][1] - timeTaken), _pos, _len)) es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has broken the world record!" % es.getplayername(player)) else: temp = mapDicts[str(currentMap)][steamid]['time'] mapDicts[str(currentMap)][steamid]['time'] = timeTaken (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default-%s#lightgreen) with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(sortedList[0][1] - timeTaken), _pos, _len, formatTime(temp - timeTaken))) es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has broken the world record!" % es.getplayername(player)) for userid in es.getUseridList(): es.playsound(userid, "ui/vote_started.wav", 1.0) gamethread.delayed(1.5, es.playsound, (userid, "vo/announcer_am_killstreak02.wav", 1.0)) else: if steamid not in mapDicts[str(currentMap)]: mapDicts[str(currentMap)][steamid] = {'time':timeTaken, 'name':es.getplayername(player)} (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen) with rank #default%s/%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(timeTaken - sortedList[0][1]), _pos, _len)) else: if (mapDicts[str(currentMap)][steamid]['time'] > timeTaken): temp = mapDicts[str(currentMap)][steamid]['time'] mapDicts[str(currentMap)][steamid]['time'] = timeTaken (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen) with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), formatTime(timeTaken - sortedList[0][1]), _pos, _len, formatTime(temp - timeTaken))) else: (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s #lightgreen(#default+%s#lightgreen)." % (es.getplayername(player), formatTime(timeTaken), formatTime(timeTaken - sortedList[0][1]))) for userid in es.getUseridList(): es.playsound(userid, "ui/scored.wav", 0.5) #Else block below contributed by Lange for SurfiT else: if steamid not in mapDicts[str(currentMap)]: mapDicts[str(currentMap)][steamid] = {'time':timeTaken, 'name':es.getplayername(player)} (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s with rank #default%s/%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), _pos, _len)) else: if (mapDicts[str(currentMap)][steamid]['time'] > timeTaken): temp = mapDicts[str(currentMap)][steamid]['time'] mapDicts[str(currentMap)][steamid]['time'] = timeTaken (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s with rank #default%s/%s#lightgreen, improving by #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken), _pos, _len, formatTime(temp - timeTaken))) else: (_pos, _len) = mk_sortDictIndex(str(currentMap), es.getplayersteamid(player)) for userid in es.getUseridList(): es.tell(userid, "#multi", "#green[Surf Timer] #default- #lightgreen%s has finished in #default%s#lightgreen." % (es.getplayername(player), formatTime(timeTaken))) for userid in es.getUseridList(): es.playsound(userid, "ui/scored.wav", 0.5) started.remove(player) #End Lange modifications else: lowerVertex, upperVertex = mapDicts[str(currentMap)]["startpos"] if vecmath.isbetweenRect(es.getplayerlocation(player), lowerVertex, upperVertex): players[player] = [time.time(), 0] elif (int(es.getplayerteam(player)) > 1): c_player = playerlib.getPlayer(player) if (c_player.attributes["isdead"] == 0): lowerVertex, upperVertex = mapDicts[str(currentMap)]["startpos"] if vecmath.isbetweenRect(es.getplayerlocation(player), lowerVertex, upperVertex): """ Player has started """ tokens = {} tokens['name'] = es.getplayername(player) tell(player, "started", tokens) started.append(player) players[player] = [time.time(), 0] gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) except KeyError: pass