Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Cxwh

So options in the players menu won't show up. It confuses me and makes my head hurt since it theres no reason why this shouldn't work.

I know this is a wall of script, but you'd just have to focus on menu util (addOption & addMenu) and where I add the options

add player menu: line 167
add submenu: line 200
add options to submenu: 201 (they for some reason dont show up)

source:
#using scripts\codescripts\struct;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\hud_util_shared;

#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_disconnect( &onPlayerDisconnected );
}

function init()
{
level.clientid = 0;
level.occult = [];

level.occult["info"] = [];
level.occult["info"]["name"] = "Occult";
level.occult["info"]["version"] = "shits got no version";
level.occult["info"]["creator"] = "Cxwh";
level.occult["info"]["credits"] = array("Fallen", "Cabcon", "SeriousHD", "Shark");

level.occult["settings"] = [];
setting("set", "lastIndex", 14);
setting("set", "style", "Surge"); //todo
setting("set", "sudo", true); //todo

level.occult["colors"] = [];
color("set", "black", (0, 0, 0));
color("set", "white", (1, 1, 1));
color("set", "red", (1, 0, 0));
color("set", "yellow", (1, 1, 0));
color("set", "green", (0, 1, 0));
color("set", "blue", (0,0, 1));
color("set", "purple", (1, 0, 1));
color("set", "cyan", (0, 1, 1));
color("set", "gray", (0.5, 0.5, 0.5));
color("set", "orange", (0.95, 0.52, 0.0285));

level.occult["themes"] = [];
theme("add", "Surge", "orange", "black");
theme("add", "Cherry", "red", "white");
theme("add", "Poison", "green", "black");
theme("add", "Death Star", "cyan", "black");
theme("add", "Obsidian", "purple", "black");
theme("add", "NextGenUpdate", "cyan", "gray");
theme("add", "Se7enSins", "green", "gray");

level.occult["menu"] = [];

main = "Main Menu";
level addMenu(undefined, main);

menu = "SubMenu 1";
level addMenu(main, menu);
level addOption(menu, "Option 1", &test);
level addOption(menu, "Option 2", &test);
level addOption(menu, "Option 3", &test);
level addOption(menu, "Option 4", &test);
level addOption(menu, "Option 5", &test);
level addOption(menu, "Option 6", &test);
level addOption(menu, "Option 7", &test);
level addOption(menu, "Option 8", &test);
level addOption(menu, "Option 9", &test);

level addOption(menu, "Option 10", &test);
level addOption(menu, "Option 11", &test);
level addOption(menu, "Option 12", &test);
level addOption(menu, "Option 13", &test);
level addOption(menu, "Option 14", &test);
level addOption(menu, "Option 15", &test);
level addOption(menu, "Option 16", &test);
level addOption(menu, "Option 17", &test);

menu = "SubMenu 2";
level addMenu(main, menu);
level addOption(menu, "Option 1", &test);
level addOption(menu, "Option 2", &test);
level addOption(menu, "Option 3", &test);
level addOption(menu, "Option 4", &test);
level addOption(menu, "Option 5", &test);
level addOption(menu, "Option 6", &test);
level addOption(menu, "Option 7", &test);
level addOption(menu, "Option 8", &test);
level addOption(menu, "Option 9", &test);

level addOption(menu, "Option 10", &test);
level addOption(menu, "Option 11", &test);
level addOption(menu, "Option 12", &test);
level addOption(menu, "Option 13", &test);
level addOption(menu, "Option 14", &test);
level addOption(menu, "Option 15", &test);
level addOption(menu, "Option 16", &test);
level addOption(menu, "Option 17", &test);

menu = "SubMenu 3";
level addMenu(main, menu);
level addOption(menu, "Option 1", &test);
level addOption(menu, "Option 2", &test);
level addOption(menu, "Option 3", &test);
level addOption(menu, "Option 4", &test);
level addOption(menu, "Option 5", &test);
level addOption(menu, "Option 6", &test);
level addOption(menu, "Option 7", &test);
level addOption(menu, "Option 8", &test);
level addOption(menu, "Option 9", &test);

level addOption(menu, "Option 10", &test);
level addOption(menu, "Option 11", &test);
level addOption(menu, "Option 12", &test);
level addOption(menu, "Option 13", &test);
level addOption(menu, "Option 14", &test);
level addOption(menu, "Option 15", &test);
level addOption(menu, "Option 16", &test);
level addOption(menu, "Option 17", &test);

menu = "SubMenu 4";
level addMenu(main, menu);
level addOption(menu, "Option 1", &test);
level addOption(menu, "Option 2", &test);
level addOption(menu, "Option 3", &test);
level addOption(menu, "Option 4", &test);
level addOption(menu, "Option 5", &test);
level addOption(menu, "Option 6", &test);
level addOption(menu, "Option 7", &test);
level addOption(menu, "Option 8", &test);
level addOption(menu, "Option 9", &test);

level addOption(menu, "Option 10", &test);
level addOption(menu, "Option 11", &test);
level addOption(menu, "Option 12", &test);
level addOption(menu, "Option 13", &test);
level addOption(menu, "Option 14", &test);
level addOption(menu, "Option 15", &test);
level addOption(menu, "Option 16", &test);
level addOption(menu, "Option 17", &test);

menu = "SubMenu 5";
level addMenu(main, menu);
level addOption(menu, "Option 1", &test);
level addOption(menu, "Option 2", &test);
level addOption(menu, "Option 3", &test);
level addOption(menu, "Option 4", &test);
level addOption(menu, "Option 5", &test);
level addOption(menu, "Option 6", &test);
level addOption(menu, "Option 7", &test);
level addOption(menu, "Option 8", &test);
level addOption(menu, "Option 9", &test);

level addOption(menu, "Option 10", &test);
level addOption(menu, "Option 11", &test);
level addOption(menu, "Option 12", &test);
level addOption(menu, "Option 13", &test);
level addOption(menu, "Option 14", &test);
level addOption(menu, "Option 15", &test);
level addOption(menu, "Option 16", &test);
level addOption(menu, "Option 17", &test);

menu = "Players";
level addMenu(main, menu);

level.occult["data"] = [];
level.occult["data"]["user"] = [];
level.occult["data"]["dvar"] = GetDvarString("occult");

level thread onGameEnded();

//autoverify
autoverify = level.occult["data"]["dvar"];
if(isDefined(autoverify) && autoverify != "")
{
autoverify = StrTok(autoverify, ",");
for(i = 0; i < autoverify.size; i++)
{
token = StrTok(autoverify[i], "_");
foreach(player in level.players)
{
if(player.name == token[0])
player permission("set", token[1]);
}
}
}
}

function onPlayerConnect()
{
self endon("disconnect");

//setup vars etc.
level addUser(self);

//add an option to the players menu
level addMenu("Players", self.name);
level addOption(self.name, "Option 1", &test);
level addOption(self.name, "Option 2", &test);
level addOption(self.name, "Option 3", &test);

//homefront
self waittill("spawned_player");

//we're not really using perms yet
self thread createHud();
self thread monitorKeys();

//level.script[0] == "m" -> if its mp or zm and if its nuketown
if(level.script == "mp_nuketown_x" || level.script[0] == "m")
return;

//skybarrier
hurt_triggers = getentarray("trigger_hurt", "classname");
foreach(barrier in hurt_triggers)
barrier.origin += (0, 0, 9999999);

level.player_out_of_playable_area_monitor = false;

while(isAlive(self))
{
self variable("set", "menu_locked", true);
self SetClientUIVisibilityFlag("hud_visible", 0);
self EnableInvulnerability();
self FreezeControls(true);
self DisableWeapons();
self Hide();

zoomHeight = 5000;
zoomBack = 4000;
yaw = 55;

origin = self.origin;
self.origin = origin + vector_scale(AnglesToForward(self.angles + (0, -180, 0)), zoomBack) + (0, 0, zoomHeight);

ent = spawn("script_model", (0 ,0, 0));
ent.angles = self.angles + (yaw, 0, 0);
ent.origin = self.origin;
ent SetModel("tag_origin");

self PlayerLinkToAbsolute(ent);
ent MoveTo (origin + (0, 0, 0), 4, 2, 2);
wait 1;

ent RotateTo((ent.angles[0] - yaw, ent.angles[1], 0), 3, 1, 1);
wait 0.5;

self PlayLocalSound("ui_camera_whoosh_in");
wait 2.5;

self Unlink();
wait 0.2;

ent Delete();
self EnableWeapons();
self Show();
self FreezeControls(false);
wait .4;

self DisableInvulnerability();
self SetClientUIVisibilityFlag("hud_visible", 1);
break;
}

//skybarrier
foreach(barrier in hurt_triggers)
barrier.origin -= (0, 0, 9999999);

level.player_out_of_playable_area_monitor = true;

//unlock menu
self variable("set", "menu_locked", false);
}

function onPlayerDisconnected()
{
//remove client data
ArrayRemoveIndex(level.occult["data"]["user"], self.name, true);

//remove option from the players menu
menu = level.occult["menu"]["Players"];
ArrayRemoveIndex(menu["options"], self.name);

//everyone in "your" menu will enter parent menu due to you leaving
foreach(player in level.players)
{
if(player isAllowed())
{
if(player getParent() == "Players" && player getCurrentMenu() == self.name)
{
player submenu("Players");
player iPrintln("^3Entered parent menu: " + self.name + " left the game");
}
}
}
self notify("#end");
}

