Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * :-)
- */
- /*
- * MAIN.NUT
- */
- DoIncludeScript("achiev_map/state.nut", null);
- DoIncludeScript("achiev_map/messages.nut", null);
- DoIncludeScript("achiev_map/bot-controller.nut", null);
- Event_RoundStart <- function()
- {
- if (!::state.exists("init"))
- {
- ::state.init <- true;
- ::state.bots <- {
- ct = true,
- t = true,
- };
- ::messages.Welcome( (ScriptGetGameMode() == 0 && ScriptGetGameType() == 3) ? true : false );
- SendToConsole("mp_warmup_end");
- }
- EntFire("credits_spammer", "enable", "", 0, null);
- }
- /*
- * STATE.NUT
- */
- /*
- * hey stranger íf you are wandering here, i just want to say that this script is written by (C) me and im pretty proud (•◡•)
- * plz giv me github star https://gist.github.com/cokolele/58b997f4cafdb832b1647200eba1799f
- */
- if (!getroottable().rawin("state"))
- {
- local entHolder = Entities.FindByClassname(null, "worldspawn");
- local entState = Entities.CreateByClassname("info_target");
- entHolder.SetOwner(entState);
- entState = entHolder.GetOwner();
- if (entState.ValidateScriptScope())
- ::state <- entState.GetScriptScope();
- state.exists <- function(var)
- {
- return state.rawin(var);
- }
- }
- /*
- * MESSAGES.NUT
- */
- ::messages <- {};
- messages.Welcome <- function(validMode)
- {
- ScriptPrintMessageChatAll(" **");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" * Welcome to");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" * Achievement Map");
- ScriptPrintMessageChatAll(" *");
- if (validMode)
- ScriptPrintMessageChatAll(" * type !help");
- else
- ScriptPrintMessageChatAll(" * You should start the map in custom gamemode");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" **");
- }
- messages.Help <- function()
- {
- ScriptPrintMessageChatAll(" ");
- ScriptPrintMessageChatAll(" * !bot kick t - kicks all T bots");
- ScriptPrintMessageChatAll(" * !bot kick ct - kicks all CT bots");
- ScriptPrintMessageChatAll(" * !bot add t - adds up to 10 T bots");
- ScriptPrintMessageChatAll(" * !bot add ct - adds up to 10 CT bots");
- ScriptPrintMessageChatAll(" ");
- }
- messages.CTMax <- function()
- {
- ScriptPrintMessageChatAll(" ");
- ScriptPrintMessageChatAll(" CT bots at maximum");
- ScriptPrintMessageChatAll(" ");
- }
- messages.TMax <- function()
- {
- ScriptPrintMessageChatAll(" ");
- ScriptPrintMessageChatAll(" T bots at maximum");
- ScriptPrintMessageChatAll(" ");
- }
- messages.CTMin <- function()
- {
- ScriptPrintMessageChatAll(" ");
- ScriptPrintMessageChatAll(" CT bots at minimum");
- ScriptPrintMessageChatAll(" ");
- }
- messages.TMin <- function()
- {
- ScriptPrintMessageChatAll(" ");
- ScriptPrintMessageChatAll(" T bots at minimum");
- ScriptPrintMessageChatAll(" ");
- }
- messages.Auto <- function()
- {
- ScriptPrintMessageChatAll(" **");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" * map by:");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" * čokoladka:-)");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" * www.steamcommunity.com/id/nubikkk/");
- ScriptPrintMessageChatAll(" *");
- ScriptPrintMessageChatAll(" **");
- }
- /*
- messages.BotsMax <- function()
- {
- ScriptPrintMessageChatAll(" \x04**");
- ScriptPrintMessageChatAll(" \x04*\x06 You have reached maximum number of bots");
- ScriptPrintMessageChatAll(" \x04**");
- }
- messages.BotsMin <- function(team)
- {
- team = (team == 2) ? "T" : "CT";
- ScriptPrintMessageChatAll(" \x04**");
- ScriptPrintMessageChatAll(" \x04*\x06 You have reached minimum number of bots for team " + team);
- ScriptPrintMessageChatAll(" \x04**");
- }
- messages.BotsAdded <- function(num, team)
- {
- local whom = (num == 1) ? "bot" : "bots";
- num = num.tostring();
- team = (team == 2) ? "T" : "CT";
- ScriptPrintMessageChatAll(" \x04->\x09 You have added " + num + " " + whom + " to team " + team);
- }
- messages.BotsKicked <- function(num, team)
- {
- local whom = (num == 1) ? "bot" : "bots";
- num = num.tostring();
- team = (team == 2) ? "T" : "CT";
- ScriptPrintMessageChatAll(" \x04->\x09 You have kicked " + num + " " + whom + " from team " + team);
- }
- messages.BotsKickedAll <- function(team)
- {
- team = (team == 2) ? "T" : "CT";
- ScriptPrintMessageChatAll(" \x04->\x09 You have kicked all bot from team " + team);
- }
- */
- /*
- * BOT-CONTROLLER.NUT
- */
- Event_PlayerSay <- function()
- {
- if (this.event_data.text.find("!bot", 0) != null)
- {
- local text = this.event_data.text;
- if (text == "!bot kick t")
- {
- if (::state.bots.t)
- {
- SendToConsole("bot_kick t all");
- SendToConsole("bot_kick t");
- ::state.bots.t = false;
- }
- else ::messages.TMin();
- }
- else if (text == "!bot kick ct")
- {
- if (::state.bots.ct)
- {
- SendToConsole("bot_kick ct all");
- SendToConsole("bot_kick ct");
- ::state.bots.ct = false;
- }
- else ::messages.CTMin();
- }
- else if (text == "!bot add t")
- {
- if (!::state.bots.t)
- {
- local i;
- for (i = 0; i < 10; i++) SendToConsole("bot_add_t");
- ::state.bots.t = true;
- }
- else ::messages.TMax();
- }
- else if (text == "!bot add ct")
- {
- if (!::state.bots.ct)
- {
- local i;
- for (i = 0; i < 10; i++) SendToConsole("bot_add_ct");
- ::state.bots.ct = true;
- }
- else ::messages.CTMax();
- }
- }
- if (this.event_data.text.find("!help", 0) != null)
- {
- ::messages.Help();
- }
- }
- /*::botsController <- {};
- botsController._CheckBotsMax <- function()
- {
- if ((state.ct + state.t) >= 30)
- {
- messages.BotsMax();
- return true;
- }
- return false
- }
- botsController._CheckBotsMin <- function(team)
- {
- printl(" t: " + ::state.t);
- printl(" ct: " + ::state.ct);
- if ((team == 2 && ::state.t <= 0) || (team == 3 && ::state.ct <= 0))
- {
- messages.BotsMin(team);
- return true;
- }
- return false;
- }
- botsController.BotsAdd <- function(num, team)
- {
- if (this._CheckBotsMax()) return;
- local added;
- for (added = 0; added < num; added++)
- {
- if (this._CheckBotsMax()) break;
- if (team == 2) SendToConsole("bot_add_t");
- else SendToConsole("bot_add_ct");
- }
- messages.BotsAdded(added, team);
- }
- botsController.state <- {
- kicking = false
- team = null
- initialNum = null
- currentNum = null
- }
- botsController.BotsKick <- function(num, team)
- {
- if (!this.state.kicking)
- {
- if (this._CheckBotsMin(team)) return;
- if (num == 1)
- {
- if (team == 2) SendToConsole("bot_kick t");
- else SendToConsole("bot_kick ct");
- messages.BotsKicked(1, team);
- }
- else
- {
- if (team == 2) SendToConsole("bot_kick t");
- else SendToConsole("bot_kick ct");
- this.state = {
- kicking = true
- team = team
- initialNum = num
- currentNum = num--
- }
- }
- }
- else
- {
- if (this._CheckBotsMin(this.state.team) && this.state.currentNum > 0)
- {
- messages.BotsKicked((this.state.initialNum - this.state.currentNum), this.team);
- this.state.kicking = false;
- return;
- }
- else if (this.state.currentNum > 0)
- {
- if (this.state.team == 2) SendToConsole("bot_kick t");
- else SendToConsole("bot_kick ct");
- this.state.currentNum--;
- }
- else{
- messages.BotsKicked(this.state.initialNum, this.team);
- this.state.kicking = false;
- }
- }
- }
- */
- /*
- function BotsKickAll(team)
- {
- if (this._CheckBotsMin(team)) return;
- if (team == 2) {
- this.t = 0;
- SendToConsole("bot_kick t all");
- } else {
- this.ct = 0;
- SendToConsole("bot_kick ct all");
- }
- ::messages.BotsKickedAll(team);
- }
- function _BotKick(team)
- {
- if (team == 2) {
- this.t--;
- SendToConsole("bot_kick t");
- } else {
- this.ct--;
- SendToConsole("bot_kick ct");
- }
- }
- function _CheckBotsMax()
- {
- if ((this.ct + this.t) == this.MAX_BOTS) {
- ::messages.BotsMax();
- return true;
- }
- return false;
- }
- function _CheckBotsMin(team)
- {
- if ((this.t == this.MIN_BOTS && team == 2) || (this.ct == this.MIN_BOTS && team == 3)) {
- ::messages.BotsMin(team);
- return true;
- }
- return false;
- }
- }
- */
Add Comment
Please, Sign In to add comment