Answered Can someone test this?

Cxwh

Veteran
Messages
64
Reaction score
45
Points
568

As I said can someone test this for me?
And if it doesn't work tell me where the error is?
(if the error gets displayed)

Code:
#using scripts\mp\_util;
#using scripts\codescripts\struct;
#using scripts\shared\util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\hud_util_shared;
#using scripts\shared\hud_message_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( &onPlayerDisconnect );
    callback::on_player_killed( &onPlayerKilled );
}

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

    level.access = [];
    level.access[0] = "No Access";
    level.access[1] = "Access Level 1";
    level.access[2] = "Access Level 2";
    level.access[3] = "Access Level 3";
    level.access[4] = "Access Level 4";

    level.allPlayersConnected = false;
    level.debug = false;

    level onGameEnded();

    level waittill("all_players_connected");
    level.allPlayersConnected = true;
    level.allPlayers = getPlayers();
}

function onPlayerConnect()
{
    self setClientId();
    if(!isDefined(self.info))
    {
        self.info = [];
        self.info["name"] = self getName();
        self.info["clan"] = self getClan();
        self.info["perm"] = (self isHost()) ? level.access[4] : level.access[0];
        self.info["init"] = false; //player has had access to menu
    }

    if(level.allPlayersConnected)
        level notify("player_connected"); //for the players menu (which will be added later)

    self thread onPlayerSpawned();
}

function onPlayerSpawned()
{
    self endon("disconnect");
    level endon("game_ended");
   
    for(;;)
    {
        self waittill("spawned_player");
        if(self isAllowed(1))
        {
            //just for now will be replaced with a welcome message later on
            self iPrintLn("instructions");
            self iPrintLn("melee and aim to open");
            self iPrintLn("actionslot 1 and 2 to scroll");
            self iPrintLn("use button to exit");

            if(!self.info["init"])
            {
                /*if(self isHost())
                    level thread overflowfix();*/

                self thread MenuInit();
                self.info["init"] = true;
            }
        }
    }
}

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

function onPlayerDisconnect()
{
    level notify("player_diconnected");
}

function onGameEnded()
{
    level waittill("game_ended");
    //do something
}

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

function getName()
{
    name = getSubStr(self.name, 0, self.name.size);
    for(i = 0; i < name.size; i++)
    {
        if(name[i] == "]")
            break;
    }
    if(name.size != i)
        name = getSubStr(name, i + 1, name.size);
    return name;
}

function getClan()
{
    clan = getSubStr(self.name, 0, self.name.size);
    if(clan[0] != "[")
        return "";
    for(i = 0; i < clan.size; i++)
    {
        if (clan[i] == "]")
            break;
    }
    clan = getSubStr(clan, 1, i);
    return clan;
}

function isAllowed(n)
{
    return (verToNum(self.info["perm"]) >= n);
}

function Iif(bool, rTrue, rFalse)
{
   if(bool)
     return rTrue;
   else
     return rFalse;
}

