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,())
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 load(): global gui, gui2 gui = lambda x: x.replace('#green','').replace('#default','').replace('#lightgreen','') gui2 = lambda x,y: gui(x.replace('#lightgreen%s'%y,' ')) xavictimstats.xasettings.registerMethod(xavictimstats, sendmenu, xalang['Victim Stats Options']) xavictimstatscommand = xavictimstats.addCommand('xa_victimstatssetting', sendmenu, 'victimstats_settingtings', 'UNRESTRICTED') xavictimstatscommand.register(['console', 'server']) if str(victimstats_command): xavictimstatssaycommand = xavictimstats.addCommand(str(victimstats_command), display, 'victim_stats', 'UNRESTRICTED', 'Send player stats while alive') xavictimstatssaycommand.register(['say']) for userid in playerlib.getUseridList('#human'): gamethread.queue(default, str(userid))
def player_spawn_f(userid): userteam = es.getplayerteam(userid) if userteam < 2: return steamid = getplayerid(userid) if steamid != "BOT": skin = str(es.keygetvalue(steamid, "player_data", "skin")) primary_weapon = str( es.keygetvalue(steamid, "player_data", "primary_weapon")) secondary_weapon = str( es.keygetvalue(steamid, "player_data", "secondary_weapon")) if skin == "sas": est.setmodel(userid, "player/ct_sas.mdl") esc.tell( userid, "#0,255,255[Player Skins Effect]#255,255,255 Free #55,55,55Night#0,255,0vision" ) est.give(userid, "item_nvgs") est.give(userid, "item_assaultsuit") es.setplayerprop(userid, _moneyprop, 0) est.removeweapon(userid, 1) est.removeweapon(userid, 2) if "weapon" in primary_weapon: est.give(userid, primary_weapon) if "weapon" in secondary_weapon: est.give(userid, secondary_weapon) est.speed(userid, 1.5) if steamid == "BOT": username = es.getplayername(userid) if "Gangsters" in username: number = int(username.split()[2]) role = random.choice(["rifler", "melee"]) if role == "rifler": est.setmodel(userid, "player/t_phoenix.mdl") est.removeweapon(userid, 1) est.removeweapon(userid, 2) gamethread.queue( es.ServerCommand, ('es_xgive %s weapon_%s' % (userid, random.choice([ "glock", "ak47", "famas", "mac10", "mp5navy", "ump45" ])))) elif role == "melee": est.setmodel(userid, "player/t_arctic.mdl") est.removeweapon(userid, 1) est.removeweapon(userid, 2) est.sethealth(userid, 100)
def player_spawn_f(userid): userteam = es.getplayerteam(userid) if userteam < 2: return steamid = getplayerid(userid) if steamid != "BOT": skin = str(es.keygetvalue(steamid, "player_data", "skin")) primary_weapon = str(es.keygetvalue(steamid, "player_data", "primary_weapon")) secondary_weapon = str(es.keygetvalue(steamid, "player_data", "secondary_weapon")) if skin == "sas": est.setmodel(userid, "player/ct_sas.mdl") esc.tell(userid, "#0,255,255[Player Skins Effect]#255,255,255 Free #55,55,55Night#0,255,0vision") est.give(userid, "item_nvgs") est.give(userid, "item_assaultsuit") es.setplayerprop(userid, _moneyprop, 0) est.removeweapon(userid, 1) est.removeweapon(userid, 2) if "weapon" in primary_weapon: est.give(userid, primary_weapon) if "weapon" in secondary_weapon: est.give(userid, secondary_weapon) est.speed(userid, 1.5) if steamid == "BOT": username = es.getplayername(userid) if "Gangsters" in username: number = int(username.split()[2]) role = random.choice(["rifler", "melee"]) if role == "rifler": est.setmodel(userid, "player/t_phoenix.mdl") est.removeweapon(userid, 1) est.removeweapon(userid, 2) gamethread.queue(es.ServerCommand, ('es_xgive %s weapon_%s' %(userid, random.choice(["glock", "ak47", "famas", "mac10", "mp5navy", "ump45"])))) elif role == "melee": est.setmodel(userid, "player/t_arctic.mdl") est.removeweapon(userid, 1) est.removeweapon(userid, 2) est.sethealth(userid, 100)
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 _freeze(userid, adminid, args): player = playerlib.getPlayer(userid) if str(xa_adminfreeze_anonymous) == '0': tokens = {} tokens['admin'] = es.getplayername(adminid) tokens['user'] = es.getplayername(userid) for player in playerlib.getPlayerList(): tokens['state'] = xalanguage("frozen", lang=player.get("lang")) if player.get('freeze') == '0' else xalanguage("defrosted", lang=player.get("lang")) es.tell(int(player), xalanguage("admin state", tokens, player.get("lang"))) if player.get('freeze') == '0': gamethread.queue(player.set, ('noclip', 1)) gamethread.queue(player.set, ('freeze', 1)) else: gamethread.queue(player.set, ('freeze', 0))
def _freeze(userid, adminid, args): player = playerlib.getPlayer(userid) if str(xa_adminfreeze_anonymous) == '0': tokens = {} tokens['admin'] = es.getplayername(adminid) tokens['user'] = es.getplayername(userid) for player in playerlib.getPlayerList(): tokens['state'] = xalanguage("frozen", lang=player.get( "lang")) if player.get('freeze') == '0' else xalanguage( "defrosted", lang=player.get("lang")) es.tell(int(player), xalanguage("admin state", tokens, player.get("lang"))) if player.get('freeze') == '0': gamethread.queue(player.set, ('noclip', 1)) gamethread.queue(player.set, ('freeze', 1)) else: gamethread.queue(player.set, ('freeze', 0))
def wait(desc='Delay code execution for one tick'): if sv.eventscripts_currentmap: stack.kill() sv.save() queue(stack.runall)
def soon(argv, args): queue(stack.queueline, (argv[0], argv[1:], args, esc.stack.currentblock, True))
def run(self): es.dbgmsg(1, '[ESThread] ThreadedMethod.run()') if es.__dict__.has_key(self.method): gamethread.queue(self.execute) while not self.done: time.sleep(0.001)
def Shutdown(self): id = es.getUseridList()[0] es.fire(id,self.NAME,'StopOverlays') gamethread.queue(es.fire,(id,self.NAME,'kill'))
import es