entfirebyhandle if("MAX_PLAYERS" in this) return const TEAM_CT = 3 const TEAM_T = 2 const SND_CT_WIN = "radio/ctwin.wav" const SND_T_WIN = "radio/terwin.wav" const SND_ROUND_END = "radio/rounddraw.wav" const MSG_PREFIX = "\x07FF0000[INFO] \x07FFFFFF" entfirebyhandle How to get it for free? entfirebyhandle MAX_PLAYERS <- MaxClients().tointeger() RoundTime <- null RoundInit <- false NotEnough <- false PickRandom <- true Jugger <- null JuggerWeapon <- null entfirebyhandle How to get it? entfirebyhandle SendToServerConsole("mp_restartgame 3;mp_timelimit 0;mp_ignore_round_win_conditions 1;mp_autoteambalance 0;mp_freezetime 5;mp_roundtime 5") ClientPrint(null, 3, MSG_PREFIX + "Скрипт запущен") function CollectEventsInScope(events) { local events_id = UniqueString() getroottable()[events_id] <- events local events_table = getroottable()[events_id] entfirebyhandle How to get it for free? entfirebyhandle local Instance = Entities.First() foreach (name, callback in events) { local callback_binded = callback.bindenv(this) events_table[name] = @(params) Instance.IsValid() ? callback_binded(params) : delete getroottable()[events_id] } __CollectGameEventCallbacks(events_table) } CollectEventsInScope entfirebyhandle How to use it? entfirebyhandle ({ function OnGameEvent_round_start(d) { if(CountAlivePlayers(0) < 2) { NotEnough = true ClientPrint(null, 3, MSG_PREFIX + "Недостаточно игроков для начала игры") return } entfirebyhandle How to get it for free? entfirebyhandle RoundInit = true for(local i = 1; i <= MAX_PLAYERS; i++) { local ply = PlayerInstanceFromIndex(i) if(!ply) continue ChangeTeam(ply, TEAM_CT) ply.SetHealth(100) ply.TerminateScriptScope() entfirebyhandle PasteShr entfirebyhandle NetProps.SetPropString(ply, "m_iszScriptThinkFunction", "") NetProps.SetPropInt(ply, "m_takedamage", 2) NetProps.SetPropFloat(ply, "m_flMaxspeed", 250.00) NetProps.SetPropInt(ply, "m_iAccount", 64000) } RoundTime = NetProps.GetPropInt(Entities.FindByClassname(null, "cs_gamerules"), "m_iRoundTime") NetProps.SetPropString(Entities.First(), "m_iszScriptThinkFunction", "") EntFire("func_buyzone", "SetTeam", TEAM_CT) entfirebyhandle PasteShr entfirebyhandle if(PickRandom) Jugger = GetRandomPlayer() ChangeTeam(Jugger, TEAM_T) StripWeapon(Jugger) JuggerWeapon = GiveWeapon(Jugger, "weapon_m249") EntFire("weapon_c4", "Kill") AddThinkToEnt(Jugger, "JuggerThink") entfirebyhandle How to use it? entfirebyhandle Jugger.SetHealth(1025 * CountAlivePlayers(TEAM_CT)) NetProps.SetPropFloat(Jugger, "m_flMaxspeed", 135.00) ClientPrint(null, 3, MSG_PREFIX + "Игрок \x07FF0000" + NetProps.GetPropString(Jugger, "m_szNetname") + " \x07FFFFFFстал Джаггернаутом") } function OnGameEvent_player_spawn(d) { if(CountAlivePlayers(0) == 2 && NotEnough) { entfirebyhandle How to get it for free? entfirebyhandle NotEnough = false ClientPrint(null, 3, MSG_PREFIX + "Зашло нужное количество игроков, игра началась!") SendToServerConsole("mp_restartgame 3") } } function OnGameEvent_player_death(d) { local ply = GetPlayerFromUserID(d.userid) local attacker = GetPlayerFromUserID(d.attacker) entfirebyhandle How to use it? entfirebyhandle if(CountAlivePlayers(TEAM_CT) == 0) { PickRandom = true SendToServerConsole("mp_restartgame 5") EmitSoundEx( { sound_name = SND_T_WIN sound_level = 0 entfirebyhandle How to get it? entfirebyhandle }) ShowText("Джаггернаут победил", 255, 0, 0) ClientPrint(null, 3, MSG_PREFIX + "Джаггернаут одержал победу") } else if(CountAlivePlayers(TEAM_T) == 0) { SendToServerConsole("mp_restartgame 5") NetProps.SetPropString(Jugger, "m_iszScriptThinkFunction", "") if(attacker) entfirebyhandle How to dowload it? entfirebyhandle { Jugger = attacker PickRandom = false ClientPrint(null, 3, MSG_PREFIX + "Игрок \x07FF0000" + NetProps.GetPropString(attacker, "m_szNetname") + " \x07FFFFFFубил Джаггернаута!") } EmitSoundEx( { sound_name = SND_CT_WIN sound_level = 0 entfirebyhandle How to get it for free? entfirebyhandle }) ShowText("Синие победили", 0, 0, 255) ClientPrint(null, 3, MSG_PREFIX + "Синие одержали победу") } } function OnGameEvent_player_disconnect(d) { local ply = GetPlayerFromUserID(d.userid) entfirebyhandle How to dowload it? entfirebyhandle if(ply == Jugger) { Jugger = null PickRandom = true SendToServerConsole("mp_restartgame 5") EmitSoundEx( { sound_name = SND_CT_WIN sound_level = 0 entfirebyhandle How to dowload it? entfirebyhandle }) ShowText("Синие победили", 0, 0, 255) ClientPrint(null, 3, MSG_PREFIX + "Джаггернаут отключился, синие победили") } } function OnGameEvent_round_freeze_end(d) { if(!RoundInit) return AddThinkToEnt(Entities.First(), "Think") entfirebyhandle PasteShr entfirebyhandle } function OnScriptHook_OnTakeDamage(d) { if(!d.attacker) return if(d.const_entity.IsPlayer() && d.attacker.IsPlayer() && d.const_entity.GetTeam() != d.attacker.GetTeam()) { d.attacker.ValidateScriptScope() local sc = d.attacker.GetScriptScope() entfirebyhandle PasteShr entfirebyhandle if(d.attacker == Jugger) d.damage = d.damage / 2.1 if(!("Text" in sc)) { sc.Text <- SpawnEntityFromTable("game_text", { x = -1 y = 0.6 color = "255 255 255" entfirebyhandle PasteShr entfirebyhandle holdtime = 1 fadeout = 0.5 }) NetProps.SetPropBool(sc.Text, "m_bForcePurgeFixedupStrings", true) } NetProps.SetPropString(sc.Text, "m_iszMessage", "-" + d.damage.tointeger() + "\n" + (d.const_entity.GetHealth() - d.damage + 1 <= 0 ? 0 : d.const_entity.GetHealth() - d.damage + 1).tointeger()) sc.Text.AcceptInput("Display", "", d.attacker, null) entfirebyhandle How to use it? entfirebyhandle EntFireByHandle(sc.Text, "Kill", "", 0, null, null) EntFireByHandle(d.attacker, "RunScriptCode", "delete self.GetScriptScope().Text", 0, null, null) } } }) function CountAlivePlayers(team) { local num = 0 entfirebyhandle PasteShr entfirebyhandle for(local i = 1; i <= MAX_PLAYERS; i++) { local ply = PlayerInstanceFromIndex(i) if(!ply || !ply.IsAlive()) continue if(team == 0 || ply.GetTeam() == team) { num++ } } entfirebyhandle How to use it? entfirebyhandle return num } function GetRandomPlayer() { local players = [] for(local i = 1; i <= MAX_PLAYERS; i++) { entfirebyhandle How to get it? entfirebyhandle local ply = PlayerInstanceFromIndex(i) if(!ply || !ply.IsAlive()) continue players.append(ply) } return players[RandomInt(0, players.len() -1)] } function ChangeTeam(player, team) entfirebyhandle PasteShr entfirebyhandle { NetProps.SetPropInt(player, "m_iPlayerState", 0) NetProps.SetPropInt(player, "m_iTeamNum", team) player.SetTeam(team) player.DispatchSpawn() } function StripWeapon(player) { entfirebyhandle How to use it? entfirebyhandle local weaponStrip = Entities.CreateByClassname("player_weaponstrip") weaponStrip.AcceptInput("Strip", "", player, null) NetProps.SetPropBool(weaponStrip, "m_bForcePurgeFixedupStrings", true) weaponStrip.Destroy() } function GiveWeapon(player, classname) { entfirebyhandle How to use it? entfirebyhandle local weapon = SpawnEntityFromTable(classname, { ammo = 3000 origin = player.GetOrigin() teamnum = player.GetTeam() }) weapon.SetClip1(0) NetProps.SetPropBool(weapon, "m_bForcePurgeFixedupStrings", true) entfirebyhandle How to get it for free? entfirebyhandle return weapon } function ShowText(msg, r, g, b) { local text = null if(!text) { text = SpawnEntityFromTable("game_text", entfirebyhandle How to use it? entfirebyhandle { x = -1 y = 0.3 holdtime = 6 spawnflags = 1 }) } text.__KeyValueFromVector("color", Vector(r, g, b)) NetProps.SetPropString(text, "m_iszMessage", msg) entfirebyhandle How to get it for free? entfirebyhandle return text.AcceptInput("Display", "", null, null) } function JuggerThink() { local weapon = NetProps.GetPropEntity(self, "m_hActiveWeapon") if(!JuggerWeapon.GetOwner() || weapon != JuggerWeapon) { JuggerWeapon.Destroy() entfirebyhandle How to use it? entfirebyhandle StripWeapon(self) JuggerWeapon = GiveWeapon(self, "weapon_m249") } return -1 } function Think() { RoundTime-- entfirebyhandle How to get it? entfirebyhandle if(RoundTime <= 0) { NetProps.SetPropString(self, "m_iszScriptThinkFunction", "") SendToServerConsole("mp_restartgame 5") for(local i = 1; i <= MAX_PLAYERS; i++) { local ply = PlayerInstanceFromIndex(i) if(!ply || !ply.IsAlive()) continue entfirebyhandle How to dowload it? entfirebyhandle NetProps.SetPropInt(ply, "m_takedamage", 0) } EmitSoundEx( { sound_name = SND_ROUND_END sound_level = 0 }) ShowText("Раунд закончился", 255, 255, 255) entfirebyhandle How to get it for free? entfirebyhandle ClientPrint(null, 3, MSG_PREFIX + "Раунд завершен") } return 1 } entfirebyhandle