//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Bind a key to this function. It will bring up a clear tab menu with the title "Custom Menu Options". Add menu items to buildCustomMenu as needed
function CS::game::scoresOn()
{
remoteEval(2048, scoresOn);
schedule("buildCustomMenu();", 0.2);
}
//////////////////////////////////////////
function buildCustomMenu()
{
%curItem = 0;
CS::buildMenu("Config Options:", "Options");
CS::addMenuItem(%curItem++ @ "Pref 1 " @ $pref::One, "Pref1");
CS::addMenuItem(%curItem++ @ "Pref 2 " @ $pref::two, "Pref2");
// CS::addMenuItem(%curItem++ @ "new Menu plz?", "option3");
}
function CS::buildMenu(%title, %menuCode)
{
remoteNewMenu(2048, %title);
$menuCode = %menuCode;
}
function CS::addMenuItem(%title, %code)
{
addCMCommand(CurServerMenu, %title, CS::menuSelect, %code);
}
function CS::menuSelect(%code)
{
%evalString = "CS::processMenu" @ $menuCode @ "(\"" @ %code @ "\");";
eval(%evalString);
}
function CS::processMenuOptions(%code)
{
if(%code == "Pref1")
{
if(!$pref::One)
$pref::One="True";
else
$pref::One="False";
}
else if(%code == "Pref2")
{
if(!$pref::Two)
$pref::Two="True";
else
$pref::Two="False";
}
else if(%code == "option3")
{
echo("Option 3 was clicked - Building a new menu");
%curItem = 0;
CS::buildMenu("Custom Menu 2:", "Options2");
CS::addMenuItem(%curItem++ @ "This is menu2", "option1");
return; //When you build a new menu, don't forget the return statement or you'll end up calling remoteEval(2048, scoresOff); ;)
}
//don't remove this. It needs to be at the bottom of every new CS::processMenu that you use
remoteEval(2048, scoresOff);
}
function CS::processMenuOptions2(%code)
{
if(%code == "option1")
{
echo("Option 1 on menu2 clicked");
}
//Again, you need this at the bottom of ever "CS::processMenu" that you have
remoteEval(2048, scoresOff);
}
function CustomMenu::InitBinds() after GameBinds::Init {
$GameBinds::CurrentMapHandle = GameBinds::GetActionMap2( "playMap.sae" );
$GameBinds::CurrentMap = "playMap.sae";
GameBinds::addBindCommand( "Config Menu", "CS::game::scoresOn();" );
}