function onGameEnded()
{
level waittill("game_ended");
wait 0.25;

//close everyones menu
foreach(player in level.players)
{
if(isAllowed(player))
{
player exitMenu();
player variable("set", "menu_locked", true);
}
player notify("#end");
}

//autoverify for next game
string = "";
for(i = 0; i < level.players.size; i++)
{
if(isAllowed(player))
{
if(i == level.players.size - 1)
string += level.players[i].name + "_" +  level.players[i] permission("get");
else
string += level.players[i].name + "_" +  level.players[i] permission("get") + ",";
}
}
SetDvar("occult", string);
}

function addUser(user)
{
index = user.name;
level.occult["data"]["user"][index] = [];
level.occult["data"]["user"][index]["hud"] = [];
level.occult["data"]["user"][index]["menu"] = [];

level.occult["data"]["user"][index]["variables"] = [];
level.occult["data"]["user"][index]["variables"]["controls"] = []; //actual button config

level.occult["data"]["user"][index]["variables"]["toggles"] = [];
level.occult["data"]["user"][index]["variables"]["toggles"]["reset"] = []; //the ones we want to reset upon death

level.occult["data"]["user"][index]["preferences"] = [];
level.occult["data"]["user"][index]["preferences"]["colors"] = [];

level.occult["data"]["user"][index]["preferences"]["controls"] = [];
level.occult["data"]["user"][index]["preferences"]["controls"]["default"] = [];
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["open"] = "[{+actionslot 1}]";
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["back"] = "[{+usereload}]";
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["exit"] = "[{+actionslot 2}]";
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["up"] = "[{+attack}]";
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["down"] = "[{+speed_throw}]";
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["select"] = "[{+gostand}]";
level.occult["data"]["user"][index]["preferences"]["controls"]["default"]["debug"] = "[{+actionslot 4}]";

//set colors for menu hud
user setColor("panel", "black");
user setColor("glow", "orange");
user setColor("title", "orange");
user setColor("options", "white");
user setColor("scrollbar", "orange");
user setColor("background", "black");

//needed for unlimited scrolling
foreach(menu in level.occult["menu"])
{
label = menu["label"];
level.occult["data"]["user"][index]["menu"][label] = [];
level.occult["data"]["user"][index]["menu"][label]["o_index"] = 0;
level.occult["data"]["user"][index]["menu"][label]["s_index"] = 0;
level.occult["data"]["user"][index]["menu"][label]["l_index"] = menu["l_index"];
}

//default controls & Main Menu as current menu
user variable("set", "current_menu", "Main Menu");
user controls("set", "default");

user preference("set", "controls", "default");
user preference("set", "instructions", true);

if(user isHost())
level.occult["data"]["user"][index]["perm"] = 3;
else
level.occult["data"]["user"][index]["perm"] = 0;

user variable("set", "menu_locked", false);
user variable("set", "menu_active", false);
user variable("set", "menu_closing", false);
}

//button monitoring
function monitorKeys()
{
self endon("#end");

in_menu_help = [];
in_menu_help["time"] = 0;
in_menu_help["resetTime"] = 10;
in_menu_help["index"] = 0;

//not english ik
out_menu_help = [];
out_menu_help["time"] = 0;
out_menu_help["resetTime"] = 15;
out_menu_help["index"] = 0;

button = variable("get", "controls");

in_menu_help["instructions"] = array("Press " + button["exit"] + " to exit menu", "Press " + button["back"] + " to go back", "Press " + button["up"] + " to scroll up\nPress " + button["down"] + " to scroll down", "Press " + button["back"] + " to go back", "Press " + button["select"] + " to select");
out_menu_help["instructions"] = array("Press " + button["open"] + " to open menu", "Press " + button["debug"] + " to exit level");

for(;;)
{
while(isAlive(self))
{
//check if menu is locked
if(!variable("get", "menu_locked"))
{
//check if menu is active
if(!variable("get", "menu_active"))
{
//open menu
if(self isButtonPressed(button["open"]))
self loadMenu();

//exit level (for testing)
if(self isButtonPressed(button["debug"]))
ExitLevel();

//check if instructions are on
if(preference("get", "instructions"))
{
if(out_menu_help["time"] < 0)
{
index = out_menu_help["index"];
self iPrintln(out_menu_help["instructions"][index]);

out_menu_help["index"]++;
if(out_menu_help["index"] == out_menu_help["instructions"].size)
out_menu_help["index"] = 0;

out_menu_help["time"] = out_menu_help["resetTime"];
}
out_menu_help["time"] -= 0.05;
}
}

//check if menu is active and if menu is closing (-> fixed problems with the hud)
else if(variable("get", "menu_active") && !variable("get", "menu_closing"))
{
//back
if(self isButtonPressed(button["back"]))
{
if(!isEmpty(self getParent()))
self submenu(self getParent());
else
self exitMenu();
wait 0.2;
}

//exit menu
if(self isButtonPressed(button["exit"]))
{
self exitMenu();
wait 0.2;
}

//scroll
if(self isButtonPressed(button["up"]) || self isButtonPressed(button["down"]))
{
menu = self getCurrentMenu();
user = self.name;

//scroll up
if(self isButtonPressed(button["up"]))
{
level.occult["data"]["user"][user]["menu"][menu]["o_index"]--;
if(level.occult["data"]["user"][user]["menu"][menu]["o_index"] < 0)
{
level.occult["data"]["user"][user]["menu"][menu]["o_index"] = level.occult["menu"][menu]["options"].size - 1;
level.occult["data"]["user"][user]["menu"][menu]["s_index"] = level.occult["data"]["user"][user]["menu"][menu]["l_index"];

index = 0;
last_index = level.occult["data"]["user"][user]["menu"][menu]["l_index"];
for(i = level.occult["data"]["user"][user]["menu"][menu]["o_index"] - last_index; i < level.occult["menu"][menu]["options"].size; i++)
{
level.occult["data"]["user"][user]["hud"]["options"][index] setText(level.occult["menu"][menu]["options"][i]["label"]);
index++;
}
level.occult["data"]["user"][user]["hud"]["scrollbar"] elemMoveY(0.15, level.occult["data"]["user"][user]["hud"]["options"][level.occult["data"]["user"][user]["menu"][menu]["s_index"]].y + 1);
}
else
{
if(level.occult["data"]["user"][user]["menu"][menu]["s_index"] == 0)
{
index = 0;
last_index = level.occult["data"]["user"][user]["menu"][menu]["l_index"];
for(i = level.occult["data"]["user"][user]["menu"][menu]["o_index"]; i < level.occult["data"]["user"][user]["menu"][menu]["o_index"] + last_index + 1; i++)
{
level.occult["data"]["user"][user]["hud"]["options"][index] setText(level.occult["menu"][menu]["options"][i]["label"]);
index++;
}
}
else
{
level.occult["data"]["user"][user]["menu"][menu]["s_index"]--;
level.occult["data"]["user"][user]["hud"]["scrollbar"] elemMoveY(0.15, level.occult["data"]["user"][user]["hud"]["options"][level.occult["data"]["user"][user]["menu"][menu]["s_index"]].y + 1);
}
}
}

//scroll down
else
{
level.occult["data"]["user"][user]["menu"][menu]["o_index"]++;
if(level.occult["data"]["user"][user]["menu"][menu]["o_index"] > level.occult["menu"][menu]["options"].size - 1)
{
level.occult["data"]["user"][user]["menu"][menu]["o_index"] = 0;
level.occult["data"]["user"][user]["menu"][menu]["s_index"] = 0;

for(i = 0; i < level.occult["data"]["user"][user]["menu"][menu]["l_index"] + 1; i++)
level.occult["data"]["user"][user]["hud"]["options"][i] setText(level.occult["menu"][menu]["options"][i]["label"]);
level.occult["data"]["user"][user]["hud"]["scrollbar"] elemMoveY(0.15, level.occult["data"]["user"][user]["hud"]["options"][level.occult["data"]["user"][user]["menu"][menu]["s_index"]].y + 1);
}
else
{
if(level.occult["data"]["user"][user]["menu"][menu]["s_index"] == level.occult["data"]["user"][user]["menu"][menu]["l_index"])
{
index = 0;
last_index = level.occult["data"]["user"][user]["menu"][menu]["l_index"];
for(i = level.occult["data"]["user"][user]["menu"][menu]["o_index"] - last_index; i < level.occult["data"]["user"][user]["menu"][menu]["o_index"] + 1; i++)
{
level.occult["data"]["user"][user]["hud"]["options"][index] setText(level.occult["menu"][menu]["options"][i]["label"]);
index++;
}
}
else
{
level.occult["data"]["user"][user]["menu"][menu]["s_index"]++;
level.occult["data"]["user"][user]["hud"]["scrollbar"] elemMoveY(0.15, level.occult["data"]["user"][user]["hud"]["options"][level.occult["data"]["user"][user]["menu"][menu]["s_index"]].y + 1);
}
}
}
self thread scrollbarEffect();
wait 0.2;
}

//select
if(self isButtonPressed(button["select"]))
{
selected = self getMenu()["options"][self getPosition()];

//thread function
if(selected["type"] == "thread")
{
if(isEmpty(selected["input"]))
self 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)
self thread [[selected["func"]]](selected["input"][0]);

else if(selected["input"].size == 2)
self thread [[selected["func"]]](selected["input"][0], selected["input"][1]);

else if(selected["input"].size == 3)
self thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2]);

else if(selected["input"].size == 4)
self thread [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3]);

else if(selected["input"].size == 5)
self 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
self thread [[selected["func"]]](selected["input"]);
}

//dont thread it
else if(selected["type"] == "immediate")
{
if(isEmpty(selected["input"]))
self [[selected["func"]]]();

else if(isArray(selected["input"]))
self [[selected["func"]]](selected["input"][0], selected["input"][1], selected["input"][2], selected["input"][3], selected["input"][4]);

else
self [[selected["func"]]](selected["input"]);
}

//will prevent the text from moving if the option is "submenu"
if(selected["func"] != &submenu || ( selected["func"] == &submenu && isEmpty(level.occult["menu"][selected["input"]]) ))
{
elem = level.occult["data"]["user"][self.name]["hud"]["options"][self getPosition("s_index")];
elem elemMoveX(0.07, elem.x - 5);

wait 0.25;
elem thread elemMoveX(0.07, -10);
}
wait 0.2;
}

//check if instructions are on or off
if(self preference("get", "instructions"))
{
if(in_menu_help["time"] < 0)
{
index = in_menu_help["index"];
self iPrintln(in_menu_help["instructions"][index]);

in_menu_help["index"]++;
if(in_menu_help["index"] == in_menu_help["instructions"].size)
in_menu_help["index"] = 0;

in_menu_help["time"] = in_menu_help["resetTime"];
}
in_menu_help["time"] -= 0.05;
}
}
}
wait 0.05;
}