function verToNum(n)
{
    switch(n)
    {
        case level.access[4]:
            return 4;

        case level.access[3]:
            return 3;
           
        case level.access[2]:
            return 2;
           
        case level.access[1]:
            return 1;
           
        default:
            return 0;
    }
}

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

    self.menu = [];
    self.menu["vars"] = [];

    self.menu["hud"] = [];
    self.menu["hud"]["background"] = self drawShader("CENTER", "CENTER", 0, 0, "white", 260, 800, (0, 0, 0), 0, 1);

    self.menu["locked"] = false;
    self.menu["controls"] = true;
    self createMenu();

    for(;;)
    {
        if(!self.menu["active"] && self.menu["controls"])
        {
            if(self MeleeButtonPressed() && self AdsButtonPressed())
            {
                self updateText("Main Menu");
                self.menu["hud"]["background"] elemFade(0.1, 1);
                self.menu["active"] = true;
                if(self isHost())
                {
                    setDvar("r_waterSheetingFX_enable", "1"); //no idea if this works (the dvar)
                    if(self ActionSlotThreeButtonPressed() && level.debug)
                        exitLevel();
                }
            }
            self PlayLocalSound("");
        }
        if(self.menu["active"] && !self.menu["locked"])
        {
            self thread scrollbarEffect();
            if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())
            {
                self scroll(Iif(self ActionSlotOneButtonPressed(), -1, 1));
                self PlayLocalSound("");
            }
            if(self UseButtonPressed())
            {
                if(isDefined(self.menu[self.menu["current"]]["parent"]))
                    self submenu(self.menu[self.menu["current"]]["parent"]);
                else
                    self closeMenu();

                self PlayLocalSound("");
                wait(0.2);
            }
            if(self JumpButtonPressed())
            {
                self thread [[self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["position"]]["function"]]](self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["position"]]["input"], self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["position"]]["input1"]);
                self PlayLocalSound("");
                wait(0.2);
            }
        }
        wait(0.05);
    }
}

