ProSuchtiHD
Known Member
- Messages
- 13
- Reaction score
- 9
- Points
- 108
Hello I´m a newbie but I have much time, but I don´t know how to update the Players Menu for an Access Control for my Menu.
So please help me!
I think the variables of the players are changing but in the menu it stands the text before.
So please help me!
I think the variables of the players are changing but in the menu it stands the text before.
Code:
#using scripts\codescripts\struct;
#using scripts\shared\callbacks_shared;
#using scripts\shared\system_shared;
#using scripts\shared\weapons_shared;
#using scripts\shared\array_shared;
#using scripts\shared\hud_message_shared;
#using scripts\shared\hud_util_shared;
#using scripts\shared\bots\_bot;
#using scripts\mp\gametypes\_globallogic_ui;
#using scripts\mp\gametypes\_loadout;
#using scripts\mp\gametypes\_globallogic_score;
#using scripts\shared\util_shared;
#using scripts\mp\killstreaks\_killstreaks;
#using scripts\mp\killstreaks\_dogs;
#insert scripts\shared\shared.gsh;
#namespace clientids;
REGISTER_SYSTEM( "clientids", &__init__, undefined )
function __init__()
{
//SetDvar("developer", 2);
callback::on_start_gametype( &init );
callback::on_connect( &on_player_connect );
callback::on_spawned( &on_player_spawned );
callback::on_player_killed(&on_player_killed);
level.player_out_of_playable_area_monitor = false;
}
function init()
{
level.clientid = 0;
level.player_out_of_playable_area_monitor = false;
}
function on_player_killed()
{
self iprintln("Ein Tot mehr!");
}
function on_player_connect()
{
for(;;)
{
level waittill("connected", player);
player thread on_player_spawned();
player.Verified = false;
player.Admin = false;
player.CoHost = false;
player.MyAccess = "";
level.player_out_of_playable_area_monitor = false;
}
}
function on_player_spawned()
{
self endon( "disconnect" );
level endon( "game_ended" );
if(self isHost())
{
self.MyAccess = "Host";
self freezecontrols(false);
}
else if(self.Admin == true)
{
self.Admin = true;
self.MyAccess = "Admin";
self freezecontrols(false);
}
else if(self.CoHost == true)
{
self.CoHost = true;
self.MyAccess = "CoHost";
self freezecontrols(false);
}
else if ( self.Verified == true)
{
self.Verified = true;
self.MyAccess = "Verified";
self freezecontrols(false);
}
else if ( self.Verified == false)
{
self.Verified = false;
self.MyAccess = "";
}
if(!isDefined(self.menu["active"]))
{
if (self.MyAccess != "")
{
self thread init_menuSystem();
self.menu["active"] = true;
self iprintln("Welcome "+self.name+" to "+self.menu["name"]+" ^7for Black Ops 3");
self iprintln("By ^2ProSuchtiHD");
self iprintln("Use Aim and Knife to open Menu");
if(self.MyAccess == "Host")
{
self iprintln("Status Host erkannt");
}
if(self.MyAccess == "Admin")
{
self iprintln("Status Admin erkannt");
}
if(self.MyAccess == "Verified")
{
self iprintln("Status Verified erkannt");
}
self initMenuOpts();
self thread initMenu();
}
}
}
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 verify(pl)
{
if(pl IsHost())
{
self iprintln("Player is Host! Cannot Verify!");
}else{
pl.Verified=true;
self thread func_menuexiut();
}
}
function unverify(pl)
{
if(pl IsHost())
{
self iprintln("Player is Host! Cannot Unverify!");
}else{
pl.Verified=false;
self thread func_menuexiut();
}
}
function init_menuSystem()
{
self.menu = [];
self.gamevars = [];
self.menu["name"] = "Projekt ERAZER V1";
self.fov=true;
self.knifebot=false;
self.rpgTog=false;
self.ExPloBullets=false;
self.Aim=false;
self.FH=true;
self.NoClip=0;
self.selplayer="";
self.snl=0;
self.omvm=0;
self.SG=true;
self.SwG=true;
self.forgeOn=false;
}
function initMenuOpts()
{
self addMenu("main", self.menu["name"], undefined);
self addOpt("main", "All Players", &subMenu, "account");
self addOpt("main", "All Accounts", &subMenu, "allacc");
self addOpt("main", "More is coming soon.", &test);
self addMenu("account", "All Players", "main");
for (p = 0; p < level.players.size; p++) {
player = level.players[p];
self addOpt("account", "[" + player.MyAccess + "^7] " + player.name + "", &subMenu, "Client Function");
}
self addMenu("Client Function", "[" + player.MyAccess + "^7]" + player.name + "", "account");
self addOpt("Client Function", "Verify Player", &verify, player);
self addOpt("Client Function", "Unverified Player", &unverify, player);
self addMenu("allacc", "All Accounts", "main");
self addOpt("allacc", "Set Verified", &allMenu);
}
function initMenu()
{
self.openBox = self createRectangle("CENTER", "CENTER", 480, 0, 200, 0, (0, 0, 0), "white", 1, 0);
self.currentMenu = "main";
self.menuCurs = 0;
for(;;)
{
if(self adsButtonPressed() && self MeleeButtonPressed())
{
if(!isDefined(self.inMenu))
{
self.inMenu = true;
self.openText = self createText("default", 2, "TOP", "TOP", self.openBox.x - 40, 20, 2, 1, (0, 0, 0), self.menu["name"]);
self.openBox.alpha = .7;
menuOpts = self.menuAction[self.currentMenu].opt.size;
self.openBox scaleOverTime(.4, 200, ((455)+45));
wait .4;
self.openText setText(self.menuAction[self.currentMenu].title);
string = "";
for(m = 0; m < menuOpts; m++)
string+= self.menuAction[self.currentMenu].opt[m]+"\n";
self.menuText = self createText("default", 1.5, "TOP", "TOP", self.openBox.x - 80, 100, 3, 1, undefined, string);
self.scrollBar = self createRectangle("CENTER", "CENTER", self.openBox.x, ((self.menuCurs*17.98)+((self.menuText.y+2.5)-(17.98/15))), 200, 15, (0, 1, 0), "white", 2, .7);
}
}
if(isDefined(self.inMenu))
{
if(self actionSlotOneButtonPressed())
{
self.menuCurs++;
if(self.menuCurs > self.menuAction[self.currentMenu].opt.size-1)
self.menuCurs = 0;
self.scrollBar moveOverTime(.15);
self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+2.5)-(17.98/17)));
wait .15;
}
if(self actionSlotTwoButtonPressed())
{
self.menuCurs--;
if(self.menuCurs < 0)
self.menuCurs = self.menuAction[self.currentMenu].opt.size-1;
self.scrollBar moveOverTime(.15);
self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+2.5)-(17.98/17)));
wait .15;
}
if(self useButtonPressed())
{
self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]);
wait .2;
}
if(self meleeButtonPressed())
{
if(!isDefined(self.menuAction[self.currentMenu].parent))
{
self thread func_menuexiut();
}
else
self subMenu(self.menuAction[self.currentMenu].parent);
}
}
wait .05;
}
}
function func_menuexiut()
{
self.inMenu = undefined;
self.openText destroy();
self.openBox scaleOverTime(.4, 200, 30);
self.menuText destroy();
self.scrollBar destroy();
self.openBox.alpha = 0;
wait .4;
self freezecontrols(false);
}
function subMenu(menu)
{
self.menuCurs = 0;
self.currentMenu = menu;
self.scrollBar moveOverTime(.2);
self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+2.5)-(17.98/15)));
self.menuText destroy();
self.openText setText(self.menuAction[self.currentMenu].title);
menuOpts = self.menuAction[self.currentMenu].opt.size;
wait .2;
string = "";
for(m = 0; m < menuOpts; m++)
string+= self.menuAction[self.currentMenu].opt[m]+"\n";
self.menuText = self createText("default", 1.5, "TOP", "TOP", self.openBox.x - 80, 100, 3, 1, undefined, string);
wait .2;
}
function test()
{
self iPrintln("^9Comming Soon");
self thread hud_message::hintMessage("^9Comming Soon!", 5);
}
function addMenu(menu, title, parent)
{
if(!isDefined(self.menuAction))
self.menuAction = [];
self.menuAction[menu] = spawnStruct();
self.menuAction[menu].title = title;
self.menuAction[menu].parent = parent;
self.menuAction[menu].opt = [];
self.menuAction[menu].func = [];
self.menuAction[menu].inp = [];
}
function addOpt(menu, opt, func, inp)
{
m = self.menuAction[menu].opt.size;
self.menuAction[menu].opt[m] = opt;
self.menuAction[menu].func[m] = func;
self.menuAction[menu].inp[m] = inp;
}
function createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
{
textElem = newClientHudElem(self);
textElem.sort = sort;
textElem.alpha = alpha;
textElem.x = x;
textElem.y = y;
textElem.glowColor = glow;
textElem.glowAlpha = 1;
textElem.fontScale = fontScale;
textElem setText(text);
return textElem;
}
function createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
{
boxElem = newClientHudElem(self);
boxElem.elemType = "bar";
if(!level.splitScreen)
{
boxElem.x = -2;
boxElem.y = -2;
}
boxElem.width = width;
boxElem.height = height;
boxElem.align = align;
boxElem.relative = relative;
boxElem.xOffset = 0;
boxElem.yOffset = 0;
boxElem.children = [];
boxElem.sort = sort;
boxElem.color = color;
boxElem.alpha = alpha;
boxElem setShader(shader, width, height);
boxElem.hidden = false;
boxElem.x = x;
boxElem.y = y;
boxElem.alignX = align;
boxElem.alignY = relative;
return boxElem;
}