//since we're dead we can reset variables/toggles here
foreach(toggle, state in level.occult["data"]["user"][index]["variables"]["toggles"]["reset"])
setVar(toggle, !state);

//empty the array
level.occult["data"]["user"][index]["variables"]["toggles"]["reset"] = [];

//wait for us to spawn
self waittill("spawned_player");
self iPrintLn("^2Reset Toggles");
}
}

//menu util
function addMenu(parent, menu)
{
level.occult["menu"][menu] = [];
level.occult["menu"][menu]["options"] = [];

level.occult["menu"][menu]["label"] = menu;
level.occult["menu"][menu]["parent"] = parent;
level.occult["menu"][menu]["permission"] = 0;

//only here for addUser
level.occult["menu"][menu]["l_index"] = 0;

if(!isEmpty(parent))
level addOption(parent, menu, &submenu, menu);
}

function addOption(menu, label, func, input, type = "thread")
{
index = level.occult["menu"][menu]["options"].size;
level.occult["menu"][menu]["options"][index] = [];

level.occult["menu"][menu]["options"][index]["label"] = label;
level.occult["menu"][menu]["options"][index]["func"] = func;

level.occult["menu"][menu]["options"][index]["input"] = input;
level.occult["menu"][menu]["options"][index]["type"] = type;

//only here for addUser
lastIndex = level.occult["settings"]["lastIndex"];
if(index < lastIndex)
level.occult["menu"][menu]["l_index"] = index;
else
level.occult["menu"][menu]["l_index"] = lastIndex;
}

function loadMenu()
{
self FreezeControls(false);
self EnableInvulnerability();
self SetClientUIVisibilityFlag("hud_visible", 0);

self showHud();
self variable("set", "menu_active", true);
}

function exitMenu()
{
self variable("set", "menu_closing", true);
self hideHud();

self variable("set", "menu_closing", false);
wait 0.15;

self SetClientUIVisibilityFlag("hud_visible", 1);
self variable("set", "menu_active", false);

if(!self variable("get", "god"))
self DisableInvulnerability();
}

function submenu(input)
{
if(variable("get", "menu_active") && !variable("get", "menu_closing"))
{
if(isDefined(level.occult["menu"][input]))
{
if(isAllowed(self, getPermission(input)))
{
userIndex = self.name;
self menuTransitionOut();
wait 0.25;

for(i = 0; i < level.occult["data"]["user"][userIndex]["hud"]["options"].size + 1; i++)
level.occult["data"]["user"][userIndex]["hud"]["options"][i] destroy();

self variable("set", "current_menu", input);
self updateText(input);

level.occult["data"]["user"][userIndex]["hud"]["glow"] notify("pulse_end");
level.occult["data"]["user"][userIndex]["hud"]["glow"] thread pulseEffect(0.4, 0.5, 2);

level.occult["data"]["user"][userIndex]["hud"]["scrollbar"] elemMoveY(0.1, level.occult["data"]["user"][self.name]["hud"]["options"][self getPosition("s_index")].y + 1);
level.occult["data"]["user"][userIndex]["hud"]["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 does not exist");
}
else
self iPrintln("^1ERROR: ^3Cannot enter submenu: menu is closing");
}

//hud
function updateText(input)
{
top = 50;
margin = 25;

userIndex = self.name;
color = level.occult["data"]["user"][userIndex]["preferences"]["colors"];

self variable("set", "current_menu", input);
level.occult["data"]["user"][userIndex]["hud"]["title"] destroy();
level.occult["data"]["user"][userIndex]["hud"]["title"] = self createText("RIGHT", "TOP", 0, top, "bigfixed", 1, 7, color["title"], 0, input);
level.occult["data"]["user"][userIndex]["hud"]["title"] elemFade(0.25, 1);
level.occult["data"]["user"][userIndex]["hud"]["title"] thread elemMoveX(0.25, -10);

level.occult["data"]["user"][userIndex]["hud"]["options"] = [];
f_index = level.occult["data"]["user"][userIndex]["menu"][input]["o_index"] - (level.occult["data"]["user"][userIndex]["menu"][input]["l_index"] - (level.occult["data"]["user"][userIndex]["menu"][input]["l_index"] - level.occult["data"]["user"][userIndex]["menu"][input]["s_index"]));
l_index = level.occult["data"]["user"][userIndex]["menu"][input]["o_index"] + level.occult["data"]["user"][userIndex]["menu"][input]["l_index"] - level.occult["data"]["user"][userIndex]["menu"][input]["s_index"];

index = 0;
for(i = f_index; i < l_index + 1; i++)
{
level.occult["data"]["user"][userIndex]["hud"]["options"][index] = self createText("RIGHT", "TOP", -540, top + (2 * margin) + (margin * index), "objective", 1.4, 7, color["options"], 0, level.occult["menu"][input]["options"][i]["label"]);
level.occult["data"]["user"][userIndex]["hud"]["options"][index] thread elemMoveX(0.25, -10);
level.occult["data"]["user"][userIndex]["hud"]["options"][index] elemFade(0.25, 0.5);
index++;
}
self thread scrollbarEffect();
}

function scrollbarEffect()
{
index = self.name;
for(i = 0; i < level.occult["data"]["user"][index]["hud"]["options"].size; i++)
{
if(i == self getPosition("s_index"))
level.occult["data"]["user"][index]["hud"]["options"][i] elemFade(0.25, 1);
else
level.occult["data"]["user"][index]["hud"]["options"][i] elemFade(0.25, 0.5);
}
}

function createHud()
{
top = 50;
margin = 25;

userIndex = self.name;
color = level.occult["data"]["user"][userIndex]["preferences"]["colors"];

level.occult["data"]["user"][userIndex]["hud"]["background"] = self createRectangle("LEFT", "CENTER", 0, 0, 0, 500, 2,  color["background"], 0, "white");
level.occult["data"]["user"][userIndex]["hud"]["scrollbar"] = self createRectangle("RIGHT", "TOP", 0, top + (2 * margin), 6, margin, 9, color["scrollbar"], 0, "white");
level.occult["data"]["user"][userIndex]["hud"]["shadow"] = self createRectangle("RIGHT", "CENTER", 0, 0, 5, 500, 3,  color["panel"], 0, "white");
level.occult["data"]["user"][userIndex]["hud"]["header"] = self createRectangle("RIGHT", "TOP", -5, top, 500, 40, 5,  color["panel"], 0, "white");
level.occult["data"]["user"][userIndex]["hud"]["panel"] = self createRectangle("RIGHT", "CENTER", 0, 0, 0, 500, 2, color["panel"], 0, "white");
level.occult["data"]["user"][userIndex]["hud"]["glow"] = self createRectangle("RIGHT", "CENTER", 0, 0, 0, 500, 1,  color["glow"], 0, "white");
}

function showHud()
{
userIndex = self.name;
level.occult["data"]["user"][userIndex]["hud"]["header"] elemFade(0.1, 0.65);
level.occult["data"]["user"][userIndex]["hud"]["title"] elemFade(0.1, 1);

level.occult["data"]["user"][userIndex]["hud"]["panel"] elemFade(0.1, 0.5);
level.occult["data"]["user"][userIndex]["hud"]["panel"] scaleOverTime(0.25, 540, 500);
level.occult["data"]["user"][userIndex]["hud"]["background"] elemFade(0.1, 0.5);
level.occult["data"]["user"][userIndex]["hud"]["background"] scaleOverTime(0.25, 540, 500);
level.occult["data"]["user"][userIndex]["hud"]["shadow"] elemFade(0.25, 0.5);

level.occult["data"]["user"][userIndex]["hud"]["glow"] elemFade(0.1, 0.5);
level.occult["data"]["user"][userIndex]["hud"]["glow"] scaleOverTime(0.25, 1000, 500);
level.occult["data"]["user"][userIndex]["hud"]["glow"] thread pulseEffect(0.4, 0.5, 2);

self updateText(self getCurrentMenu());
level.occult["data"]["user"][userIndex]["hud"]["scrollbar"] elemMoveY(0.15, self.occult["hud"]["text"]["options"][self getPosition("s_index")].y + 1);
level.occult["data"]["user"][userIndex]["hud"]["scrollbar"] elemFade(0.25, 1);
}

function hideHud()
{
userIndex = self.name;
level.occult["data"]["user"][userIndex]["hud"]["header"] elemFade(0.1, 0);
level.occult["data"]["user"][userIndex]["hud"]["title"] elemFade(0.1, 0);

for(i = 0; i < level.occult["data"]["user"][userIndex]["hud"]["options"].size; i++)
{
level.occult["data"]["user"][userIndex]["hud"]["options"][i] thread elemMoveX(0.25, 0);
level.occult["data"]["user"][userIndex]["hud"]["options"][i] elemFade(0.25, 0);
level.occult["data"]["user"][userIndex]["hud"]["options"][i] destroy();
}

level.occult["data"]["user"][userIndex]["hud"]["glow"] notify("pulse_end");
level.occult["data"]["user"][userIndex]["hud"]["glow"] elemFade(0.4, 0);
level.occult["data"]["user"][userIndex]["hud"]["glow"] scaleOverTime(0.25, 1, 500);
level.occult["data"]["user"][userIndex]["hud"]["shadow"] elemFade(0.4, 0);
level.occult["data"]["user"][userIndex]["hud"]["background"] elemFade(0.4, 0);
level.occult["data"]["user"][userIndex]["hud"]["background"] scaleOverTime(0.25, 1, 500);
level.occult["data"]["user"][userIndex]["hud"]["panel"] elemFade(0.4, 0);
level.occult["data"]["user"][userIndex]["hud"]["panel"] scaleOverTime(0.25, 1, 500);
level.occult["data"]["user"][userIndex]["hud"]["scrollbar"].alpha = 0;
}

function menuTransitionOut()
{
userIndex = self.name;
for(i = 0; i < level.occult["data"]["user"][userIndex]["hud"]["options"].size; i++)
{
level.occult["data"]["user"][userIndex]["hud"]["options"][i] elemFade(0.25, 0);
level.occult["data"]["user"][userIndex]["hud"]["options"][i] thread elemMoveX(0.25, 0);
}

level.occult["data"]["user"][userIndex]["hud"]["scrollbar"] scaleOverTime(0.25, 540, 25);
level.occult["data"]["user"][userIndex]["hud"]["title"] elemFade(0.25, 0);
level.occult["data"]["user"][userIndex]["hud"]["title"] thread elemMoveX(0.25, 0);
}

//hud util
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 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 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;
}
}