function createMenu()
{
    self addMenu(undefined, "Main Menu", level.access[0])

    self addMenu("Main Menu", "SubMenu 1", level.access[1])
    self addOption("SubMenu 1", "Option 1", &test);
    self addOption("SubMenu 1", "Option 2", &test);
    self addOption("SubMenu 1", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 2", level.access[1])
    self addOption("SubMenu 2", "Option 1", &test);
    self addOption("SubMenu 2", "Option 2", &test);
    self addOption("SubMenu 2", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 3", level.access[1])
    self addOption("SubMenu 3", "Option 1", &test);
    self addOption("SubMenu 3", "Option 2", &test);
    self addOption("SubMenu 3", "Option 3", &test);

    //self thread updatePlayers();
}

function addMenu(parent, name, perm)
{
    self.menu[name] = [];
    self.menu[name]["options"] = [];
    self.menu[name]["parent"] = parent;
    self.menu[name]["label"] = name;
    self.menu[name]["perm"] = perm;
    self.menu[name]["position"] = 0;

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

function addOption(parent, label, func, arg1, arg2)
{
    index = self.menu[parent]["options"].size;
    self.menu[parent]["options"][index] = [];
    self.menu[parent]["options"][index]["label"] = label;
    self.menu[parent]["options"][index]["function"] = func;
    self.menu[parent]["options"][index]["input"] = arg1;
    self.menu[parent]["options"][index]["input1"] = arg2;
}

function scroll(num)
{
    if(num == -1)
    {
        if(self.menu[self.menu["current"]]["position"] < 0)
            self.menu[self.menu["current"]]["position"] = (self.menu[self.menu["current"]]["options"].size - 1);
        else
            self.menu[self.menu["current"]]["position"]--;
    }
    if(num == 1)
    {
        if(self.menu[self.menu["current"]]["position"] > (self.menu[self.menu["current"]]["options"].size - 1))
            self.menu[self.menu["current"]]["position"] = 0;
        else
            self.menu[self.menu["current"]]["position"]++;
    }
}

function submenu(input)
{
    if(self isAllowed(verToNum(self.menu[input]["perm"])))
    {
        for(i = 0; i < self.menu[input]["options"].size; i++)
        {
            self.menu["hud"]["options"][i] destroy();
        }
        //self.menu["hud"]["options"] = [];
        self.menu["current"] = input;
        self updateText(input);
    }
    else
        self iPrintLn("^1You do not have permission to access this menu!");
}

function updateText(input)
{
    self.menu["current"] = input;
    self.menu["hud"]["title"] destroy();
    self.menu["hud"]["title"] = self drawText("default", 2.4, input, "CENTER", "TOP", 0, 0, 10000, true, 0, (1, 1, 1), 1, (1, 0, 0));
    self.menu["hud"]["title"] elemFade(0.1, 1);
   
    self.menu["hud"]["options"] = [];
    for(i = 0; i < self.menu[input]["options"].size; i++)
    {
        self.menu["hud"]["options"][i] destroy();
        self.menu["hud"]["options"][i] = self drawText("hudbig", 1.4, self.menu[input]["options"][i]["label"], "CENTER", "TOP", 0, 25 + (i * 20), 10000, true, 0, (1, 1, 1));
        self.menu["hud"]["options"][i] elemFade(0.1, 1);
    }  
}

function scrollbarEffect()
{
    for(i = 0; i < self.menu[self.menu["current"]]["options"].size; i++)
    {
        if(i == self.menu[self.menu["current"]]["position"])
        {
            self.menu["hud"]["options"][i].color = (1, 1, 1);
            self.menu["hud"]["options"][i].fontScale = 2.2;
            self.menu["hud"]["options"][i].glowAlpha = 1;
            self.menu["hud"]["options"][i].glowColor = (1, 0, 0);
        }
        else
        {
            self.menu["hud"]["options"][i].color = (1, 1, 1);
            self.menu["hud"]["options"][i].fontScale = 1.5;
            self.menu["hud"]["options"][i].glowAlpha = 0;
            self.menu["hud"]["options"][i].glowColor = (1, 1, 1);
        }
    }
}

function closeMenu()
{
    if(self ishost())
        setDvar("r_waterSheetingFX_enable", "0");

    self.menu["hud"]["background"] elemFade(0.1, 0);
    self.menu["hud"]["title"] elemFade(0.1, 0);

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

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

function drawShader(align, relative, x, y, shader, width, height, color, alpha, sort)
{
    barElemBG = newClientHudElem( self );
    barElemBG.elemType = "bar";
    if(!level.splitScreen)
    {
        barElemBG.x = -2;
        barElemBG.y = -2;
    }
    barElemBG.width = width;
    barElemBG.height = height;
    barElemBG.align = align;
    barElemBG.relative = relative;
    barElemBG.xOffset = 0;
    barElemBG.yOffset = 0;
    barElemBG.children = [];
    barElemBG.sort = sort;
    barElemBG.color = color;
    barElemBG.alpha = alpha;
    barElemBG hud::setParent(level.uiParent);
    barElemBG setShader(shader, width , height);
    barElemBG.hidden = false;
    barElemBG hud::setPoint(align, relative, x, y);
    return barElemBG;
}

function drawText(font, fontScale, text, point, relative, xOffset, yOffset, sort, hideWhenInMenu, alpha, color, glowAlpha, glowColor)
{
    textElem = hud::createFontString(font, fontScale);
    textElem setText(text);
    textElem hud::setPoint(point, relative, xOffset, yOffset);
    textElem.sort = sort;
    textElem.hideWhenInMenu = hideWhenInMenu;
    textElem.alpha = alpha;
    textElem.color = color;
    textElem.glowAlpha = glowAlpha;
    textElem.glowColor = glowColor;
    return textElem;
}

function drawValue(fontSize, sorts, value, align, relative, x, y, alpha, color)
{
    uiElement = hud::createFontString("default", fontSize);
    uiElement hud::setPoint(align, relative, x, y);
    uiElement setvalue(value);
    uiElement.sort = sorts;
    uiElement.hidewheninmenu = true;
    uiElement.alpha = alpha;
    uiElement.color = color;
    return uiElement;
}

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

function test()
{
    self iPrintLn("^1test");
}

/*
function updatePlayers()
{
    self addMenu("Main Menu", "Players Menu", level.access[4]);
    for(;;)
    {
        level util::waittill_any("player_diconnected", "player_connected", "all_players_connected", "player_kicked");
        foreach(player in level.players)
        {
            if(player isHost() == false)
            {
                name = player.info["name"] " [" + player.info["perm"] + "]";

                self addMenu("Players Menu", name, level.access[0]);
                self addOption(name, "Kill Player", &killPlayer, player);
                self addOption(name, "Kick Player", &kickPlayer, player);
                self addOption(name, "Ban Player", &kickPlayer, player, "ban");
            }
        }
    }
}

function killPlayer(player)
{
    action = "kill";

    if((verToNum(self.info["perm"]) > verToNum(player.info["perm"])) || self isHost())
    {
        if(player isHost() == false)
        {
            player suicide();
            player iPrintLn(self.info["name"] + " has killed you!");
            self iPrintLn(player.info["name"] + " has been killed!");
        }
        else
            self iPrintLn("^1You cannot " + action + " the Host!");
    }
    else
        self iprintln("^1You cannot " + action + " players with " + player.info["perm"] + "!");
}

function kickPlayer(player, action)
{
    if(action != "ban")
        action = "kick";

    if((verToNum(self.info["perm"]) > verToNum(player.info["perm"])) || self isHost())
    {
        if(player isHost() == false)
        {
            if(action == "ban")
                ban(player getEntityNumber());
           
            kick(player getEntityNumber());
            wait(0.5);
            self submenu(self.menu[self.menu["current"]]["parent"]);
        }
        else
            self iPrintLn("^1You cannot " + action + " the Host!");
    }
    else
        self iprintln("^1You cannot " + action + " players with " + player.info["perm"] + "!");
}
*/
 
P

Patrick

Guest
As I said can someone test this for me?
And if it doesn't work tell me where the error is?
(if the error gets displayed)

Code:
#using scripts\mp\_util;
#using scripts\codescripts\struct;
#using scripts\shared\util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\hud_util_shared;
#using scripts\shared\hud_message_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( &onPlayerDisconnect );
    callback::on_player_killed( &onPlayerKilled );
}

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

    level.access = [];
    level.access[0] = "No Access";
    level.access[1] = "Access Level 1";
    level.access[2] = "Access Level 2";
    level.access[3] = "Access Level 3";
    level.access[4] = "Access Level 4";

    level.allPlayersConnected = false;
    level.debug = false;

    level onGameEnded();

    level waittill("all_players_connected");
    level.allPlayersConnected = true;
    level.allPlayers = getPlayers();
}

function onPlayerConnect()
{
    self setClientId();
    if(!isDefined(self.info))
    {
        self.info = [];
        self.info["name"] = self getName();
        self.info["clan"] = self getClan();
        self.info["perm"] = (self isHost()) ? level.access[4] : level.access[0];
        self.info["init"] = false; //player has had access to menu
    }

    if(level.allPlayersConnected)
        level notify("player_connected"); //for the players menu (which will be added later)

    self thread onPlayerSpawned();
}

function onPlayerSpawned()
{
    self endon("disconnect");
    level endon("game_ended");
  
    for(;;)
    {
        self waittill("spawned_player");
        if(self isAllowed(1))
        {
            //just for now will be replaced with a welcome message later on
            self iPrintLn("instructions");
            self iPrintLn("melee and aim to open");
            self iPrintLn("actionslot 1 and 2 to scroll");
            self iPrintLn("use button to exit");

            if(!self.info["init"])
            {
                /*if(self isHost())
                    level thread overflowfix();*/

                self thread MenuInit();
                self.info["init"] = true;
            }
        }
    }
}

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

function onPlayerDisconnect()
{
    level notify("player_diconnected");
}

function onGameEnded()
{
    level waittill("game_ended");
    //do something
}

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

function getName()
{
    name = getSubStr(self.name, 0, self.name.size);
    for(i = 0; i < name.size; i++)
    {
        if(name[i] == "]")
            break;
    }
    if(name.size != i)
        name = getSubStr(name, i + 1, name.size);
    return name;
}

function getClan()
{
    clan = getSubStr(self.name, 0, self.name.size);
    if(clan[0] != "[")
        return "";
    for(i = 0; i < clan.size; i++)
    {
        if (clan[i] == "]")
            break;
    }
    clan = getSubStr(clan, 1, i);
    return clan;
}

function isAllowed(n)
{
    return (verToNum(self.info["perm"]) >= n);
}

function Iif(bool, rTrue, rFalse)
{
   if(bool)
     return rTrue;
   else
     return rFalse;
}

function verToNum(n)
{
    switch(n)
    {
        case level.access[4]:
            return 4;

        case level.access[3]:
            return 3;
          
        case level.access[2]:
            return 2;
          
        case level.access[1]:
            return 1;
          
        default:
            return 0;
    }
}

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

    self.menu = [];
    self.menu["vars"] = [];

    self.menu["hud"] = [];
    self.menu["hud"]["background"] = self drawShader("CENTER", "CENTER", 0, 0, "white", 260, 800, (0, 0, 0), 0, 1);

    self.menu["locked"] = false;
    self.menu["controls"] = true;
    self createMenu();

    for(;;)
    {
        if(!self.menu["active"] && self.menu["controls"])
        {
            if(self MeleeButtonPressed() && self AdsButtonPressed())
            {
                self updateText("Main Menu");
                self.menu["hud"]["background"] elemFade(0.1, 1);
                self.menu["active"] = true;
                if(self isHost())
                {
                    setDvar("r_waterSheetingFX_enable", "1"); //no idea if this works (the dvar)
                    if(self ActionSlotThreeButtonPressed() && level.debug)
                        exitLevel();
                }
            }
            self PlayLocalSound("");
        }
        if(self.menu["active"] && !self.menu["locked"])
        {
            self thread scrollbarEffect();
            if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())
            {
                self scroll(Iif(self ActionSlotOneButtonPressed(), -1, 1));
                self PlayLocalSound("");
            }
            if(self UseButtonPressed())
            {
                if(isDefined(self.menu[self.menu["current"]]["parent"]))
                    self submenu(self.menu[self.menu["current"]]["parent"]);
                else
                    self closeMenu();

                self PlayLocalSound("");
                wait(0.2);
            }
            if(self JumpButtonPressed())
            {
                self thread [[self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["position"]]["function"]]](self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["position"]]["input"], self.menu[self.menu["current"]]["options"][self.menu[self.menu["current"]]["position"]]["input1"]);
                self PlayLocalSound("");
                wait(0.2);
            }
        }
        wait(0.05);
    }
}

