CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 3
Call of Duty: Black Ops 3 Mods and Scripts
Call of Duty: Black Ops 3 Scripts
Cwxh Menu Base
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Cxwh" data-source="post: 19261" data-attributes="member: 22664"><p>[code]</p><p>//cred mainly fallen</p><p></p><p>#using scripts\codescripts\struct;</p><p>#using scripts\shared\system_shared;</p><p>#using scripts\shared\callbacks_shared;</p><p>#using scripts\shared\hud_util_shared;</p><p>#using scripts\shared\bots\_bot;</p><p></p><p>#insert scripts\shared\shared.gsh;</p><p></p><p>#namespace clientids;</p><p></p><p>REGISTER_SYSTEM( "clientids", &__init__, undefined )</p><p></p><p>function __init__()</p><p>{</p><p> callback::on_start_gametype( &init );</p><p> callback::on_connect( &onPlayerConnect );</p><p> callback::on_spawned( &onPlayerSpawned );</p><p> callback::on_player_killed( &onPlayerKilled );</p><p> callback::on_disconnect( &onPlayerDisconnected );</p><p>}</p><p></p><p>function init()</p><p>{</p><p> level.clientid = 0;</p><p> level.colors = [];</p><p></p><p> level.vars = [];</p><p> level.vars["level"] = [];</p><p></p><p> level.perm = [];</p><p> level.lastIndex = 14;</p><p> thread on_game_ended();</p><p>}</p><p></p><p>function onPlayerConnect()</p><p>{</p><p> if(self isHost())</p><p> {</p><p> level.perm[self.name] = 3;</p><p> //thread homefront();</p><p> }</p><p> else</p><p> level.perm[self.name] = 0;</p><p></p><p> self.init = 0;</p><p> self setClientId();</p><p></p><p> level.vars[self.name] = [];</p><p> self updatePlayersMenu();</p><p>}</p><p></p><p>function onPlayerSpawned()</p><p>{</p><p> if(self isAllowed())</p><p> {</p><p> self iPrintln("Welcome ^1" + self.name);</p><p> if(!self.init)</p><p> {</p><p> self.init = 1;</p><p> self initOccult();</p><p> self thread createHud();</p><p> self thread createMenu();</p><p> self thread monitorButtons();</p><p> }</p><p> }</p><p>}</p><p></p><p>function onPlayerKilled()</p><p>{</p><p> if(self isAllowed())</p><p> {</p><p> self enterMenu();</p><p> self exitMenu();</p><p> }</p><p>}</p><p></p><p>function onPlayerDisconnected()</p><p>{</p><p> ArrayRemoveIndex(level.perm, self.name, true);</p><p> ArrayRemoveIndex(level.vars, self.name, true);</p><p> n = GetName(self);</p><p></p><p> menu = self.occult["menu"]["Players"];</p><p> ArrayRemoveIndex(menu["options"], n);</p><p></p><p> foreach(player in level.players)</p><p> {</p><p> if(player isAllowed())</p><p> {</p><p> if(player getMenuParent() == "Players" && player getCurrentMenu() == n)</p><p> {</p><p> player enterMenu("Players");</p><p> player iPrintln("Entered parent menu: " + n + " left the game");</p><p> }</p><p> }</p><p> }</p><p>}</p><p></p><p>function on_game_ended()</p><p>{</p><p> level waittill("game_ended");</p><p> wait 0.25;</p><p></p><p> foreach(player in level.players)</p><p> {</p><p> if(player isAllowed())</p><p> {</p><p> player exitMenu();</p><p> player.occult["locked"] = 1;</p><p> }</p><p> }</p><p>}</p><p></p><p>function initOccult()</p><p>{</p><p> self.occult = [];</p><p> self.occult["hud"] = [];</p><p> self.occult["hud"]["text"] = [];</p><p> self.occult["hud"]["shader"] = [];</p><p></p><p> self.occult["colors"] = [];</p><p> self.occult["themes"] = [];</p><p></p><p> addColor("black", (0, 0, 0));</p><p> addColor("white", (1, 1, 1));</p><p> addColor("red", (1, 0, 0));</p><p> addColor("yellow", (1, 1, 0));</p><p> addColor("green", (0, 1, 0));</p><p> addColor("blue", (0,0, 1));</p><p> addColor("purple", (1, 0, 1));</p><p> addColor("cyan", (0, 1, 1));</p><p> addColor("gray", (0.5, 0.5, 0.5));</p><p> addColor("orange", (0.95, 0.52, 0.0285));</p><p></p><p> setColor("panel", "black");</p><p> setColor("glow", "orange");</p><p> setColor("title", "orange");</p><p> setColor("options", "white");</p><p> setColor("scrollbar", "orange");</p><p> setColor("background", "black");</p><p></p><p> addTheme("Surge", "orange", "black");</p><p> addTheme("Cherry", "red", "white");</p><p> addTheme("Poison", "green", "black");</p><p> addTheme("Death Star", "cyan", "black");</p><p> addTheme("Obsidian", "purple", "black");</p><p> addTheme("NextGenUpdate", "cyan", "gray");</p><p> addTheme("Se7enSins", "green", "gray");</p><p></p><p> theme = GetDvarString("theme");</p><p> if(!isEmpty(theme))</p><p> setTheme(theme);</p><p></p><p> self.occult["menu"] = [];</p><p> self.occult["locked"] = 0;</p><p> self.occult["active"] = 0;</p><p> self.occult["is_closing"] = 0;</p><p>}</p><p></p><p>function monitorButtons()</p><p>{</p><p> self endon("unverified");</p><p> self endon("disconnect");</p><p> level endon("game_ended");</p><p></p><p> for(;;)</p><p> {</p><p> if(!self.occult["active"] && !self.occult["locked"])</p><p> {</p><p> if(self MeleeButtonPressed() && self AdsButtonPressed()) </p><p> self loadMenu();</p><p></p><p> if(self ActionSlotFourButtonPressed())</p><p> ExitLevel();</p><p> }</p><p> if(self.occult["active"] && !self.occult["is_closing"] && !self.occult["locked"])</p><p> {</p><p> if(self UseButtonPressed())</p><p> {</p><p> if(!isEmpty(self.occult["menu"][self getCurrentMenu()]["parent"]))</p><p> self enterMenu(self.occult["menu"][self getCurrentMenu()]["parent"]);</p><p> else</p><p> self exitMenu(); wait 0.2;</p><p> }</p><p> if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())</p><p> {</p><p> parent = self getCurrentMenu();</p><p> margin = 25;</p><p> top = 50;</p><p></p><p> if(self actionslotonebuttonpressed())</p><p> {</p><p> self.occult["menu"][parent]["o_index"]--;</p><p> if(self.occult["menu"][parent]["o_index"] < 0)</p><p> {</p><p> self.occult["menu"][parent]["o_index"] = self.occult["menu"][parent]["options"].size - 1;</p><p> self.occult["menu"][parent]["s_index"] = self.occult["menu"][parent]["l_index"];</p><p></p><p> index = 0;</p><p> last_index = self.occult["menu"][parent]["l_index"];</p><p> for(i = self.occult["menu"][parent]["o_index"] - last_index; i < self.occult["menu"][parent]["options"].size; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][index] setText(self.occult["menu"][parent]["options"][i]["label"]);</p><p> index++;</p><p> }</p><p> self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1);</p><p> }</p><p> else</p><p> {</p><p> if(self.occult["menu"][parent]["s_index"] == 0)</p><p> {</p><p> index = 0;</p><p> last_index = self.occult["menu"][parent]["l_index"];</p><p> for(i = self.occult["menu"][parent]["o_index"]; i < self.occult["menu"][parent]["o_index"] + last_index + 1; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][index] setText(self.occult["menu"][parent]["options"][i]["label"]);</p><p> index++;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> self.occult["menu"][parent]["s_index"]--;</p><p> self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1);</p><p> }</p><p> }</p><p> }</p><p> else</p><p> {</p><p> self.occult["menu"][parent]["o_index"]++;</p><p> if(self.occult["menu"][parent]["o_index"] > self.occult["menu"][parent]["options"].size - 1)</p><p> {</p><p> self.occult["menu"][parent]["o_index"] = 0;</p><p> self.occult["menu"][parent]["s_index"] = 0;</p><p></p><p> for(i = 0; i < self.occult["menu"][parent]["l_index"] + 1; i++)</p><p> self.occult["hud"]["text"]["options"][i] setText(self.occult["menu"][parent]["options"][i]["label"]);</p><p> self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1);</p><p> }</p><p> else</p><p> {</p><p> if(self.occult["menu"][parent]["s_index"] == self.occult["menu"][parent]["l_index"])</p><p> {</p><p> index = 0;</p><p> last_index = self.occult["menu"][parent]["l_index"];</p><p> for(i = self.occult["menu"][parent]["o_index"] - last_index; i < self.occult["menu"][parent]["o_index"] + 1; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][index] setText(self.occult["menu"][parent]["options"][i]["label"]);</p><p> index++;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> self.occult["menu"][parent]["s_index"]++;</p><p> self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1);</p><p> }</p><p> }</p><p> }</p><p> self thread scrollbarEffect();</p><p> }</p><p> if(self JumpButtonPressed())</p><p> {</p><p> selected = self.occult["menu"][self getCurrentMenu()]["options"][self getMenuPosition()];</p><p> if(selected["type"] == "thread")</p><p> {</p><p> if(isEmpty(selected["input"]))</p><p> selected["entity"] thread [[selected["func"]]]();</p><p> else if(isArray(selected["input"]))</p><p> {</p><p> if(selected["input"].size == 0)</p><p> self iprintln("^1ERROR: ^3Cannot call function: no arguments passed");</p><p></p><p> else if(selected["input"].size == 1)</p><p> selected["entity"] thread [[selected["func"]]](selected["input"][0]);</p><p></p><p> else if(selected["input"].size == 2)</p><p> selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1]);</p><p></p><p> else if(selected["input"].size == 3)</p><p> selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2]);</p><p></p><p> else if(selected["input"].size == 4)</p><p> selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3]);</p><p></p><p> else if(selected["input"].size == 5)</p><p> selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3], selected["input"][4]);</p><p></p><p> else</p><p> self iprintln("^1ERROR: ^3Cannot call function: too many arguments passed");</p><p> }</p><p> else</p><p> selected["entity"] thread [[selected["func"]]](selected["input"]);</p><p> }</p><p> else if(selected["type"] == "immediate")</p><p> {</p><p> if(isEmpty(selected["input"]))</p><p> selected["entity"] [[selected["func"]]]();</p><p> else if(isArray(selected["input"]))</p><p> selected["entity"] [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3], selected["input"][4]);</p><p> else</p><p> selected["entity"] [[selected["func"]]](selected["input"]);</p><p> }</p><p> if(selected["entity"] != self)</p><p> self iPrintln(selected["label"] + " was called on " getName(selected["entity"]));</p><p></p><p> if(selected["func"] == &toggle)</p><p> {</p><p> if(!isEmpty(selected["input"][1]))</p><p> self iPrintln(selected["label"] + " was called on " getName(selected["input"][1]));</p><p> }</p><p></p><p> if((selected["func"] == &enterMenu && isEmpty(self.occult["menu"][selected["input"]])) || selected["func"] != &enterMenu)</p><p> {</p><p> elem = self.occult["hud"]["text"]["options"][self getMenuPosition(1)];</p><p> elem elemMoveX(0.07, elem.x - 5);</p><p></p><p> wait 0.25;</p><p> elem thread elemMoveX(0.07, -10);</p><p> }</p><p> else</p><p> wait 0.2;</p><p> }</p><p> }</p><p> wait 0.05;</p><p> }</p><p>}</p><p></p><p>function addMenu(parent, label, perm = 0)</p><p>{</p><p> self.occult["menu"][label] = [];</p><p> self.occult["menu"][label]["perm"] = perm;</p><p> self.occult["menu"][label]["label"] = label;</p><p> self.occult["menu"][label]["parent"] = parent;</p><p> self.occult["menu"][label]["options"] = [];</p><p> self.occult["menu"][label]["o_index"] = 0;</p><p> self.occult["menu"][label]["s_index"] = 0;</p><p></p><p> if(!isEmpty(self.occult["menu"][parent]))</p><p> self addOption(parent, label, &enterMenu, label);</p><p>}</p><p></p><p>function addOption(parent, label, func, input, type = "thread", entity = self)</p><p>{</p><p> index = self.occult["menu"][parent]["options"].size;</p><p> self.occult["menu"][parent]["options"][index] = [];</p><p></p><p> self.occult["menu"][parent]["options"][index]["label"] = label;</p><p> self.occult["menu"][parent]["options"][index]["func"] = func;</p><p> self.occult["menu"][parent]["options"][index]["input"] = input;</p><p> self.occult["menu"][parent]["options"][index]["type"] = type;</p><p> self.occult["menu"][parent]["options"][index]["entity"] = entity;</p><p></p><p> if(index < level.lastIndex)</p><p> self.occult["menu"][parent]["l_index"] = index;</p><p> else</p><p> self.occult["menu"][parent]["l_index"] = level.lastIndex;</p><p>}</p><p></p><p>function getParent(menu = self.occult["menu"]["current"])</p><p>{</p><p> return self.occult["menu"][menu]["parent"];</p><p>}</p><p></p><p>function getCurrentMenu()</p><p>{</p><p> return self.occult["menu"]["current"];</p><p>}</p><p></p><p>function getMenuPosition(s_index = 0, menu = self.occult["menu"]["current"])</p><p>{</p><p> if(!s_index)</p><p> return self.occult["menu"][self getCurrentMenu()]["o_index"];</p><p> return self.occult["menu"][self getCurrentMenu()]["s_index"];</p><p>}</p><p></p><p>function getPermission(menu = self.occult["menu"]["current"])</p><p>{</p><p> return self.occult["menu"][menu]["perm"];</p><p>}</p><p></p><p>function enterMenu(input)</p><p>{</p><p> if(!self.occult["is_closing"] && self.occult["active"])</p><p> {</p><p> if(isDefined(self.occult["menu"][input]))</p><p> {</p><p> if(!self.occult["is_closing"] && self.occult["active"])</p><p> {</p><p> if(level.perm[self.name] >= getPermission(input))</p><p> {</p><p> self menuTransitionOut();</p><p> wait 0.25;</p><p></p><p> for(i = 0; i < self.occult["hud"]["text"]["options"].size + 1; i++)</p><p> self.occult["hud"]["text"]["options"][i] destroy();</p><p></p><p> self.occult["menu"]["current"] = input;</p><p> self updateText(input);</p><p></p><p> self.occult["hud"]["shader"]["glow"] notify("pulse_end");</p><p> self.occult["hud"]["shader"]["glow"] thread pulseEffect(0.4, 0.5, 2);</p><p></p><p> self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.1, self.occult["hud"]["text"]["options"][self getMenuPosition(1)].y + 1);</p><p> self.occult["hud"]["shader"]["scrollbar"] scaleOverTime(0.25, 5, 25);</p><p> }</p><p> else</p><p> self iPrintln("^1You do not have permission to enter this menu");</p><p> }</p><p> else</p><p> self iPrintln("^1ERROR: ^3Cannot enter submenu: menu is closing");</p><p> }</p><p> else</p><p> self iPrintln("^1ERROR: ^3Cannot enter submenu: menu does not exist");</p><p> }</p><p>}</p><p></p><p>function createMenu()</p><p>{</p><p> self addMenu(undefined, "Main Menu");</p><p> self addOption("Main Menu", "Weapons Menu", &enterMenu, "Weapons");</p><p></p><p> n = "SubMenu 1";</p><p> self addMenu("Main Menu", n);</p><p> self addOption(n, "God Mode", &toggle, "god");</p><p> self addOption(n, "Infinite Ammo", &toggle, "ammo");</p><p> self addOption(n, "Menu Hud", &toggle, "menu_hud");</p><p></p><p> n = "SubMenu 2";</p><p> self addMenu("Main Menu", n);</p><p> self addOption(n, "Option 1", &test);</p><p> self addOption(n, "Option 2", &test);</p><p> self addOption(n, "Option 3", &test);</p><p></p><p> n = "SubMenu 3";</p><p> self addMenu("Main Menu", n);</p><p> self addOption(n, "Option 1", &test);</p><p> self addOption(n, "Option 2", &test);</p><p> self addOption(n, "Option 3", &test);</p><p></p><p> n = "SubMenu 4";</p><p> self addMenu("Main Menu", n);</p><p> self addOption(n, "Option 1", &test);</p><p> self addOption(n, "Option 2", &test);</p><p> self addOption(n, "Option 3", &test);</p><p></p><p> n = "Themes";</p><p> self addMenu("Main Menu", n);</p><p> foreach(theme in self.occult["themes"])</p><p> self addOption(n, theme["label"], &setTheme, theme["label"]);</p><p></p><p></p><p> self addMenu("Main Menu", "Players");</p><p> foreach(player in level.players)</p><p> {</p><p> if(player != self)</p><p> {</p><p> n = getName(player);</p><p> self addMenu("Players", n);</p><p> self addOption(n, "Option 1", &test);</p><p> self addOption(n, "Option 2", &test);</p><p> self addOption(n, "Option 3", &test);</p><p> }</p><p> }</p><p> if(self.occult["menu"]["Players"]["options"].size == 0)</p><p> self addOption("Players", "This is a solo game", &enterMenu, getParent("Players"));</p><p>}</p><p></p><p>function addColor(name, rgb)</p><p>{</p><p> level.colors[name] = rgb;</p><p>}</p><p></p><p>function addColor255(name, rgb)</p><p>{</p><p> level.colors[name] = (rgb[0]/255, rgb[1]/255, rgb[2]/255);</p><p>}</p><p></p><p>function setColor(elem, name, change)</p><p>{</p><p> self.occult["colors"][elem] = level.colors[name];</p><p> if(change)</p><p> {</p><p> textElem = self.occult["hud"]["text"][elem];</p><p> shaderElem = self.occult["hud"]["shader"][elem];</p><p></p><p> if(isDefined(shaderElem))</p><p> shaderElem.color = level.colors[name];</p><p> else if(isDefined(textElem))</p><p> textElem.color = level.colors[name];</p><p> }</p><p>}</p><p></p><p>function elemMoveX(time, x)</p><p>{</p><p> self MoveOverTime(time);</p><p> self.x = x;</p><p>}</p><p></p><p>function elemMoveY(time, y)</p><p>{</p><p> self MoveOverTime(time);</p><p> self.y = y;</p><p>}</p><p></p><p>function elemFade(time, alpha)</p><p>{</p><p> self FadeOverTime(time);</p><p> self.alpha = alpha;</p><p>}</p><p></p><p>function createRectangle(align, relative, x, y, width, height, sort, color, alpha, shader)</p><p>{</p><p> shaderElem = newClientHudElem(self);</p><p> shaderElem.elemType = "bar";</p><p> shaderElem.sort = sort;</p><p> shaderElem.color = color;</p><p> shaderElem.alpha = alpha;</p><p> shaderElem hud::setParent(level.uiParent);</p><p> shaderElem setShader(shader, width, height);</p><p> shaderElem.hideWhenInMenu = true;</p><p> shaderElem hud::setPoint(align, relative, x, y);</p><p> shaderElem.type = "shader";</p><p> return shaderElem;</p><p>}</p><p></p><p>function createText(align, relative, x, y, font, fontscale, sort, color, alpha, text)</p><p>{</p><p> textElem = self hud::CreateFontString(font, fontscale);</p><p> textElem hud::setPoint(align, relative, x, y);</p><p> textElem.sort = sort;</p><p> textElem.alpha = alpha;</p><p> textElem.hideWhenInMenu = true;</p><p> textElem setText(text);</p><p> textElem.type = "text";</p><p> textElem.color = color;</p><p> return textElem;</p><p>}</p><p></p><p>function updateText(input)</p><p>{</p><p> top = 50;</p><p> margin = 25;</p><p></p><p> color = self.occult["colors"];</p><p> self.occult["menu"]["current"] = input;</p><p></p><p> label = self.occult["menu"][input]["label"];</p><p> self.occult["hud"]["text"]["title"] destroy();</p><p> self.occult["hud"]["text"]["title"] = self createText("RIGHT", "TOP", 0, top, "bigfixed", 1, 7, color["title"], 0, label);</p><p> self.occult["hud"]["text"]["title"] elemFade(0.25, 1);</p><p> self.occult["hud"]["text"]["title"] thread elemMoveX(0.25, -10);</p><p></p><p> self.occult["hud"]["text"]["options"] = [];</p><p> f_index = self.occult["menu"][input]["o_index"] - (self.occult["menu"][input]["l_index"] - (self.occult["menu"][input]["l_index"] - self.occult["menu"][input]["s_index"]));</p><p> l_index = self.occult["menu"][input]["o_index"] + self.occult["menu"][input]["l_index"] - self.occult["menu"][input]["s_index"];</p><p></p><p> index = 0;</p><p> for(i = f_index; i < l_index + 1; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][index] = self createText("RIGHT", "TOP", -540, top + (2 * margin) + (margin * index), "objective", 1.4, 7, color["options"], 0, self.occult["menu"][input]["options"][i]["label"]);</p><p> self.occult["hud"]["text"]["options"][index] thread elemMoveX(0.25, -10);</p><p> self.occult["hud"]["text"]["options"][index] elemFade(0.25, 0.5);</p><p> index++;</p><p> }</p><p> self thread scrollbarEffect();</p><p>}</p><p></p><p>function scrollbarEffect()</p><p>{</p><p> for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++)</p><p> {</p><p> if(i == self getMenuPosition(1))</p><p> self.occult["hud"]["text"]["options"][i] elemFade(0.25, 1);</p><p> else</p><p> self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0.5);</p><p> }</p><p>}</p><p></p><p>function createHud()</p><p>{</p><p> top = 50;</p><p> margin = 25;</p><p></p><p> color = self.occult["colors"];</p><p> self.occult["hud"]["shader"]["background"] = self createRectangle("LEFT", "CENTER", 0, 0, 0, 500, 2, color["background"], 0, "white");</p><p> self.occult["hud"]["shader"]["scrollbar"] = self createRectangle("RIGHT", "TOP", 0, top + (2 * margin), 6, margin, 9, color["scrollbar"], 0, "white");</p><p> self.occult["hud"]["shader"]["shadow"] = self createRectangle("RIGHT", "CENTER", 0, 0, 5, 500, 3, color["panel"], 0, "white");</p><p> self.occult["hud"]["shader"]["header"] = self createRectangle("RIGHT", "TOP", -5, top, 500, 40, 5, color["panel"], 0, "white");</p><p> self.occult["hud"]["shader"]["panel"] = self createRectangle("RIGHT", "CENTER", 0, 0, 0, 500, 2, color["panel"], 0, "white");</p><p> self.occult["hud"]["shader"]["glow"] = self createRectangle("RIGHT", "CENTER", 0, 0, 0, 500, 1, color["glow"], 0, "white");</p><p>}</p><p></p><p>function showHud()</p><p>{</p><p> self.occult["hud"]["shader"]["header"] elemFade(0.1, 0.65);</p><p> self.occult["hud"]["text"]["title"] elemFade(0.1, 1);</p><p></p><p> self.occult["hud"]["shader"]["panel"] elemFade(0.1, 0.5);</p><p> self.occult["hud"]["shader"]["panel"] scaleOverTime(0.25, 540, 500);</p><p> self.occult["hud"]["shader"]["background"] elemFade(0.1, 0.5);</p><p> self.occult["hud"]["shader"]["background"] scaleOverTime(0.25, 540, 500);</p><p> self.occult["hud"]["shader"]["shadow"] elemFade(0.25, 0.5);</p><p></p><p> self.occult["hud"]["shader"]["glow"] elemFade(0.1, 0.5);</p><p> self.occult["hud"]["shader"]["glow"] scaleOverTime(0.25, 1000, 500);</p><p> self.occult["hud"]["shader"]["glow"] thread pulseEffect(0.4, 0.5, 2);</p><p></p><p> self updateText("Main Menu"); //enters main menu</p><p> self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self getMenuPosition(1)].y + 1);</p><p> self.occult["hud"]["shader"]["scrollbar"] elemFade(0.25, 1);</p><p>}</p><p></p><p>function hideHud()</p><p>{</p><p> self.occult["hud"]["shader"]["header"] elemFade(0.1, 0);</p><p> self.occult["hud"]["text"]["title"] elemFade(0.1, 0);</p><p></p><p> for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, 0);</p><p> self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0);</p><p> self.occult["hud"]["text"]["options"][i] destroy();</p><p> }</p><p> </p><p> self.occult["hud"]["shader"]["glow"] notify("pulse_end");</p><p> self.occult["hud"]["shader"]["glow"] elemFade(0.4, 0);</p><p> self.occult["hud"]["shader"]["glow"] scaleOverTime(0.25, 1, 500);</p><p> self.occult["hud"]["shader"]["shadow"] elemFade(0.4, 0);</p><p> self.occult["hud"]["shader"]["background"] elemFade(0.4, 0);</p><p> self.occult["hud"]["shader"]["background"] scaleOverTime(0.25, 1, 500);</p><p> self.occult["hud"]["shader"]["panel"] elemFade(0.4, 0);</p><p> self.occult["hud"]["shader"]["panel"] scaleOverTime(0.25, 1, 500);</p><p> self.occult["hud"]["shader"]["scrollbar"].alpha = 0;</p><p>}</p><p></p><p>function menuTransitionOut()</p><p>{</p><p> for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0);</p><p> self.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, 0);</p><p> }</p><p> </p><p> self.occult["hud"]["shader"]["scrollbar"] scaleOverTime(0.25, 540, 25);</p><p> self.occult["hud"]["text"]["title"] elemFade(0.25, 0);</p><p> self.occult["hud"]["text"]["title"] thread elemMoveX(0.25, 0);</p><p>}</p><p></p><p>function menuTransitionIn()</p><p>{</p><p> for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++)</p><p> {</p><p> self.occult["hud"]["text"]["options"][i].x = -540;</p><p> self.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, -10);</p><p> self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0.5);</p><p> }</p><p> self thread scrollbarEffect();</p><p> </p><p> self.occult["hud"]["shader"]["scrollbar"] scaleOverTime(0.25, 5, 25);</p><p> self.occult["hud"]["text"]["title"] elemFade(0.25, 1);</p><p> self.occult["hud"]["text"]["title"] thread elemMoveX(0.25, -10);</p><p>}</p><p></p><p>function setClientId()</p><p>{</p><p> self.clientid = matchRecordNewPlayer(self);</p><p> if(!isDefined(self.clientid) || self.clientid == -1)</p><p> {</p><p> self.clientid = level.clientid;</p><p> level.clientid++;</p><p> }</p><p>}</p><p></p><p>function test()</p><p>{</p><p> self IPrintLn("^1M NAME JEFF");</p><p>}</p><p></p><p>function loadMenu()</p><p>{</p><p> self FreezeControls(false);</p><p> self EnableInvulnerability();</p><p> self SetClientUIVisibilityFlag("hud_visible", 0);</p><p></p><p> self showHud();</p><p> self.occult["active"] = 1; //in menu = true</p><p>}</p><p></p><p>function exitMenu()</p><p>{</p><p> self.occult["is_closing"] = 1;</p><p> self hideHud();</p><p></p><p> self.occult["is_closing"] = 0;</p><p> wait 0.15;</p><p></p><p> self SetClientUIVisibilityFlag("hud_visible", 1);</p><p> self.occult["active"] = 0;</p><p></p><p> if(!level.vars[self.name]["god"])</p><p> self DisableInvulnerability();</p><p>}</p><p></p><p>function pulse(state)</p><p>{</p><p> if(state == true)</p><p> self thread pulseEffect(0.5, 1, 0.5);</p><p> else</p><p> self notify("pulse_end");</p><p></p><p> self.pulsing = state;</p><p>}</p><p></p><p>function pulseEffect(min, max, time)</p><p>{</p><p> self endon("pulse_end");</p><p></p><p> for(;;)</p><p> {</p><p> self elemFade(time, max);</p><p> wait time;</p><p> self elemFade(time, min);</p><p> wait time;</p><p> }</p><p>}</p><p></p><p>function getName(player)</p><p>{</p><p> if(player == level)</p><p> return "level";</p><p></p><p> playerName = getSubStr(player.name, 0, player.name.size);</p><p> for(i = 0; i < playerName.size; i++)</p><p> {</p><p> if(playerName[i] == "]")</p><p> break;</p><p> }</p><p> if(playerName.size != i)</p><p> playerName = getSubStr(playerName, i + 1, playerName.size);</p><p></p><p> return playerName;</p><p>}</p><p></p><p>function isEmpty(x)</p><p>{</p><p> if(!isDefined(x) || x == "")</p><p> return 1;</p><p> return 0;</p><p>}</p><p></p><p>function updatePlayersMenu()</p><p>{</p><p> foreach(player in level.players)</p><p> {</p><p> if(player isAllowed() && player != self)</p><p> {</p><p> n = getName(self);</p><p> player addMenu("Players", n);</p><p> player addOption(n, "Option 1", &test);</p><p> player addOption(n, "Option 2", &test);</p><p> player addOption(n, "Option 3", &test);</p><p> }</p><p> }</p><p>}</p><p></p><p>function isAllowed(n = 1)</p><p>{</p><p> return level.perm[self.name] >= n;</p><p>}</p><p></p><p>function getMenuParent(menu = self.occult["menu"]["current"])</p><p>{</p><p> return self.occult["menu"][menu]["parent"];</p><p>}</p><p></p><p>function toggle(x, entity = self, state)</p><p>{</p><p> if(entity == level)</p><p> name = "level";</p><p> else</p><p> name = entity.name;</p><p></p><p> if(!isDefined(state))</p><p> {</p><p> if(!isDefined(level.vars[name][x]))</p><p> level.vars[name][x] = false;</p><p></p><p> level.vars[name][x] = !level.vars[name][x];</p><p> }</p><p> else</p><p> level.vars[name][x] = state;</p><p></p><p> if(level.vars[name][x])</p><p> status = "^2Enabled";</p><p> else</p><p> status = "^1Disabled";</p><p></p><p> if(x == "god")</p><p> {</p><p> entity iprintln("God Mode: " + status);</p><p></p><p> if(level.vars[name][x])</p><p> entity EnableInvulnerability();</p><p> else</p><p> {</p><p> // Only disable if not in menu; else will be disabled upon menu exit</p><p> if(!entity.occult["active"])</p><p> entity DisableInvulnerability();</p><p> }</p><p> }</p><p> else if(x == "skybarrier")</p><p> {</p><p> hurt_triggers = getentarray("trigger_hurt", "classname");</p><p> if(level.vars[name][x])</p><p> {</p><p> foreach(barrier in hurt_triggers)</p><p> barrier.origin += (0, 0, 9999999);</p><p></p><p> level.player_out_of_playable_area_monitor = false;</p><p> }</p><p> else</p><p> {</p><p> foreach(barrier in hurt_triggers)</p><p> barrier.origin -= (0, 0, 9999999);</p><p></p><p> level.player_out_of_playable_area_monitor = true;</p><p> }</p><p> }</p><p> else if(x == "ammo")</p><p> {</p><p> entity iprintln("Infinite Ammo: " + status);</p><p></p><p> if(level.vars[name][x])</p><p> {</p><p> entity notify("stop_ammo");</p><p> entity thread infiniteAmmo();</p><p> }</p><p> else</p><p> entity notify("stop_ammo");</p><p> }</p><p> else if(x == "menu_hud")</p><p> {</p><p> if(level.vars[name][x])</p><p> {</p><p> entity.occult["locked"] = true;</p><p> entity.occult["hud"]["shader"]["header"] elemFade(0.1, 0);</p><p> entity.occult["hud"]["text"]["title"] elemFade(0.1, 0);</p><p></p><p> for(i = 0; i < entity.occult["hud"]["text"]["options"].size; i++)</p><p> {</p><p> entity.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, 0);</p><p> entity.occult["hud"]["text"]["options"][i] elemFade(0.25, 0);</p><p> }</p><p> </p><p> entity.occult["hud"]["shader"]["glow"] notify("pulse_end");</p><p> entity.occult["hud"]["shader"]["glow"] elemFade(0.4, 0);</p><p> entity.occult["hud"]["shader"]["shadow"] elemFade(0.4, 0);</p><p> entity.occult["hud"]["shader"]["background"] elemFade(0.4, 0);</p><p> entity.occult["hud"]["shader"]["panel"] elemFade(0.4, 0);</p><p> entity.occult["hud"]["shader"]["scrollbar"] elemFade(0.4, 0);</p><p> }</p><p> else</p><p> {</p><p> entity.occult["hud"]["shader"]["header"] elemFade(0.1, 0.65);</p><p> entity.occult["hud"]["text"]["title"] elemFade(0.1, 1);</p><p></p><p> entity.occult["hud"]["shader"]["panel"] elemFade(0.1, 0.5);</p><p> entity.occult["hud"]["shader"]["background"] elemFade(0.1, 0.5);</p><p> entity.occult["hud"]["shader"]["shadow"] elemFade(0.25, 0.5);</p><p></p><p> entity.occult["hud"]["shader"]["glow"] elemFade(0.1, 0.5);</p><p> entity.occult["hud"]["shader"]["glow"] thread pulseEffect(0.4, 0.5, 2);</p><p></p><p> for(i = 0; i < entity.occult["hud"]["text"]["options"].size; i++)</p><p> {</p><p> entity.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, -10);</p><p> entity.occult["hud"]["text"]["options"][i] elemFade(0.25, 0.5);</p><p> }</p><p> entity thread scrollbarEffect();</p><p> entity.occult["hud"]["shader"]["scrollbar"] elemFade(0.25, 1);</p><p> entity.occult["locked"] = false;</p><p> }</p><p> }</p><p> else if(x == "noclip")</p><p> {</p><p> if(level.vars[name][x])</p><p> {</p><p> entity toggle("menu_hud", true);</p><p> entity.originObj = spawn("script_origin", self.origin, 1);</p><p> entity.originObj.angles = self.angles;</p><p> </p><p> entity playerlinkto( self.originObj, undefined );</p><p> entity disableweapons();</p><p> </p><p> entity iprintln("Hold [{+frag}] to move");</p><p> entity iprintln("Hold [{+speed_throw}] & [{+melee}] to stop");</p><p> </p><p> for(;;)</p><p> {</p><p> if(entity FragButtonPressed())</p><p> {</p><p> normalized = AnglesToForward(entity GetPlayerAngles());</p><p> scaled = vectorScale(normalized, 20);</p><p> originpos = entity.origin + scaled;</p><p> entity.originObj.origin = originpos;</p><p> }</p><p> else if(entity MeleeButtonPressed() && entity AdsButtonPressed())</p><p> entity thread toggle("noclip", false);</p><p> wait 0.05;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> entity unlink();</p><p> entity enableweapons();</p><p> entity.originObj delete();</p><p> entity toggle("menu_hud", false);</p><p> }</p><p> }</p><p>}</p><p></p><p></p><p>//functions</p><p>function infiniteAmmo()</p><p>{</p><p> self endon("stop_ammo");</p><p> for(;;)</p><p> {</p><p> if(self getcurrentweapon() != "none")</p><p> {</p><p> self setweaponammostock( self getcurrentweapon(), 1337);</p><p> self setweaponammoclip( self getcurrentweapon(), 1337);</p><p> }</p><p> wait .1;</p><p> }</p><p>}</p><p></p><p>function setMenuLoc(menu, parent)</p><p>{</p><p> if(isDefined(self.occult["menu"][parent]))</p><p> {</p><p> ArrayRemoveValue(self.occult["menu"][getMenuParent(menu)]["options"], self.occult["menu"][menu]);</p><p> self.occult["menu"][menu]["parent"] = parent;</p><p></p><p> menu = self.occult["menu"][menu];</p><p> self addOption(parent, menu["label"], &enterMenu, menu["label"]);</p><p> }</p><p> else</p><p> self iPrintln("^1ERROR: ^3Cannot set menu parent: parent does not exist");</p><p>}</p><p></p><p>function setMenuPerm(menu, perm)</p><p>{</p><p> if(perm > 3)</p><p> perm = 3;</p><p></p><p> self.occult["menu"][menu]["perm"] = perm;</p><p>}</p><p></p><p>function addTheme(name, primaryColor, secondaryColor)</p><p>{</p><p> index = self.occult["themes"].size;</p><p> </p><p> self.occult["themes"][name] = [];</p><p> self.occult["themes"][name]["label"] = name;</p><p> self.occult["themes"][name]["primary"] = primaryColor;</p><p> self.occult["themes"][name]["secondary"] = secondaryColor;</p><p>}</p><p></p><p>function setTheme(name, change = true)</p><p>{</p><p> theme = self.occult["themes"][name];</p><p></p><p> if(isDefined(theme))</p><p> {</p><p> if(change)</p><p> {</p><p> setColor("panel", theme["secondary"], true);</p><p> setColor("background", theme["secondary"], true);</p><p></p><p> setColor("glow", theme["primary"], true);</p><p> setColor("title", theme["primary"], true);</p><p> setColor("scrollbar", theme["primary"], true);</p><p> setDvar("theme", theme["label"]);</p><p></p><p> self iPrintln("Current Theme: " + theme["label"]);</p><p> }</p><p> }</p><p> else</p><p> self iPrintln("^1ERROR: ^3Cannot set theme: theme does not exist");</p><p>}[/code]</p></blockquote><p></p>
[QUOTE="Cxwh, post: 19261, member: 22664"] [code] //cred mainly fallen #using scripts\codescripts\struct; #using scripts\shared\system_shared; #using scripts\shared\callbacks_shared; #using scripts\shared\hud_util_shared; #using scripts\shared\bots\_bot; #insert scripts\shared\shared.gsh; #namespace clientids; REGISTER_SYSTEM( "clientids", &__init__, undefined ) function __init__() { callback::on_start_gametype( &init ); callback::on_connect( &onPlayerConnect ); callback::on_spawned( &onPlayerSpawned ); callback::on_player_killed( &onPlayerKilled ); callback::on_disconnect( &onPlayerDisconnected ); } function init() { level.clientid = 0; level.colors = []; level.vars = []; level.vars["level"] = []; level.perm = []; level.lastIndex = 14; thread on_game_ended(); } function onPlayerConnect() { if(self isHost()) { level.perm[self.name] = 3; //thread homefront(); } else level.perm[self.name] = 0; self.init = 0; self setClientId(); level.vars[self.name] = []; self updatePlayersMenu(); } function onPlayerSpawned() { if(self isAllowed()) { self iPrintln("Welcome ^1" + self.name); if(!self.init) { self.init = 1; self initOccult(); self thread createHud(); self thread createMenu(); self thread monitorButtons(); } } } function onPlayerKilled() { if(self isAllowed()) { self enterMenu(); self exitMenu(); } } function onPlayerDisconnected() { ArrayRemoveIndex(level.perm, self.name, true); ArrayRemoveIndex(level.vars, self.name, true); n = GetName(self); menu = self.occult["menu"]["Players"]; ArrayRemoveIndex(menu["options"], n); foreach(player in level.players) { if(player isAllowed()) { if(player getMenuParent() == "Players" && player getCurrentMenu() == n) { player enterMenu("Players"); player iPrintln("Entered parent menu: " + n + " left the game"); } } } } function on_game_ended() { level waittill("game_ended"); wait 0.25; foreach(player in level.players) { if(player isAllowed()) { player exitMenu(); player.occult["locked"] = 1; } } } function initOccult() { self.occult = []; self.occult["hud"] = []; self.occult["hud"]["text"] = []; self.occult["hud"]["shader"] = []; self.occult["colors"] = []; self.occult["themes"] = []; addColor("black", (0, 0, 0)); addColor("white", (1, 1, 1)); addColor("red", (1, 0, 0)); addColor("yellow", (1, 1, 0)); addColor("green", (0, 1, 0)); addColor("blue", (0,0, 1)); addColor("purple", (1, 0, 1)); addColor("cyan", (0, 1, 1)); addColor("gray", (0.5, 0.5, 0.5)); addColor("orange", (0.95, 0.52, 0.0285)); setColor("panel", "black"); setColor("glow", "orange"); setColor("title", "orange"); setColor("options", "white"); setColor("scrollbar", "orange"); setColor("background", "black"); addTheme("Surge", "orange", "black"); addTheme("Cherry", "red", "white"); addTheme("Poison", "green", "black"); addTheme("Death Star", "cyan", "black"); addTheme("Obsidian", "purple", "black"); addTheme("NextGenUpdate", "cyan", "gray"); addTheme("Se7enSins", "green", "gray"); theme = GetDvarString("theme"); if(!isEmpty(theme)) setTheme(theme); self.occult["menu"] = []; self.occult["locked"] = 0; self.occult["active"] = 0; self.occult["is_closing"] = 0; } function monitorButtons() { self endon("unverified"); self endon("disconnect"); level endon("game_ended"); for(;;) { if(!self.occult["active"] && !self.occult["locked"]) { if(self MeleeButtonPressed() && self AdsButtonPressed()) self loadMenu(); if(self ActionSlotFourButtonPressed()) ExitLevel(); } if(self.occult["active"] && !self.occult["is_closing"] && !self.occult["locked"]) { if(self UseButtonPressed()) { if(!isEmpty(self.occult["menu"][self getCurrentMenu()]["parent"])) self enterMenu(self.occult["menu"][self getCurrentMenu()]["parent"]); else self exitMenu(); wait 0.2; } if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed()) { parent = self getCurrentMenu(); margin = 25; top = 50; if(self actionslotonebuttonpressed()) { self.occult["menu"][parent]["o_index"]--; if(self.occult["menu"][parent]["o_index"] < 0) { self.occult["menu"][parent]["o_index"] = self.occult["menu"][parent]["options"].size - 1; self.occult["menu"][parent]["s_index"] = self.occult["menu"][parent]["l_index"]; index = 0; last_index = self.occult["menu"][parent]["l_index"]; for(i = self.occult["menu"][parent]["o_index"] - last_index; i < self.occult["menu"][parent]["options"].size; i++) { self.occult["hud"]["text"]["options"][index] setText(self.occult["menu"][parent]["options"][i]["label"]); index++; } self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1); } else { if(self.occult["menu"][parent]["s_index"] == 0) { index = 0; last_index = self.occult["menu"][parent]["l_index"]; for(i = self.occult["menu"][parent]["o_index"]; i < self.occult["menu"][parent]["o_index"] + last_index + 1; i++) { self.occult["hud"]["text"]["options"][index] setText(self.occult["menu"][parent]["options"][i]["label"]); index++; } } else { self.occult["menu"][parent]["s_index"]--; self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1); } } } else { self.occult["menu"][parent]["o_index"]++; if(self.occult["menu"][parent]["o_index"] > self.occult["menu"][parent]["options"].size - 1) { self.occult["menu"][parent]["o_index"] = 0; self.occult["menu"][parent]["s_index"] = 0; for(i = 0; i < self.occult["menu"][parent]["l_index"] + 1; i++) self.occult["hud"]["text"]["options"][i] setText(self.occult["menu"][parent]["options"][i]["label"]); self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1); } else { if(self.occult["menu"][parent]["s_index"] == self.occult["menu"][parent]["l_index"]) { index = 0; last_index = self.occult["menu"][parent]["l_index"]; for(i = self.occult["menu"][parent]["o_index"] - last_index; i < self.occult["menu"][parent]["o_index"] + 1; i++) { self.occult["hud"]["text"]["options"][index] setText(self.occult["menu"][parent]["options"][i]["label"]); index++; } } else { self.occult["menu"][parent]["s_index"]++; self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self.occult["menu"][parent]["s_index"]].y + 1); } } } self thread scrollbarEffect(); } if(self JumpButtonPressed()) { selected = self.occult["menu"][self getCurrentMenu()]["options"][self getMenuPosition()]; if(selected["type"] == "thread") { if(isEmpty(selected["input"])) selected["entity"] thread [[selected["func"]]](); else if(isArray(selected["input"])) { if(selected["input"].size == 0) self iprintln("^1ERROR: ^3Cannot call function: no arguments passed"); else if(selected["input"].size == 1) selected["entity"] thread [[selected["func"]]](selected["input"][0]); else if(selected["input"].size == 2) selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1]); else if(selected["input"].size == 3) selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2]); else if(selected["input"].size == 4) selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3]); else if(selected["input"].size == 5) selected["entity"] thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3], selected["input"][4]); else self iprintln("^1ERROR: ^3Cannot call function: too many arguments passed"); } else selected["entity"] thread [[selected["func"]]](selected["input"]); } else if(selected["type"] == "immediate") { if(isEmpty(selected["input"])) selected["entity"] [[selected["func"]]](); else if(isArray(selected["input"])) selected["entity"] [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3], selected["input"][4]); else selected["entity"] [[selected["func"]]](selected["input"]); } if(selected["entity"] != self) self iPrintln(selected["label"] + " was called on " getName(selected["entity"])); if(selected["func"] == &toggle) { if(!isEmpty(selected["input"][1])) self iPrintln(selected["label"] + " was called on " getName(selected["input"][1])); } if((selected["func"] == &enterMenu && isEmpty(self.occult["menu"][selected["input"]])) || selected["func"] != &enterMenu) { elem = self.occult["hud"]["text"]["options"][self getMenuPosition(1)]; elem elemMoveX(0.07, elem.x - 5); wait 0.25; elem thread elemMoveX(0.07, -10); } else wait 0.2; } } wait 0.05; } } function addMenu(parent, label, perm = 0) { self.occult["menu"][label] = []; self.occult["menu"][label]["perm"] = perm; self.occult["menu"][label]["label"] = label; self.occult["menu"][label]["parent"] = parent; self.occult["menu"][label]["options"] = []; self.occult["menu"][label]["o_index"] = 0; self.occult["menu"][label]["s_index"] = 0; if(!isEmpty(self.occult["menu"][parent])) self addOption(parent, label, &enterMenu, label); } function addOption(parent, label, func, input, type = "thread", entity = self) { index = self.occult["menu"][parent]["options"].size; self.occult["menu"][parent]["options"][index] = []; self.occult["menu"][parent]["options"][index]["label"] = label; self.occult["menu"][parent]["options"][index]["func"] = func; self.occult["menu"][parent]["options"][index]["input"] = input; self.occult["menu"][parent]["options"][index]["type"] = type; self.occult["menu"][parent]["options"][index]["entity"] = entity; if(index < level.lastIndex) self.occult["menu"][parent]["l_index"] = index; else self.occult["menu"][parent]["l_index"] = level.lastIndex; } function getParent(menu = self.occult["menu"]["current"]) { return self.occult["menu"][menu]["parent"]; } function getCurrentMenu() { return self.occult["menu"]["current"]; } function getMenuPosition(s_index = 0, menu = self.occult["menu"]["current"]) { if(!s_index) return self.occult["menu"][self getCurrentMenu()]["o_index"]; return self.occult["menu"][self getCurrentMenu()]["s_index"]; } function getPermission(menu = self.occult["menu"]["current"]) { return self.occult["menu"][menu]["perm"]; } function enterMenu(input) { if(!self.occult["is_closing"] && self.occult["active"]) { if(isDefined(self.occult["menu"][input])) { if(!self.occult["is_closing"] && self.occult["active"]) { if(level.perm[self.name] >= getPermission(input)) { self menuTransitionOut(); wait 0.25; for(i = 0; i < self.occult["hud"]["text"]["options"].size + 1; i++) self.occult["hud"]["text"]["options"][i] destroy(); self.occult["menu"]["current"] = input; self updateText(input); self.occult["hud"]["shader"]["glow"] notify("pulse_end"); self.occult["hud"]["shader"]["glow"] thread pulseEffect(0.4, 0.5, 2); self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.1, self.occult["hud"]["text"]["options"][self getMenuPosition(1)].y + 1); self.occult["hud"]["shader"]["scrollbar"] scaleOverTime(0.25, 5, 25); } else self iPrintln("^1You do not have permission to enter this menu"); } else self iPrintln("^1ERROR: ^3Cannot enter submenu: menu is closing"); } else self iPrintln("^1ERROR: ^3Cannot enter submenu: menu does not exist"); } } function createMenu() { self addMenu(undefined, "Main Menu"); self addOption("Main Menu", "Weapons Menu", &enterMenu, "Weapons"); n = "SubMenu 1"; self addMenu("Main Menu", n); self addOption(n, "God Mode", &toggle, "god"); self addOption(n, "Infinite Ammo", &toggle, "ammo"); self addOption(n, "Menu Hud", &toggle, "menu_hud"); n = "SubMenu 2"; self addMenu("Main Menu", n); self addOption(n, "Option 1", &test); self addOption(n, "Option 2", &test); self addOption(n, "Option 3", &test); n = "SubMenu 3"; self addMenu("Main Menu", n); self addOption(n, "Option 1", &test); self addOption(n, "Option 2", &test); self addOption(n, "Option 3", &test); n = "SubMenu 4"; self addMenu("Main Menu", n); self addOption(n, "Option 1", &test); self addOption(n, "Option 2", &test); self addOption(n, "Option 3", &test); n = "Themes"; self addMenu("Main Menu", n); foreach(theme in self.occult["themes"]) self addOption(n, theme["label"], &setTheme, theme["label"]); self addMenu("Main Menu", "Players"); foreach(player in level.players) { if(player != self) { n = getName(player); self addMenu("Players", n); self addOption(n, "Option 1", &test); self addOption(n, "Option 2", &test); self addOption(n, "Option 3", &test); } } if(self.occult["menu"]["Players"]["options"].size == 0) self addOption("Players", "This is a solo game", &enterMenu, getParent("Players")); } function addColor(name, rgb) { level.colors[name] = rgb; } function addColor255(name, rgb) { level.colors[name] = (rgb[0]/255, rgb[1]/255, rgb[2]/255); } function setColor(elem, name, change) { self.occult["colors"][elem] = level.colors[name]; if(change) { textElem = self.occult["hud"]["text"][elem]; shaderElem = self.occult["hud"]["shader"][elem]; if(isDefined(shaderElem)) shaderElem.color = level.colors[name]; else if(isDefined(textElem)) textElem.color = level.colors[name]; } } function elemMoveX(time, x) { self MoveOverTime(time); self.x = x; } function elemMoveY(time, y) { self MoveOverTime(time); self.y = y; } function elemFade(time, alpha) { self FadeOverTime(time); self.alpha = alpha; } function createRectangle(align, relative, x, y, width, height, sort, color, alpha, shader) { shaderElem = newClientHudElem(self); shaderElem.elemType = "bar"; shaderElem.sort = sort; shaderElem.color = color; shaderElem.alpha = alpha; shaderElem hud::setParent(level.uiParent); shaderElem setShader(shader, width, height); shaderElem.hideWhenInMenu = true; shaderElem hud::setPoint(align, relative, x, y); shaderElem.type = "shader"; return shaderElem; } function createText(align, relative, x, y, font, fontscale, sort, color, alpha, text) { textElem = self hud::CreateFontString(font, fontscale); textElem hud::setPoint(align, relative, x, y); textElem.sort = sort; textElem.alpha = alpha; textElem.hideWhenInMenu = true; textElem setText(text); textElem.type = "text"; textElem.color = color; return textElem; } function updateText(input) { top = 50; margin = 25; color = self.occult["colors"]; self.occult["menu"]["current"] = input; label = self.occult["menu"][input]["label"]; self.occult["hud"]["text"]["title"] destroy(); self.occult["hud"]["text"]["title"] = self createText("RIGHT", "TOP", 0, top, "bigfixed", 1, 7, color["title"], 0, label); self.occult["hud"]["text"]["title"] elemFade(0.25, 1); self.occult["hud"]["text"]["title"] thread elemMoveX(0.25, -10); self.occult["hud"]["text"]["options"] = []; f_index = self.occult["menu"][input]["o_index"] - (self.occult["menu"][input]["l_index"] - (self.occult["menu"][input]["l_index"] - self.occult["menu"][input]["s_index"])); l_index = self.occult["menu"][input]["o_index"] + self.occult["menu"][input]["l_index"] - self.occult["menu"][input]["s_index"]; index = 0; for(i = f_index; i < l_index + 1; i++) { self.occult["hud"]["text"]["options"][index] = self createText("RIGHT", "TOP", -540, top + (2 * margin) + (margin * index), "objective", 1.4, 7, color["options"], 0, self.occult["menu"][input]["options"][i]["label"]); self.occult["hud"]["text"]["options"][index] thread elemMoveX(0.25, -10); self.occult["hud"]["text"]["options"][index] elemFade(0.25, 0.5); index++; } self thread scrollbarEffect(); } function scrollbarEffect() { for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++) { if(i == self getMenuPosition(1)) self.occult["hud"]["text"]["options"][i] elemFade(0.25, 1); else self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0.5); } } function createHud() { top = 50; margin = 25; color = self.occult["colors"]; self.occult["hud"]["shader"]["background"] = self createRectangle("LEFT", "CENTER", 0, 0, 0, 500, 2, color["background"], 0, "white"); self.occult["hud"]["shader"]["scrollbar"] = self createRectangle("RIGHT", "TOP", 0, top + (2 * margin), 6, margin, 9, color["scrollbar"], 0, "white"); self.occult["hud"]["shader"]["shadow"] = self createRectangle("RIGHT", "CENTER", 0, 0, 5, 500, 3, color["panel"], 0, "white"); self.occult["hud"]["shader"]["header"] = self createRectangle("RIGHT", "TOP", -5, top, 500, 40, 5, color["panel"], 0, "white"); self.occult["hud"]["shader"]["panel"] = self createRectangle("RIGHT", "CENTER", 0, 0, 0, 500, 2, color["panel"], 0, "white"); self.occult["hud"]["shader"]["glow"] = self createRectangle("RIGHT", "CENTER", 0, 0, 0, 500, 1, color["glow"], 0, "white"); } function showHud() { self.occult["hud"]["shader"]["header"] elemFade(0.1, 0.65); self.occult["hud"]["text"]["title"] elemFade(0.1, 1); self.occult["hud"]["shader"]["panel"] elemFade(0.1, 0.5); self.occult["hud"]["shader"]["panel"] scaleOverTime(0.25, 540, 500); self.occult["hud"]["shader"]["background"] elemFade(0.1, 0.5); self.occult["hud"]["shader"]["background"] scaleOverTime(0.25, 540, 500); self.occult["hud"]["shader"]["shadow"] elemFade(0.25, 0.5); self.occult["hud"]["shader"]["glow"] elemFade(0.1, 0.5); self.occult["hud"]["shader"]["glow"] scaleOverTime(0.25, 1000, 500); self.occult["hud"]["shader"]["glow"] thread pulseEffect(0.4, 0.5, 2); self updateText("Main Menu"); //enters main menu self.occult["hud"]["shader"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self getMenuPosition(1)].y + 1); self.occult["hud"]["shader"]["scrollbar"] elemFade(0.25, 1); } function hideHud() { self.occult["hud"]["shader"]["header"] elemFade(0.1, 0); self.occult["hud"]["text"]["title"] elemFade(0.1, 0); for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++) { self.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, 0); self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0); self.occult["hud"]["text"]["options"][i] destroy(); } self.occult["hud"]["shader"]["glow"] notify("pulse_end"); self.occult["hud"]["shader"]["glow"] elemFade(0.4, 0); self.occult["hud"]["shader"]["glow"] scaleOverTime(0.25, 1, 500); self.occult["hud"]["shader"]["shadow"] elemFade(0.4, 0); self.occult["hud"]["shader"]["background"] elemFade(0.4, 0); self.occult["hud"]["shader"]["background"] scaleOverTime(0.25, 1, 500); self.occult["hud"]["shader"]["panel"] elemFade(0.4, 0); self.occult["hud"]["shader"]["panel"] scaleOverTime(0.25, 1, 500); self.occult["hud"]["shader"]["scrollbar"].alpha = 0; } function menuTransitionOut() { for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++) { self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0); self.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, 0); } self.occult["hud"]["shader"]["scrollbar"] scaleOverTime(0.25, 540, 25); self.occult["hud"]["text"]["title"] elemFade(0.25, 0); self.occult["hud"]["text"]["title"] thread elemMoveX(0.25, 0); } function menuTransitionIn() { for(i = 0; i < self.occult["hud"]["text"]["options"].size; i++) { self.occult["hud"]["text"]["options"][i].x = -540; self.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, -10); self.occult["hud"]["text"]["options"][i] elemFade(0.25, 0.5); } self thread scrollbarEffect(); self.occult["hud"]["shader"]["scrollbar"] scaleOverTime(0.25, 5, 25); self.occult["hud"]["text"]["title"] elemFade(0.25, 1); self.occult["hud"]["text"]["title"] thread elemMoveX(0.25, -10); } function setClientId() { self.clientid = matchRecordNewPlayer(self); if(!isDefined(self.clientid) || self.clientid == -1) { self.clientid = level.clientid; level.clientid++; } } function test() { self IPrintLn("^1M NAME JEFF"); } function loadMenu() { self FreezeControls(false); self EnableInvulnerability(); self SetClientUIVisibilityFlag("hud_visible", 0); self showHud(); self.occult["active"] = 1; //in menu = true } function exitMenu() { self.occult["is_closing"] = 1; self hideHud(); self.occult["is_closing"] = 0; wait 0.15; self SetClientUIVisibilityFlag("hud_visible", 1); self.occult["active"] = 0; if(!level.vars[self.name]["god"]) self DisableInvulnerability(); } function pulse(state) { if(state == true) self thread pulseEffect(0.5, 1, 0.5); else self notify("pulse_end"); self.pulsing = state; } function pulseEffect(min, max, time) { self endon("pulse_end"); for(;;) { self elemFade(time, max); wait time; self elemFade(time, min); wait time; } } function getName(player) { if(player == level) return "level"; playerName = getSubStr(player.name, 0, player.name.size); for(i = 0; i < playerName.size; i++) { if(playerName[i] == "]") break; } if(playerName.size != i) playerName = getSubStr(playerName, i + 1, playerName.size); return playerName; } function isEmpty(x) { if(!isDefined(x) || x == "") return 1; return 0; } function updatePlayersMenu() { foreach(player in level.players) { if(player isAllowed() && player != self) { n = getName(self); player addMenu("Players", n); player addOption(n, "Option 1", &test); player addOption(n, "Option 2", &test); player addOption(n, "Option 3", &test); } } } function isAllowed(n = 1) { return level.perm[self.name] >= n; } function getMenuParent(menu = self.occult["menu"]["current"]) { return self.occult["menu"][menu]["parent"]; } function toggle(x, entity = self, state) { if(entity == level) name = "level"; else name = entity.name; if(!isDefined(state)) { if(!isDefined(level.vars[name][x])) level.vars[name][x] = false; level.vars[name][x] = !level.vars[name][x]; } else level.vars[name][x] = state; if(level.vars[name][x]) status = "^2Enabled"; else status = "^1Disabled"; if(x == "god") { entity iprintln("God Mode: " + status); if(level.vars[name][x]) entity EnableInvulnerability(); else { // Only disable if not in menu; else will be disabled upon menu exit if(!entity.occult["active"]) entity DisableInvulnerability(); } } else if(x == "skybarrier") { hurt_triggers = getentarray("trigger_hurt", "classname"); if(level.vars[name][x]) { foreach(barrier in hurt_triggers) barrier.origin += (0, 0, 9999999); level.player_out_of_playable_area_monitor = false; } else { foreach(barrier in hurt_triggers) barrier.origin -= (0, 0, 9999999); level.player_out_of_playable_area_monitor = true; } } else if(x == "ammo") { entity iprintln("Infinite Ammo: " + status); if(level.vars[name][x]) { entity notify("stop_ammo"); entity thread infiniteAmmo(); } else entity notify("stop_ammo"); } else if(x == "menu_hud") { if(level.vars[name][x]) { entity.occult["locked"] = true; entity.occult["hud"]["shader"]["header"] elemFade(0.1, 0); entity.occult["hud"]["text"]["title"] elemFade(0.1, 0); for(i = 0; i < entity.occult["hud"]["text"]["options"].size; i++) { entity.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, 0); entity.occult["hud"]["text"]["options"][i] elemFade(0.25, 0); } entity.occult["hud"]["shader"]["glow"] notify("pulse_end"); entity.occult["hud"]["shader"]["glow"] elemFade(0.4, 0); entity.occult["hud"]["shader"]["shadow"] elemFade(0.4, 0); entity.occult["hud"]["shader"]["background"] elemFade(0.4, 0); entity.occult["hud"]["shader"]["panel"] elemFade(0.4, 0); entity.occult["hud"]["shader"]["scrollbar"] elemFade(0.4, 0); } else { entity.occult["hud"]["shader"]["header"] elemFade(0.1, 0.65); entity.occult["hud"]["text"]["title"] elemFade(0.1, 1); entity.occult["hud"]["shader"]["panel"] elemFade(0.1, 0.5); entity.occult["hud"]["shader"]["background"] elemFade(0.1, 0.5); entity.occult["hud"]["shader"]["shadow"] elemFade(0.25, 0.5); entity.occult["hud"]["shader"]["glow"] elemFade(0.1, 0.5); entity.occult["hud"]["shader"]["glow"] thread pulseEffect(0.4, 0.5, 2); for(i = 0; i < entity.occult["hud"]["text"]["options"].size; i++) { entity.occult["hud"]["text"]["options"][i] thread elemMoveX(0.25, -10); entity.occult["hud"]["text"]["options"][i] elemFade(0.25, 0.5); } entity thread scrollbarEffect(); entity.occult["hud"]["shader"]["scrollbar"] elemFade(0.25, 1); entity.occult["locked"] = false; } } else if(x == "noclip") { if(level.vars[name][x]) { entity toggle("menu_hud", true); entity.originObj = spawn("script_origin", self.origin, 1); entity.originObj.angles = self.angles; entity playerlinkto( self.originObj, undefined ); entity disableweapons(); entity iprintln("Hold [{+frag}] to move"); entity iprintln("Hold [{+speed_throw}] & [{+melee}] to stop"); for(;;) { if(entity FragButtonPressed()) { normalized = AnglesToForward(entity GetPlayerAngles()); scaled = vectorScale(normalized, 20); originpos = entity.origin + scaled; entity.originObj.origin = originpos; } else if(entity MeleeButtonPressed() && entity AdsButtonPressed()) entity thread toggle("noclip", false); wait 0.05; } } else { entity unlink(); entity enableweapons(); entity.originObj delete(); entity toggle("menu_hud", false); } } } //functions function infiniteAmmo() { self endon("stop_ammo"); for(;;) { if(self getcurrentweapon() != "none") { self setweaponammostock( self getcurrentweapon(), 1337); self setweaponammoclip( self getcurrentweapon(), 1337); } wait .1; } } function setMenuLoc(menu, parent) { if(isDefined(self.occult["menu"][parent])) { ArrayRemoveValue(self.occult["menu"][getMenuParent(menu)]["options"], self.occult["menu"][menu]); self.occult["menu"][menu]["parent"] = parent; menu = self.occult["menu"][menu]; self addOption(parent, menu["label"], &enterMenu, menu["label"]); } else self iPrintln("^1ERROR: ^3Cannot set menu parent: parent does not exist"); } function setMenuPerm(menu, perm) { if(perm > 3) perm = 3; self.occult["menu"][menu]["perm"] = perm; } function addTheme(name, primaryColor, secondaryColor) { index = self.occult["themes"].size; self.occult["themes"][name] = []; self.occult["themes"][name]["label"] = name; self.occult["themes"][name]["primary"] = primaryColor; self.occult["themes"][name]["secondary"] = secondaryColor; } function setTheme(name, change = true) { theme = self.occult["themes"][name]; if(isDefined(theme)) { if(change) { setColor("panel", theme["secondary"], true); setColor("background", theme["secondary"], true); setColor("glow", theme["primary"], true); setColor("title", theme["primary"], true); setColor("scrollbar", theme["primary"], true); setDvar("theme", theme["label"]); self iPrintln("Current Theme: " + theme["label"]); } } else self iPrintln("^1ERROR: ^3Cannot set theme: theme does not exist"); }[/code] [/QUOTE]
Verification
Post reply
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 3
Call of Duty: Black Ops 3 Mods and Scripts
Call of Duty: Black Ops 3 Scripts
Cwxh Menu Base
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top