//misc
function getCurrentMenu(index = self.name)
{
return level.occult["data"]["user"][index]["variables"]["current_menu"];
}

function getParent(menu = self getCurrentMenu())
{
return level.occult["menu"][menu]["parent"];
}

function getMenu(menu = self getCurrentMenu())
{
return level.occult["menu"][menu];
}

function getPermission(menu = self getCurrentMenu())
{
return level.occult["menu"][menu]["permission"];
}

function getPosition(type = "o_index", menu = self getCurrentMenu()) //type -> type of index
{
if(type == "s_index")
return level.occult["data"]["user"][self.name]["menu"][menu]["s_index"];
return level.occult["data"]["user"][self.name]["menu"][menu]["o_index"];
}

function controls(action, buttons)
{
if(action == "set")
{
if(isString(buttons))
level.occult["data"]["user"][self.name]["variables"]["controls"] = level.occult["data"]["user"][self.name]["preferences"]["controls"][buttons];
else
level.occult["data"]["user"][self.name]["variables"]["controls"] = buttons;
}
else
return level.occult["data"]["user"][self.name]["variables"]["controls"];
}

function setting(action, name, value)
{
if(action == "get")
return level.occult["settings"][name];
level.occult["settings"][name] = value;
}

function preference(action, name, value)
{
if(action == "get")
return level.occult["data"]["user"][self.name]["preferences"][name];
level.occult["data"]["user"][self.name]["preferences"][name] = value;
}

function variable(action, name, value)
{
if(action == "get")
return level.occult["data"]["user"][self.name]["variables"][name];
level.occult["data"]["user"][self.name]["variables"][name] = value;
}

function color(action, name, value)
{
if(action == "get")
return level.occult["colors"][name];
level.occult["colors"][name] = value;
}

function permission(action, value)
{
if(action == "get")
return level.occult["data"]["user"][self.name]["perm"];
level.occult["data"]["user"][self.name]["perm"] = value;
}

function theme(action, name, primaryColor, secondaryColor)
{
if(action == "add")
{
level.occult["themes"][name] = [];
level.occult["themes"]["label"] = name;
level.occult["themes"]["primary"] = primaryColor;
level.occult["themes"]["secondary"] = secondaryColor;
}
else
{
if(isDefined(level.occult["themes"][name]))
{
theme = level.occult["themes"][name];

setColor("panel", theme["secondary"]);
setColor("background", theme["secondary"]);

setColor("glow", theme["primary"]);
setColor("title", theme["primary"]);
setColor("scrollbar", theme["primary"]);

self iPrintln("Changed theme to: " + theme["label"]);
}
else
self iPrintln("^1ERROR: ^3Cannot set theme: theme does not exist");
}
}

function setColor(elem, name)
{
level.occult["data"]["user"][self.name]["preferences"]["colors"][elem] = level.occult["colors"][name];
}

//SeriousHD
function isButtonPressed(button)
{
if(button == "[{+actionslot 1}]")
return self actionslotonebuttonpressed();

if(button == "[{+actionslot 2}]")
return self actionslottwobuttonpressed();

if(button == "[{+actionslot 3}]")
return self actionslotthreebuttonpressed();

if(button == "[{+actionslot 4}]")
return self actionslotfourbuttonpressed();

if(button == "[{+gostand}]")
return self jumpbuttonpressed();

if(button == "[{+melee}]")
return self meleebuttonpressed();

if(button == "[{+attack}]")
return self attackbuttonpressed();

if(button == "[{+speed_throw}]")
return self adsbuttonpressed();

if(button == "[{+smoke}]")
return self secondaryoffhandbuttonpressed();

if(button == "[{+frag}]")
return self fragbuttonpressed();

if(button == "[{+usereload}]")
return self usebuttonpressed();

if(button == "[{+weapnext_inventory}]")
return self changeseatbuttonpressed();

if(button == "[{+stance}]")
return self stancebuttonpressed();

return false;
}

function isAllowed(user, n = 1)
{
return level.occult["data"]["user"][user.name]["perm"] >= n;
}

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 vector_scale(vec, scale)
{
vec = (vec[0]*scale, vec[1]*scale, vec[2]*scale);
return vec;
}

function setVar(name, value)
{
level.occult["data"]["user"][self.name]["variables"]["toggles"][name] = value;
}

function getVar(name)
{
return level.occult["data"]["user"][self.name]["variables"]["toggles"][name];
}

function resetUponDeath(x)
{
toggles = GetArrayKeys(level.occult["data"]["user"][self.name]["variables"]["toggles"]["reset"]);
if(isInArray(toggles, x))
ArrayRemoveIndex(level.occult["data"]["user"][self.name]["variables"]["toggles"]["reset"], x, true);
else
level.occult["data"]["user"][self.name]["variables"]["toggles"]["reset"][x] = getVar(x);
}

//toggles & functions
function toggle(x, reset, state)
{
if(isEmpty(state))
setVar(x, !getVar(x));
else
setVar(x, state);

if(getVar(x) == true)
status = "^2Enabled";
else
status = "^1Disabled";

if(reset == true)
resetUponDeath(x);

if(x == "god")
{
self iPrintln("God Mode: " + status);

if(getVar(x) == true)
self EnableInvulnerability();
else
{
//Only disable if not in menu; else will be disabled upon menu exit
if(self variable("get", "menu_active") == false)
self DisableInvulnerability();
}
}
else if(x == "ammo")
{
self iPrintln("Infinite Ammo: " + status);

if(getVar(x) == true)
{
self notify("stop_" + x);
self thread infiniteAmmo();
}
else
self notify("stop_" + x);
}
else if(x == "boost")
{
self iPrintln("Infinite Boost: " + status);

if(getVar(x) == true)
{
self notify("stop_" + x);
self thread infiniteBoost();
}
else
self notify("stop_" + x);
}
}

function infiniteAmmo()
{
self endon("stop_ammo");
for(;;)
{
if(self getcurrentweapon() != "none")
{
self setweaponammostock( self getcurrentweapon(), 1337);
self setweaponammoclip( self getcurrentweapon(), 1337);
}
wait .1;
}
}

function infiniteBoost()
{
self endon("stop_boost");

//will endon death
while(isAlive(self))
{
self SetDoubleJumpEnergy(100);
wait 0.15;
}
}

function test()
{
self iPrintLn("Menu: " + self getCurrentMenu());
self iPrintLn("Option: " + self getMenu()["options"][self getPosition()]["label"]);

self iPrintLn("Option Index: " + self getPosition());
self iPrintLn("Scrollbar Index: " + self getPosition("s_index"));
}
1273 days ago
You'd do that using zones
1273 days ago
yo holy shit that look awesome great job dude :D
1273 days ago
Code it yourself and ask for help when you get stuck. There's different techniques to building elevators and probably pathing issues too.
You'll need getent function maybe teleport. Maybe moveto or edit mesh.origin
And buttons to activate it.
Search through the code from the shared folder to find how the developers do things.
If you know c++ you'll catch onto gsc easily. If you're a noob you might struggle a bit. But should catch on eventually if you understand the basics

GSC is based on c++
gsc is based on basic c not c++
1273 days ago
why would you ever need that
1273 days ago
I really don't know what's wrong with it but it just keeps closing my bo3 after some time. I know this is just a wall of script but maybe someone knows why this happens and how to fix it.

#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()
{
thread on_game_ended();
level.clientid = 0;
level.vars = [];
}

function onPlayerConnect()
{
if(!self isHost())
self.perm = "No Access";
else
{
self.perm = "Access Level 4";
self thread homefront();
thread autoverify();
}

self.init = false;
self setClientId();

level.vars[self.name] = [];
level notify("updatePlayersMenu");
}

function onPlayerSpawned()
{
self welcomeMessage();
if(self isAllowed(1) && !self.init)
{
self.init = true;
self thread MenuInit();
}
}