function createMenu()
{
    self addMenu(undefined, "Main Menu", level.access[0])

    self addMenu("Main Menu", "SubMenu 1", level.access[1])
    self addOption("SubMenu 1", "Option 1", &test);
    self addOption("SubMenu 1", "Option 2", &test);
    self addOption("SubMenu 1", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 2", level.access[1])
    self addOption("SubMenu 2", "Option 1", &test);
    self addOption("SubMenu 2", "Option 2", &test);
    self addOption("SubMenu 2", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 3", level.access[1])
    self addOption("SubMenu 3", "Option 1", &test);
    self addOption("SubMenu 3", "Option 2", &test);
    self addOption("SubMenu 3", "Option 3", &test);

    //self thread updatePlayers();
}

function addMenu(parent, name, perm)
{
    self.menu[name] = [];
    self.menu[name]["options"] = [];
    self.menu[name]["parent"] = parent;
    self.menu[name]["label"] = name;
    self.menu[name]["perm"] = perm;
    self.menu[name]["position"] = 0;

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

function addOption(parent, label, func, arg1, arg2)
{
    index = self.menu[parent]["options"].size;
    self.menu[parent]["options"][index] = [];
    self.menu[parent]["options"][index]["label"] = label;
    self.menu[parent]["options"][index]["function"] = func;
    self.menu[parent]["options"][index]["input"] = arg1;
    self.menu[parent]["options"][index]["input1"] = arg2;
}

function scroll(num)
{
    if(num == -1)
    {
        if(self.menu[self.menu["current"]]["position"] < 0)
            self.menu[self.menu["current"]]["position"] = (self.menu[self.menu["current"]]["options"].size - 1);
        else
            self.menu[self.menu["current"]]["position"]--;
    }
    if(num == 1)
    {
        if(self.menu[self.menu["current"]]["position"] > (self.menu[self.menu["current"]]["options"].size - 1))
            self.menu[self.menu["current"]]["position"] = 0;
        else
            self.menu[self.menu["current"]]["position"]++;
    }
}

function submenu(input)
{
    if(self isAllowed(verToNum(self.menu[input]["perm"])))
    {
        for(i = 0; i < self.menu[input]["options"].size; i++)
        {
            self.menu["hud"]["options"][i] destroy();
        }
        //self.menu["hud"]["options"] = [];
        self.menu["current"] = input;
        self updateText(input);
    }
    else
        self iPrintLn("^1You do not have permission to access this menu!");
}

function updateText(input)
{
    self.menu["current"] = input;
    self.menu["hud"]["title"] destroy();
    self.menu["hud"]["title"] = self drawText("default", 2.4, input, "CENTER", "TOP", 0, 0, 10000, true, 0, (1, 1, 1), 1, (1, 0, 0));
    self.menu["hud"]["title"] elemFade(0.1, 1);
  
    self.menu["hud"]["options"] = [];
    for(i = 0; i < self.menu[input]["options"].size; i++)
    {
        self.menu["hud"]["options"][i] destroy();
        self.menu["hud"]["options"][i] = self drawText("hudbig", 1.4, self.menu[input]["options"][i]["label"], "CENTER", "TOP", 0, 25 + (i * 20), 10000, true, 0, (1, 1, 1));
        self.menu["hud"]["options"][i] elemFade(0.1, 1);
    } 
}

function scrollbarEffect()
{
    for(i = 0; i < self.menu[self.menu["current"]]["options"].size; i++)
    {
        if(i == self.menu[self.menu["current"]]["position"])
        {
            self.menu["hud"]["options"][i].color = (1, 1, 1);
            self.menu["hud"]["options"][i].fontScale = 2.2;
            self.menu["hud"]["options"][i].glowAlpha = 1;
            self.menu["hud"]["options"][i].glowColor = (1, 0, 0);
        }
        else
        {
            self.menu["hud"]["options"][i].color = (1, 1, 1);
            self.menu["hud"]["options"][i].fontScale = 1.5;
            self.menu["hud"]["options"][i].glowAlpha = 0;
            self.menu["hud"]["options"][i].glowColor = (1, 1, 1);
        }
    }
}

function closeMenu()
{
    if(self ishost())
        setDvar("r_waterSheetingFX_enable", "0");

    self.menu["hud"]["background"] elemFade(0.1, 0);
    self.menu["hud"]["title"] elemFade(0.1, 0);

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

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

function drawShader(align, relative, x, y, shader, width, height, color, alpha, sort)
{
    barElemBG = newClientHudElem( self );
    barElemBG.elemType = "bar";
    if(!level.splitScreen)
    {
        barElemBG.x = -2;
        barElemBG.y = -2;
    }
    barElemBG.width = width;
    barElemBG.height = height;
    barElemBG.align = align;
    barElemBG.relative = relative;
    barElemBG.xOffset = 0;
    barElemBG.yOffset = 0;
    barElemBG.children = [];
    barElemBG.sort = sort;
    barElemBG.color = color;
    barElemBG.alpha = alpha;
    barElemBG hud::setParent(level.uiParent);
    barElemBG setShader(shader, width , height);
    barElemBG.hidden = false;
    barElemBG hud::setPoint(align, relative, x, y);
    return barElemBG;
}

function drawText(font, fontScale, text, point, relative, xOffset, yOffset, sort, hideWhenInMenu, alpha, color, glowAlpha, glowColor)
{
    textElem = hud::createFontString(font, fontScale);
    textElem setText(text);
    textElem hud::setPoint(point, relative, xOffset, yOffset);
    textElem.sort = sort;
    textElem.hideWhenInMenu = hideWhenInMenu;
    textElem.alpha = alpha;
    textElem.color = color;
    textElem.glowAlpha = glowAlpha;
    textElem.glowColor = glowColor;
    return textElem;
}

function drawValue(fontSize, sorts, value, align, relative, x, y, alpha, color)
{
    uiElement = hud::createFontString("default", fontSize);
    uiElement hud::setPoint(align, relative, x, y);
    uiElement setvalue(value);
    uiElement.sort = sorts;
    uiElement.hidewheninmenu = true;
    uiElement.alpha = alpha;
    uiElement.color = color;
    return uiElement;
}

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

function test()
{
    self iPrintLn("^1test");
}

/*
function updatePlayers()
{
    self addMenu("Main Menu", "Players Menu", level.access[4]);
    for(;;)
    {
        level util::waittill_any("player_diconnected", "player_connected", "all_players_connected", "player_kicked");
        foreach(player in level.players)
        {
            if(player isHost() == false)
            {
                name = player.info["name"] " [" + player.info["perm"] + "]";

                self addMenu("Players Menu", name, level.access[0]);
                self addOption(name, "Kill Player", &killPlayer, player);
                self addOption(name, "Kick Player", &kickPlayer, player);
                self addOption(name, "Ban Player", &kickPlayer, player, "ban");
            }
        }
    }
}

function killPlayer(player)
{
    action = "kill";

    if((verToNum(self.info["perm"]) > verToNum(player.info["perm"])) || self isHost())
    {
        if(player isHost() == false)
        {
            player suicide();
            player iPrintLn(self.info["name"] + " has killed you!");
            self iPrintLn(player.info["name"] + " has been killed!");
        }
        else
            self iPrintLn("^1You cannot " + action + " the Host!");
    }
    else
        self iprintln("^1You cannot " + action + " players with " + player.info["perm"] + "!");
}

function kickPlayer(player, action)
{
    if(action != "ban")
        action = "kick";

    if((verToNum(self.info["perm"]) > verToNum(player.info["perm"])) || self isHost())
    {
        if(player isHost() == false)
        {
            if(action == "ban")
                ban(player getEntityNumber());
          
            kick(player getEntityNumber());
            wait(0.5);
            self submenu(self.menu[self.menu["current"]]["parent"]);
        }
        else
            self iPrintLn("^1You cannot " + action + " the Host!");
    }
    else
        self iprintln("^1You cannot " + action + " players with " + player.info["perm"] + "!");
}
*/
Why would you try to code for black ops 3 if you dont have the game lol, it makes no sense.
 

Cxwh

Veteran
Messages
64
Reaction score
45
Points
568
Why would you try to code for black ops 3 if you dont have the game lol, it makes no sense.
I have it, but I keep getting a 'could not read fast file error' whenever I try to play custom maps/mods. I looked for a fix, but can't find one :/
 

ProSuchtiHD

Known Member
Messages
13
Reaction score
9
Points
108
I will test it in a few moments and will upload a working version.
Your error can occour when you compile your mod in another language than your game is. You have to select it under options.
 

ProSuchtiHD

Known Member
Messages
13
Reaction score
9
Points
108
This rar file is your code and it works now. It had many errors and mistakes but I fixed it.
Here you go.
Also it is compiled so that you can use it in your bo3 when you play it in German or in English.
 

Attachments

  • mp_mod_menu_1.rar
    22.9 KB · Views: 72

Cxwh

Veteran
Messages
64
Reaction score
45
Points
568
This rar file is your code and it works now. It had many errors and mistakes but I fixed it.
Here you go.
Also it is compiled so that you can use it in your bo3 when you play it in German or in English.
Thanks for the help and I noticed some of the errors afterwards!
 
Top