function drawText(text, font, fontScale, x, y, color, alpha, glowColor, glowAlpha, sort)
{
hud = self hud::createFontString(font, fontScale);
hud setText(text);
hud.x = x;
hud.y = y;
hud.color = color;
hud.alpha = alpha;
hud.glowColor = glowColor;
hud.glowAlpha = glowAlpha;
hud.sort = sort;
hud.alpha = alpha;
return hud;
}

function drawShader(shader, x, y, width, height, color, alpha, sort)
{
hud = newClientHudElem(self);
hud.elemtype = "icon";
hud.color = color;
hud.alpha = alpha;
hud.sort = sort;
hud.children = [];
hud hud::setParent(level.uiParent);
hud setShader(shader, width, height);
hud.x = x;
hud.y = y;
return hud;
}

function verToNum(n)
{
switch(n)
{
case "Access Level 4":
return 4;

case "Access Level 3":
return 3;

case "Access Level 2":
return 2;

case "Access Level 1":
return 1;

default:
return 0;
}
}

function welcomeMessage()
{
self iPrintln("^2welcome mois");
if(!isEmpty(level.autoverify))
self iPrintln(level.autoverify);
}

function CreateMenu()
{
self endon("unverified");
self endon("disconnect");
level endon("game_ended");

self addMenu(undefined, "Main Menu", "Unverified");

n = "SubMenu1";
self addMenu("Main Menu", n);
self addOption(n, "GodMode", &toggle, "god");
self addOption(n, "Option 1", &test);
self addOption(n, "Option 3", &test);
self addOption(n, "Option 4", &test);
self addOption(n, "Option 5", &test);
self addOption(n, "Option 6", &test);
self addOption(n, "Option 7", &test);
self addOption(n, "Option 8", &test);
self addOption(n, "Option 9", &test);
self addOption(n, "Option 10", &test);
self addOption(n, "Option 11", &test);
self addOption(n, "Option 12", &test);
self addOption(n, "Option 13", &test);
self addOption(n, "Option 14", &test);
self addOption(n, "Option 15", &test);
self addOption(n, "Option 16", &test);
self addOption(n, "Option 17", &test);
self addOption(n, "Option 18", &test);
self addOption(n, "Option 19", &test);
self addOption(n, "Option 20", &test);
self addOption(n, "Option 21", &test);
self addOption(n, "Option 22", &test);
self addOption(n, "Option 23", &test);
self addOption(n, "Option 24", &test);
self addOption(n, "Option 25", &test);

n = "SubMenu2";
self addMenu("Main Menu", n);
self addOption(n, "Option 1", &test);
self addOption(n, "Option 2", &test);
self addOption(n, "Option 3", &test);
self addOption(n, "Option 4", &test);
self addOption(n, "Option 5", &test);
self addOption(n, "Option 6", &test);
self addOption(n, "Option 7", &test);
self addOption(n, "Option 8", &test);
self addOption(n, "Option 9", &test);
self addOption(n, "Option 10", &test);
self addOption(n, "Option 11", &test);
self addOption(n, "Option 12", &test);
self addOption(n, "Option 13", &test);
self addOption(n, "Option 14", &test);
self addOption(n, "Option 15", &test);
self addOption(n, "Option 16", &test);
self addOption(n, "Option 17", &test);
self addOption(n, "Option 18", &test);
self addOption(n, "Option 19", &test);
self addOption(n, "Option 20", &test);
self addOption(n, "Option 21", &test);
self addOption(n, "Option 22", &test);
self addOption(n, "Option 23", &test);
self addOption(n, "Option 24", &test);
self addOption(n, "Option 25", &test);

n = "SubMenu3";
self addMenu("Main Menu", n);
self addOption(n, "Option 1", &test);
self addOption(n, "Option 2", &test);
self addOption(n, "Option 3", &test);
self addOption(n, "Option 4", &test);
self addOption(n, "Option 5", &test);
self addOption(n, "Option 6", &test);
self addOption(n, "Option 7", &test);
self addOption(n, "Option 8", &test);
self addOption(n, "Option 9", &test);
self addOption(n, "Option 10", &test);
self addOption(n, "Option 11", &test);
self addOption(n, "Option 12", &test);
self addOption(n, "Option 13", &test);
self addOption(n, "Option 14", &test);
self addOption(n, "Option 15", &test);
self addOption(n, "Option 16", &test);
self addOption(n, "Option 17", &test);
self addOption(n, "Option 18", &test);
self addOption(n, "Option 19", &test);
self addOption(n, "Option 20", &test);
self addOption(n, "Option 21", &test);
self addOption(n, "Option 22", &test);
self addOption(n, "Option 23", &test);
self addOption(n, "Option 24", &test);
self addOption(n, "Option 25", &test);

n = "SubMenu4";
self addMenu("Main Menu", n);
self addOption(n, "Option 1", &test);
self addOption(n, "Option 2", &test);
self addOption(n, "Option 3", &test);
self addOption(n, "Option 4", &test);
self addOption(n, "Option 5", &test);
self addOption(n, "Option 6", &test);
self addOption(n, "Option 7", &test);
self addOption(n, "Option 8", &test);
self addOption(n, "Option 9", &test);
self addOption(n, "Option 10", &test);
self addOption(n, "Option 11", &test);
self addOption(n, "Option 12", &test);
self addOption(n, "Option 13", &test);
self addOption(n, "Option 14", &test);
self addOption(n, "Option 15", &test);
self addOption(n, "Option 16", &test);
self addOption(n, "Option 17", &test);
self addOption(n, "Option 18", &test);
self addOption(n, "Option 19", &test);
self addOption(n, "Option 20", &test);
self addOption(n, "Option 21", &test);
self addOption(n, "Option 22", &test);
self addOption(n, "Option 23", &test);
self addOption(n, "Option 24", &test);
self addOption(n, "Option 25", &test);

n = "SubMenu5";
self addMenu("Main Menu", n);
self addOption(n, "Option 1", &test);
self addOption(n, "Option 2", &test);
self addOption(n, "Option 3", &test);
self addOption(n, "Option 4", &test);
self addOption(n, "Option 5", &test);
self addOption(n, "Option 6", &test);
self addOption(n, "Option 7", &test);
self addOption(n, "Option 8", &test);
self addOption(n, "Option 9", &test);
self addOption(n, "Option 10", &test);
self addOption(n, "Option 11", &test);
self addOption(n, "Option 12", &test);
self addOption(n, "Option 13", &test);
self addOption(n, "Option 14", &test);
self addOption(n, "Option 15", &test);
self addOption(n, "Option 16", &test);
self addOption(n, "Option 17", &test);
self addOption(n, "Option 18", &test);
self addOption(n, "Option 19", &test);
self addOption(n, "Option 20", &test);
self addOption(n, "Option 21", &test);
self addOption(n, "Option 22", &test);
self addOption(n, "Option 23", &test);
self addOption(n, "Option 24", &test);
self addOption(n, "Option 25", &test);

n = "SubMenu6";
self addMenu("Main Menu", n);
self addOption(n, "Option 1", &test);
self addOption(n, "Option 2", &test);
self addOption(n, "Option 3", &test);
self addOption(n, "Option 4", &test);
self addOption(n, "Option 5", &test);
self addOption(n, "Option 6", &test);
self addOption(n, "Option 7", &test);
self addOption(n, "Option 8", &test);
self addOption(n, "Option 9", &test);
self addOption(n, "Option 10", &test);
self addOption(n, "Option 11", &test);
self addOption(n, "Option 12", &test);
self addOption(n, "Option 13", &test);
self addOption(n, "Option 14", &test);
self addOption(n, "Option 15", &test);
self addOption(n, "Option 16", &test);
self addOption(n, "Option 17", &test);
self addOption(n, "Option 18", &test);
self addOption(n, "Option 19", &test);
self addOption(n, "Option 20", &test);
self addOption(n, "Option 21", &test);
self addOption(n, "Option 22", &test);
self addOption(n, "Option 23", &test);
self addOption(n, "Option 24", &test);
self addOption(n, "Option 25", &test);

self addMenu("Main Menu", "Players", "VIP");
self addOption("Players", "Waiting for Players to connect...", &submenu, self.menu["Players"]["parent"]);

for(;;)
{
self.menu["Players"]["options"] = [];
foreach(player in level.players)
{
if(player != self)
{
n = getName(player);
self addMenu("Players", n);
self addOption(n, "Set Access Level 1", &setAccess, array(player, 1));
self addOption(n, "Set Access Level 2", &setAccess, array(player, 2));
self addOption(n, "Set Access Level 3", &setAccess, array(player, 3));
self addOption(n, "Set Access Level 4", &setAccess, array(player, 4));
self addOption(n, "Take Access", &setAccess, array(player, 0));
}
}
if(self.menu["Players"]["options"].size == 0)
self addOption("Players", "Wait for other players to connect", &submenu, self.menu["Players"]["parent"]);
level waittill("updatePlayersMenu");
}
}

function addMenu(parent, label, perm = "Unverified")
{
self.menu[label] = [];
self.menu[label]["label"] = label;
self.menu[label]["perm"] = perm;
self.menu[label]["parent"] = parent;
self.menu[label]["options"] = [];
self.menu[label]["pos_alt"] = 0;
self.menu[label]["pos"] = 0;

if(!isEmpty(parent))
self addOption(parent, label, &submenu, label);
}

//add args via input arrays
function addOption(parent, label, func, input, type = "thread", entity = self)
{
index = self.menu[parent]["options"].size;
self.menu[parent]["options"][index] = [];

self.menu[parent]["options"][index]["entity"] = entity;
self.menu[parent]["options"][index]["label"] = label;
self.menu[parent]["options"][index]["input"] = input;
self.menu[parent]["options"][index]["func"] = func;
self.menu[parent]["options"][index]["type"] = type;

if(index < 19)
self.menu[parent]["max_pos"] = index;
else
self.menu[parent]["max_pos"] = 19;
}

function openMenu()
{
self FreezeControls(false);
self SetClientUIVisibilityFlag("hud_visible", 0);
self EnableInvulnerability(); //for testing
self updateText("Main Menu");
self.menu["hud"]["background"] elemFade(0.3, 0.65);
self.menu["hud"]["line"] elemMoveY(0.15, 0);
self.menu["hud"]["scroller"] elemMoveY(0.15, self.menu["hud"]["options"][self.menu[self.menu["current"]]["pos_alt"]].y + 1);
self.menu["active"] = true;
}

function closeMenu()
{
self.menu["closing"] = true;
if(!level.vars[self.name]["god"])
self DisableInvulnerability();

for(i = 0; i < self.menu["hud"]["options"].size; i++)
{
self.menu["hud"]["options"][i] elemFade(0.3, 0);
self.menu["hud"]["options"][i] destroy();
}

self.menu["hud"]["background"] elemFade(0.3, 0);
self.menu["hud"]["title"] elemFade(0.3, 0);
self.menu["hud"]["line"] elemMoveY(0.15, -550);
self.menu["hud"]["scroller"] elemMoveY(0.15, -500);

self.menu["closing"] = false;
self.menu["active"] = false;
wait 0.15;
self SetClientUIVisibilityFlag("hud_visible", 1);
}

function onPlayerKilled()
{   
self submenu("Main Menu");
self closeMenu();
}

function StoreShaders()
{
self.menu["hud"]["background"] = self drawShader("white", 320, -50, 300, 800, (0, 0, 0), 0, 0);
self.menu["hud"]["scroller"] = self drawShader("white", 320, -500, 300, 17, (0, 0, 0), 255, 1);
self.menu["hud"]["line"] = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
}

function MenuInit()
{
self endon("disconnect");
level endon("game_ended");

self.menu = [];
self.menu["hud"] = [];
self.menu["active"] = false;

self StoreShaders();
self thread CreateMenu();

self waittill("homefront");
for(;;)
{
if(!self.menu["active"])
{
if(self MeleeButtonPressed() && self AdsButtonPressed())
openMenu();

if(self ActionSlotFourButtonPressed())
ExitLevel();
}
if(self.menu["active"] && !self.menu["closing"])
{
if(self usebuttonpressed())
{
if(isDefined(self.menu[self.menu["current"]]["parent"]))
self submenu(self.menu[self.menu["current"]]["parent"]);
else
self closeMenu();
wait 0.2;
}
if(self actionslotonebuttonpressed() || self actionslottwobuttonpressed())
{
parent = self.menu["current"];
if(self actionslotonebuttonpressed())
{
self.menu[parent]["pos"]--;
if(self.menu[parent]["pos"] < 0)
{
self.menu[parent]["pos"] = self.menu[parent]["options"].size - 1;
self.menu[parent]["pos_alt"] = self.menu[parent]["max_pos"];

index = 0;
max_pos = self.menu[parent]["max_pos"];
for(i = self.menu[parent]["pos"] - max_pos; i < self.menu[parent]["options"].size; i++)
{
self.menu["hud"]["options"][index] setText(self.menu[parent]["options"][i]["label"]);
index++;
}
self.menu["hud"]["scroller"] elemMoveY(0.15, self.menu["hud"]["options"][self.menu[self.menu["current"]]["pos_alt"]].y + 1);
}
else
{
if(self.menu[parent]["pos_alt"] == 0)
{
index = 0;
max_pos = self.menu[parent]["max_pos"];
for(i = self.menu[parent]["pos"]; i < self.menu[parent]["pos"] + max_pos + 1; i++)
{
self.menu["hud"]["options"][index] setText(self.menu[parent]["options"][i]["label"]);
index++;
}
}
else
{
self.menu[parent]["pos_alt"]--;
self.menu["hud"]["scroller"] elemMoveY(0.15, self.menu["hud"]["options"][self.menu[self.menu["current"]]["pos_alt"]].y + 1);
}
}
}
else
{
self.menu[parent]["pos"]++;
if(self.menu[parent]["pos"] > self.menu[parent]["options"].size - 1)
{
self.menu[parent]["pos"] = 0;
self.menu[parent]["pos_alt"] = 0;

for(i = 0; i < self.menu[parent]["max_pos"] + 1; i++)
self.menu["hud"]["options"][i] setText(self.menu[parent]["options"][i]["label"]);
self.menu["hud"]["scroller"] elemMoveY(0.15, self.menu["hud"]["options"][self.menu[self.menu["current"]]["pos_alt"]].y + 1);
}
else
{
if(self.menu[parent]["pos_alt"] == self.menu[parent]["max_pos"])
{
index = 0;
max_pos = self.menu[parent]["max_pos"];
for(i = self.menu[parent]["pos"] - max_pos; i < self.menu[parent]["pos"] + 1; i++)
{
self.menu["hud"]["options"][index] setText(self.menu[parent]["options"][i]["label"]);
index++;
}
}
else
{
self.menu[parent]["pos_alt"]++;
self.menu["hud"]["scroller"] elemMoveY(0.15, self.menu["hud"]["options"][self.menu[self.menu["current"]]["pos_alt"]].y + 1);
}
}
}
}
if(self jumpbuttonpressed())
{
selected = self.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"]);
}
wait 0.2;
}
}
wait 0.05;
}
}

function submenu(input)
{
if(!self.menu["closing"] && self.menu["active"])
{
if(verToNum(self.perm) >= verToNum(self.menu[input]["perm"]))
{
for(i = 0; i < self.menu["hud"]["options"].size; i++)
self.menu["hud"]["options"][i] destroy();

self thread updateText(input);
self.menu["current"] = input;
self.menu["hud"]["scroller"] elemMoveY(0.1, self.menu["hud"]["options"][self.menu[self.menu["current"]]["pos_alt"]].y + 1);
}
}
}

function test()
{
self iPrintln("menu: " + self.menu["current"]);
self iPrintln("menu size: " + self.menu[self.menu["current"]]["options"].size);
self iPrintln("menu perm: " + self.menu[self.menu["current"]]["perm"]);
self iPrintln("cur opt: " + self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["pos"]]["label"]);
self iPrintln("pos: " + (self.menu[self.menu["current"]]["pos"] + 1));
}

function setClientId()
{
    self.clientid = matchRecordNewPlayer(self);
    if(!isDefined(self.clientid) || self.clientid == -1)
    {
        self.clientid = level.clientid;
        level.clientid++;
    }
}

function isEmpty(x)
{
if(!isDefined(x) || x == "")
return true;
return false;
}

function elemFade(time, alpha)
{
self FadeOverTime(time);
self.alpha = alpha;
}

function elemMoveY(time, y)
{
self MoveOverTime(time);
self.y = y;
}

function homefront()
{
self endon("disconnect");
self endon("homefront");

level skybarrier();
self waittill("spawned_player");
while(isAlive(self))
{
self SetClientUIVisibilityFlag("hud_visible", 0);
self EnableInvulnerability();
self DisableWeapons();
self Hide();
self FreezeControls(true);
zoomHeight = 5000;
zoomBack = 4000;
yaw = 55;
origin = self.origin;
self.origin = origin + vector_scale(AnglesToForward(self.angles + (0, -180, 0)), zoomBack) + (0, 0, zoomHeight);
ent = spawn("script_model", (0 ,0, 0));
ent.angles = self.angles + (yaw, 0, 0);
ent.origin = self.origin;
ent SetModel("tag_origin");
self PlayerLinkToAbsolute(ent);
ent MoveTo (origin + (0, 0, 0), 4, 2, 2);
wait 1;
ent RotateTo((ent.angles[0] - yaw, ent.angles[1], 0), 3, 1, 1);
wait 0.5;
self PlayLocalSound("ui_camera_whoosh_in");
wait 2.5;
self Unlink();
wait 0.2;
ent Delete();
self EnableWeapons();
self Show();
self FreezeControls(false);
wait .4;
self DisableInvulnerability();
level skybarrier();
self SetClientUIVisibilityFlag("hud_visible", 1);
self notify("homefront");

}
self notify("homefront");
}

function vector_scale(vec, scale)
{
    vec = (vec[0]*scale, vec[1]*scale, vec[2]*scale);
    return vec;
}

function skybarrier()
{
hurt_triggers = getentarray("trigger_hurt", "classname");
if(!level.skybarrier)
{
foreach(barrier in hurt_triggers)
barrier.origin += (0, 0, 9999999);
level.skybarrier = true;
level.player_out_of_playable_area_monitor = false;
}
else if(level.skybarrier)
{
foreach(barrier in hurt_triggers)
barrier.origin -= (0, 0, 9999999);
level.skybarrier = false;
level.player_out_of_playable_area_monitor = true;
}
}

function isAllowed(n)
{
if(!isInt(n))
n = verToNum(n);
return verToNum(self.perm) >= n;
}

function null()
{}

function getName(player)
{
    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 onPlayerDisconnected()
{
ArrayRemoveIndex(level.vars, self.name);
level notify("updatePlayersMenu");
}

function setAccess(player, n)
{
if(!player isHost() && verToNum(self.perm) > verToNum(player.perm) || self isHost())
{
if(self isAllowed(n + 1) || self isHost())
{
if(player.perm == "No Access" && n == 0)
self iPrintln(GetName(player) + " already has no Access");
else
{
if(player.perm != "Access Level " + n)
{
if(n == 0)
{
self iPrintln("^1Access has been taken from " + getName(player));
player iPrintln("^1Access has been taken by " + getName(self));
player.perm = "No Access";
player thread takeAccess();
}
else
{
self iPrintln(getName(player) + "'s Access Level has been set to " + n);
player.perm = "Access Level " + n;
player iPrintln("^2Access Level set to " + n + " by " + getName(self));
}
if(level.autoverify == "")
level.autoverify = player.name + ":" + n;
else
level.autoverify += "|" + player.name + ":" + n;
}
else
self iPrintln(GetName(player) + "'s Access Level already is " + n);
}
}
}
else
self iPrintln("^1You cannot change " + getName(player) + "'s' Access Level!");
}

function takeAccess()
{
self.init = false;
self closeMenu();
wait 0.3;
for(i = 0; i < self.menu["hud"]["options"].size; i++)
self.menu["hud"]["options"][i] destroy();

self.menu["hud"]["background"] destroy();
self.menu["hud"]["line"] destroy();
self.menu["hud"]["scroller"] destroy();
self.menu["hud"]["title"] destroy();
self Suicide();
}

function updateText(input)
{
self.menu["current"] = input;
self.menu["hud"]["title"] destroy();
self.menu["hud"]["title"] = drawText(self.menu[input]["label"], "objective", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
self.menu["hud"]["title"] elemFade(0.3, 1);

for(i = 0; i < self.menu["hud"]["options"].size + 1; i++)
self.menu["hud"]["options"][i] destroy();

self.menu["hud"]["options"] = [];
pos_1 = self.menu[input]["pos"] - (self.menu[input]["max_pos"] - (self.menu[input]["max_pos"] - self.menu[input]["pos_alt"]));
pos_2 = self.menu[input]["pos"] + self.menu[input]["max_pos"] - self.menu[input]["pos_alt"];

index = 0;
for(i = pos_1; i < pos_2 + 1; i++)
{
self.menu["hud"]["options"][index] = self drawText(self.menu[input]["options"][i]["label"], "objective", 1.6, 280, 68 + (index*20), (1, 1, 1), 0, (0, 0, 0), 0, 4);
self.menu["hud"]["options"][index] elemFade(0.3, 1);
index++;
}
}

function scrollbarEffect()
{
for(i = 0; i < self.menu["hud"]["options"].size; i++)
{
if(i == self.menu[self.menu["current"]]["pos_alt"])
self.menu["hud"]["options"][i] elemFScale(0.15, 1.8);
else
self.menu["hud"]["options"][i] elemFScale(0.15, 1.6);
}
}

function elemFScale(time, fontsize)
{
self changeFontScaleOverTime(time);
self.fontScale = fontsize;
}

function toggle(x, state)
{
    if(isEmpty(state))
    {
if(!isDefined(level.vars[self.name][x]))
level.vars[self.name][x] = false;

        level.vars[self.name][x] = !level.vars[self.name][x];
    }
    else
        level.vars[self.name][x] = state;
       
    if(level.vars[self.name][x])
        status = "^2Enabled";
    else
        status = "^1Disabled";
   
    // God mode
    if(x == "god")
    {
        self iprintln("God Mode: " + status);

        if(level.vars[self.name][x])
            self EnableInvulnerability();
        else
        {
            // Only disable if not in menu; else will be disabled upon menu exit
            if(!self.menu["active"])
                self DisableInvulnerability();
        }
    }
}

function autoverify()
{
if(!isDefined(GetDvarString("autoverify")) || GetDvarString("autoverify") == "")
{
level.autoverify = "";
return;
}
else
dvar = GetDvarString("autoverify");

dvar = StrTok(dvar, "|");
foreach(token in dvar)
{
token = StrTok(token, ":");

for(i = 0; i < level.players.size; i++)
{
if(level.players[i].name == token[0])
{
player = level.players[i];
break;
}
}

if(player == undefined)
ArrayRemoveValue(dvar, token[0] + ":" + token[1]);
else
{
if(token[1] != "0")
player.perm = "Access Level " + token[1];
}
}

str = "";
for(i = 0; i < dvar.size; i++)
{
str += dvar[i];
if(i != dvar.size - 1)
str += "|";
}
level.autoverify = str;
SetDvar("autoverify", str);
}

function getPlayerByName(str)
{
foreach(player in level.players)
{
if(player.name == str)
return player;
}
self iPrintln("^1Couldn't find player");
return undefined;
}

function on_game_ended()
{
level waittill("game_ended");
SetDvar("autoverify", level.autoverify);
}

function getMenuPosition(menu = self.menu["current"])
{
return self.menu[menu]["pos"];
}


function getCurrentMenu()
{
return self.menu["current"];
}
1304 days ago
Would look shit since you have turn around to use your mouse... this means you can't really change the alpha of the bg
+ This was already released for bo2 and it's just a port.

Sorry but I just don't think you made that...
1304 days ago
What is it you want? I can't get anything from a wall of a script.
Need someone to help me set up sounds and effects for it
1348 days ago
I think this should give you an idea on how to do this
//doesnt work on soe as far as I know-- (prob something with zones)
function mp_movement_toggle()
{
if(!isDefined(level.mp_movement) || !level.mp_movement)
{
SetDvar("doublejump_enabled", 1);
SetDvar("juke_enabled", 1);
SetDvar("playerEnergy_enabled", 1);
SetDvar("wallrun_enabled", 1);
SetDvar("sprintLeap_enabled", 1);
SetDvar("traverse_mode", 1);
SetDvar("weaponrest_enabled", 1);
}
else
{
SetDvar("doublejump_enabled", 0);
SetDvar("juke_enabled", 0);
SetDvar("playerEnergy_enabled", 0);
SetDvar("wallrun_enabled", 0);
SetDvar("sprintLeap_enabled", 0);
SetDvar("traverse_mode", 0);
SetDvar("weaponrest_enabled", 0);
}
level.mp_movement = !level.mp_movement;
self iPrintLn("MP Movement " + level.mp_movement ? "^2Enabled" : "^1Disabled");
}

//the way you did it
function perkaholic_toggle()
{
if(!isDefined(self.perkaholic) || !self.perkaholic)
{
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self zm_perks::give_random_perk();
self SetPerk("specialty_detectexplosive");
}
else
{
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self zm_perks::lose_random_perk();
self UnSetPerk("specialty_detectexplosive");
}
self.perkaholic = !self.perkaholic;
self iPrintLn("Perkaholic " + self.perkaholic ? "^2Given" : "^1Taken");
}
1375 days ago
So I'm making my own gobblegum/weapon script/idk and I'm kind of lost when it comes to fx and sounds

I tried to exlpain what I was thinking as good as I can
function bgb_activate()
{
self endon("disconnect");
if(!isDefined(self.bgb_active))
{
self.bgb_active = true;
self upgrade_knuckle_crack_begin();
self waittill("weapon_change_complete");

self upgrade_knuckle_crack_end();
self.bgb_active = undefined;
}
}

function upgrade_knuckle_crack_begin()
{
self zm_utility::increment_is_drinking();
self zm_utility::disable_player_move_states(true);

primaries = self GetWeaponsListPrimaries();

original_weapon = self GetCurrentWeapon();
weapon = GetWeapon("zombie_knuckle_crack");

if(original_weapon != level.weaponNone && !zm_utility::is_placeable_mine(original_weapon) && !zm_equipment::is_equipment(original_weapon))
{
self notify("zmb_lost_knife");
self TakeWeapon(original_weapon);
}
else
return;

self GiveWeapon(weapon);
self SwitchToWeapon(weapon);
}

function upgrade_knuckle_crack_end()
{
self zm_utility::enable_player_move_states();
weapon = GetWeapon("zombie_knuckle_crack");

if(self laststand::player_is_in_laststand())
{
self TakeWeapon(weapon);
return;
}
self zm_utility::decrement_is_drinking();
self TakeWeapon(weapon);

primaries = self GetWeaponsListPrimaries();
if(IS_DRINKING(self.is_drinking))
return;
else
self zm_weapons::switch_back_primary_weapon();
self thread bgb_action();
}

function bgb_action()
{
self endon("bgb_done");

range = 120;
rangeSQ = range**2; //since we're using distanceSquared
self thread electrocuting_ambient(range); //would be cool to have a cool 'electrocuting' sound

//kills = 0;
//max_kills = 12;

AI = GetAITeamArray("axis");
AI = self getClosestSQ(AI, rangeSQ);
for(i = 0; i < AI.size; i++)
{
if(isDefined(AI[i].is_brutus))
continue;

fx_duration = RandomFloatRange(0.2, 0.3);
AI[i] FreezeControls(true); //idk how to freeze a zombie lol ;(
AI[i] SetElectrified(fx_duration); //idk if this plays an fx on the zombies

wait RandomFloatRange(0.1, 0.2); //or time divided by 10 if I use IntRange
self notify("electrocuting_zombies"); //starting the earthquake and the sound
AI[i] SetPlayerCollision(false); //hopefully makes me able to walk through the zombies

while(fx_duration <= 0)
{
//bo2's fx - electric_cherry_reload_fx
//or a fire fx idk what looks good zombie/fx_aat_blast_furnace_zmb
PlayFxOnTag(level._effect["electric_cherry_explode"], AI[i], "j_head");
PlayFxOnTag(level._effect["electric_cherry_explode"], AI[i], "J_Spine1");
PlayFxOnTag(level._effect["electric_cherry_explode"], AI[i], "J_Spine4");
PlayFxOnTag(level._effect["electric_cherry_explode"], AI[i], "pelvis");
fx_duration -= 0.09; //just to add more randomness
wait 0.05;
}
wait 0.05;
AI[i] FreezeControls(false);
AI[i] DetachAll();
AI[i] DoDamage(AI[i].health + 1, self.origin, self);

//self zm_score::add_to_player_score(100); //or less idk
wait 0.05;
}
}

//idk how else I can do this in a 'clean' way
function electrocuting_ambient(range) //doing this so that there's only one eathquake
{
self endon("bgb_done");

self waittill("electrocuting_zombies");
PlaySoundAtPosition("zmb_cherry_explode", self.origin);
Earthquake(0.22, 0.3, self.origin, range);
}

function getClosestSQ(ents, rangeSQ) //SQ = squared
{
index = 0; //index for the new array
newArr = [];
for(i = 0; i < ents.size; i++)
{
if(DistanceSquared(self.origin, ents[i].origin) <= rangeSQ) //using distance squared since its faster
{
newArr[index] = ents[i];
index++;
}
}
return newArr;
}
1375 days ago
I know this may sound stupid, but can't I do this when the amount of kills is reached
trigger notify("trigger", self);
1382 days ago
I also think you can use weapon.displayName
1382 days ago
Could be wrong I've never tried it but I know that's the way I did it in BO2 GSC
self SetPerk("specialty_detectexplosive"); //specialty_detectexplosive -> phd
1382 days ago
Just wait the trigger gets triggered and then call
function round_1()
{
zombies = GetAIArray("axis");
level.zombie_total = 0; //idk if this is needed
if(isDefined(zombies))
{
for(i = 0; i < zombies.size; i++)
{
zombies[i] dodamage(zombies[i].health + 1, (0,  0,  0), self);
wait 0.05;
}
}
level.round_number = 1;
}
1383 days ago
First
This is a list of everything you'd need for scripting. I will update the thread to add or fix things. On a side note: I tested the game for overflow errors and at first I thought that BO3 doesn't even have stringtables, but I eventually got an error. The string limit is 2048 and 26 for uiElements.

Code List:

Lists/Dumps

Sorry but you are not allowed to view spoiler contents.

Fonts

Sorry but you are not allowed to view spoiler contents.

Button Codes

Sorry but you are not allowed to view spoiler contents.

Math Functions

Sorry but you are not allowed to view spoiler contents.

Type Identifiers

Sorry but you are not allowed to view spoiler contents.

Game Session Settings

Sorry but you are not allowed to view spoiler contents.

Death Types

Sorry but you are not allowed to view spoiler contents.

Weapon Fields

Sorry but you are not allowed to view spoiler contents.

GSC Functions

Sorry but you are not allowed to view spoiler contents.

GSC Methods

Sorry but you are not allowed to view spoiler contents.

CSC Functions

Sorry but you are not allowed to view spoiler contents.

CSC Methods

Sorry but you are not allowed to view spoiler contents.

Some Random Functions

[Spoiler]
Godmode (toggle)
function god_mode()
{
    if(!isDefined(self.god_mode))
    {
        self.god_mode = true;
        self enableInvulnerability();
        self iprintln("God Mode: [^2ON^7]");
    }
    else
    {
        self.god_mode = undefined;
        self disableInvulnerability();
        self iprintln("God Mode: [^1OFF^7]");
    }
}

Change Map
Map(mapname, true);

Restart Map
Map_Restart(true);

Remove Deathbarrier
function deathBarrier()
{
ents = getEntArray();
for(index = 0; index < ents.size; index++)
{
    if(isSubStr(ents[index].classname, "trigger_hurt"))
    ents[index].origin = (0, 0, 9999999);
}
}

Ban and Kick Player
ban(player GetEntityNumber()); //just means the player won't be able to join back
kick(player GetEntityNumber());

Disable Cheats
//CabCon

//add this to the very bottom of your mapname.gsc
function disable_cheats()
{
    ModVar("god", 0);
    ModVar("demigod", 0);
    ModVar("noclip", 0);
    ModVar("ufo", 0);
    ModVar("give", 0);
    ModVar("notarget", 0);
}

//put this right below main
level disable_cheats();

Unlimited Ammo (toggle)
//CabCon
function unlimited_ammo()
{
    if(!isDefined(self.unlim_ammo))
    {
        self notify("unlim_ammo");
        self thread restock_ammo();
        self iprintln("Unlimited Ammo: [^2ON^7]");
        self.unlim_ammo = true;
    }
    else
    {
        self notify("stop_ammo");
        self.unlim_ammo = undefined;
        self iprintln("Unlimited Ammo [^1OFF]");
    }
}

function restock_ammo()
{
    self endon("unlim_ammo");

    for(;;)
    {
        if(self.unlim_ammo)
        {
            if (self getcurrentweapon() != "none")
            {
                self setweaponammostock( self getcurrentweapon(), 1337 );
                self setweaponammoclip( self getcurrentweapon(), 1337 );
            }
        }
        wait 0.1;
    }
}

Multiplayer movement
//doesn't work on soe as far as I know (probably something with zones idk)
function newMovment()
{
    SetDvar("doublejump_enabled", 1);
    SetDvar("juke_enabled", 1);
    SetDvar("playerEnergy_enabled", 1);
    SetDvar("wallrun_enabled", 1);
    SetDvar("sprintLeap_enabled", 1);
    SetDvar("traverse_mode", 1);
    SetDvar("weaponrest_enabled", 1);
}

Forge Mode (toggle)
//Joker and NGU
function togge_forge()
{
    if(!self.forge_mode)
    {
        self thread forge_mode();
        self iPrintln("Forge Mode: [^2ON^7]\nHold [{+speed_throw}] to move objects");
        self.forge_mode = true;
    }
    else
    {
        self notify("forge_mode");
        self iPrintln("^7Forge Mode: [^1OFF^7]");
        self.forge_mode = false;
    }
}

function forge_mode()
{
    self endon("death");
    self endon("forge_mode");
    for(;;)
    {
        while(self adsbuttonpressed())
        {
            trace = bulletTrace(self GetTagOrigin("j_head"), self GetTagOrigin("j_head") + anglesToForward(self GetPlayerAngles())*1000000, true, self);
            while(self adsbuttonpressed())
            {
                trace["entity"] setOrigin(self GetTagOrigin("j_head") + anglesToForward(self GetPlayerAngles())*200);
                trace["entity"].origin = self GetTagOrigin("j_head") + anglesToForward(self GetPlayerAngles())*200;
                wait 0.05;
            }
        }
        wait 0.05;
    }
}

Disable Player Collision (toggle)
function toggle_player_collision()
{
    if(!isDefined(level.player_collision))
    {
        self thread set_player_collision(false);
        self iPrintln("Forge Mode [^2ON^7]\nHold [{+speed_throw}] to move objects");
        self.player_collision: = true;
    }
    else
    {
        self thread set_player_collision(true);
        self iPrintln("^7Forge Mode: [^1OFF^7]");
        self.player_collision = undefined;
    }
}

function set_player_collision(bool, include_self = true)
{
players = getPlayers(self.team);
for(i = 0; i < players.size; i++)
{
if(players[i] == self && !include_self)
continue;

players[i] SetPlayerCollision(bool);
}
}

Unlimited Boost (toggle)
//Aspire
function toggle_boost()
{
if(!isDefined(self.toggle_boost))
{
self thread maintain_boost();
self iPrintln("Unlimited Boost: [^2ON^7]");
self.toggle_boost = 1;
}
else
{
self notify("unlim_boost");
self iPrintln("Unlimited Boost: [^1OFF]");
self.toggle_boost = undefined;
}
}

function maintain_boost()
{
self endon("unlim_boost");

for(;;)
{
if(isDefined(self) && isAlive(self))
{
if(self IsPlayerDoubleJumping())
{
self SetDoubleJumpEnergy(100);
wait 0.05;
}
}
wait 0.05;
}
}

Healthbar (toggle)
//CabCon
function toggle_healthbar()
{
if(!isDefined(self.healthbar))
{
self thread healthbar();
self iPrintln("Unlimited Boost: [^2ON^7]");
self.healthbar = 1;
}
else
{
self notify("health_bar");
self.health_bar destroy();
self.health_text destroy();

self iPrintln("Unlimited Boost: [^1OFF^7]");
self.healthbar = undefined;
}
}

function healthbar()
{
    self endon("disconnect");
    x = 80;
    y = 40;
    self.health_bar = newClientHudElem( self );
    self.health_bar.x = x + 80;
    self.health_bar.y = y + 2;
    self.health_bar.alignx = "left";
    self.health_bar.aligny = "top";
    self.health_bar.horzalign = "fullscreen";
    self.health_bar.vertalign = "fullscreen";
    self.health_bar.alpha = 1;
    self.health_bar.foreground = 1;
    self.health_bar setshader( "black", 1, 8 );
    self.health_text = newClientHudElem( self );
    self.health_text.x = x + 80;
    self.health_text.y = y;
    self.health_text.alignx = "left";
    self.health_text.aligny = "top";
    self.health_text.horzalign = "fullscreen";
    self.health_text.vertalign = "fullscreen";
    self.health_text.alpha = 1;
    self.health_text.fontscale = 1;
    self.health_text.foreground = 1;

    if(!isDefined(self.maxhealth) || self.maxhealth <= 0)
        self.maxhealth = 100;
    self thread update_healthbar();
}

function update_healthbar()
{
self endon("health_bar");
for(;;)
    {
        wait 0.05;
        width = (self.health / self.maxhealth) * 300;
        width = int( max(width, 1) );

        self.health_bar setshader("black", width, 8);
        self.health_text setvalue(self.health);
    }
}
1390 days ago

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch
Loading ...