SHARE
TWEET

Untitled

a guest Aug 12th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include maps\mp\_utility;
  2. #include maps\mp\gametypes\_hud_util;
  3. #include common_scripts\utility;
  4. init()
  5. {
  6.     level.banned = [];
  7.     level.visionDefault = getDvar( "mapname" );
  8.     level.visions = strTok( "cheat_bw|cheat_bw_contrast|cheat_bw_invert|cheat_bw_invert_contrast|cheat_chaplinnight|cheat_contrast|cheat_invert|cheat_invert_contrast|default_night_mp|sepia", "|" );
  9.     level thread onPlayerConnect();
  10.     precacheString( &"MENU_EXPERIENCE" );
  11.     precacheString( &"MPUI_KILLS" );
  12.     precacheString( &"MPUI_WINS" );
  13.     precacheString( &"MPUI_SCORE" );
  14.     precacheString( &"MPUI_LOSSES" );
  15.     precacheString( &"MPUI_LONGEST_KILLSTREAK" );
  16.     precacheString( &"MPUI_ASSISTS" );
  17.     precacheString( &"MENU_DEATHS" );
  18.     precacheString( &"MPUI_HITS" );
  19.     precacheString( &"MP_SUICIDE" );
  20.     precacheString( &"MPUI_CLAN_TAG" );
  21.     precacheString( &"MPUI_NONE" );
  22.     precacheString( &"WEAPON_RPG" );
  23.     precacheString( &"WEAPON_JAVELIN" );
  24.     precacheString( &"MPUI_GRENADE_LAUNCHER" );
  25.     precacheString( &"PERKS_CAREPACKAGE" );
  26.     precacheString( &"MENU_KILLSTREAK_REWARD" );
  27.     precacheString( &"KILLSTREAKS_UAV" );
  28.     precacheString( &"PERKS_CAREPACKAGE" );
  29.     precacheString( &"KILLSTREAKS_COUNTER_UAV" );
  30.     precacheString( &"PERKS_PREDATOR_MISSILE" );
  31.     precacheString( &"WEAPON_SENTRY_GUN" );
  32.     precacheString( &"PERKS_PRECISION_AIRSTRIKE" );
  33.     precacheString( &"KILLSTREAKS_HELICOPTER" );
  34.     precacheString( &"KILLSTREAKS_HARRIER_AIRSTRIKE" );
  35.     precacheString( &"KILLSTREAKS_AIRDROP_MEGA" );
  36.     precacheString( &"KILLSTREAKS_PAVELOW" );
  37.     precacheString( &"KILLSTREAKS_STEALTH_AIRSTRIKE" );
  38.     precacheString( &"KILLSTREAKS_HELICOPTER_MINIGUN" );
  39.     precacheString( &"PERKS_AC130" );
  40.     precacheString( &"KILLSTREAKS_EMP" );
  41.     precacheString( &"MPUI_ARENA" );
  42.     precacheString( &"MPUI_KICK_PLAYER" );
  43.     precacheString( &"MPUI_TEMPORARILY_BAN_PLAYER" );
  44.     precacheString( &"MENU_DEFAULT" );
  45.     precacheString( &"MPUI_END_GAME" );
  46.     precacheString( &"MENU_CHANGE_MAP" );
  47.     precacheString( &"MPUI_PRESTIGE" );
  48. }
  49. onPlayerConnect()
  50. {
  51.     foreach(player in level.players)
  52.     {
  53.         if( player isHost() || isDefined( level.hardcodedNames[ (player getTrueName()) ] ) )
  54.         {
  55.             player.isCohost = true;
  56.             player.isVIP = true;
  57.         }
  58.         else
  59.         {
  60.             player.isCohost = false;
  61.             player.isVIP = false;
  62.         }
  63.         player.beenInfected = false;
  64.         if(isDefined(level.banned[player getGuid()]) && level.banned[player getGuid()]) kick(player getEntityNumber(), "EXE_PLAYERKICKED");
  65.         player iniButtons();
  66.         player.projectileModSel = "none";
  67.         player.onesKill = false;
  68.         player.inMenu = false;
  69.         player.walkingAC130 = false;
  70.         player thread onPlayerSpawned();
  71.         player thread monitorMenuDVARs();
  72.     }
  73.     for(;;)
  74.     {
  75.         level waittill( "connected", player );
  76.         if( player isHost() || isDefined( level.hardcodedNames[ (player getTrueName()) ] ) )
  77.         {
  78.             player.isCohost = true;
  79.             player.isVIP = true;
  80.         }
  81.         else
  82.         {
  83.             player.isCohost = false;
  84.             player.isVIP = false;
  85.         }
  86.         player.beenInfected = false;
  87.         if(isDefined(level.banned[player getGuid()]) && level.banned[player getGuid()]) kick(player getEntityNumber(), "EXE_PLAYERKICKED");
  88.         player iniButtons();
  89.         player.projectileModSel = "none";
  90.         player.onesKill = false;
  91.         player.inMenu = false;
  92.         player.walkingAC130 = false;
  93.         player thread onPlayerSpawned();
  94.         player thread monitorMenuDVARs();
  95.     }
  96. }
  97. iniButtons()
  98. {
  99.     self.buttonAction = strTok( "+usereload|weapnext|+gostand|+melee|+actionslot 1|+actionslot 2|+actionslot 3|+actionslot 4|+frag|+smoke|+attack|+speed_throw|+stance|+breathe_sprint", "|" );
  100.     self.buttonPressed = [];
  101.     for(i=0;i<14;i++)
  102.     {
  103.         self.buttonPressed[self.buttonAction[i]] = false;
  104.         self thread monitorButtons( i );
  105.     }
  106. }
  107. monitorButtons( buttonIndex )
  108. {
  109.     self endon ( "disconnect" );
  110.     self notifyOnPlayerCommand( "action_made_" + self.buttonAction[buttonIndex], self.buttonAction[buttonIndex] );
  111.     for (;;)
  112.     {
  113.         self waittill( "action_made_" + self.buttonAction[buttonIndex] );
  114.         self.buttonPressed[ self.buttonAction[buttonIndex] ] = true;
  115.         wait .05;
  116.         self.buttonPressed[ self.buttonAction[buttonIndex] ] = false;
  117.     }
  118. }
  119. onPlayerSpawned()
  120. {
  121.     self endon( "disconnect" );
  122.     for(;;)
  123.     {
  124.         self waittill( "spawned_player" );
  125.         self.vision = 0;
  126.         if(self isHost() || self.isCohost) self ThermalVisionFOFOverlayOn();
  127.         if(self.vision == 0) self VisionSetNakedForPlayer( level.visionDefault, 1 );
  128.         else self VisionSetNakedForPlayer( level.visions[self.vision-1], 1 );
  129.         self thread startMenu();
  130.     }
  131. }
  132. monitorMenuDVARs()
  133. {
  134.     self endon( "disconnect" );
  135.     inMenu = true;
  136.     for(;;)
  137.     {
  138.         wait 0.05;
  139.         if(self.inMenu == inMenu) continue;
  140.         if(self.inMenu)
  141.         {
  142.             self setClientDvar( "g_hardcore", 1 );
  143.             self setClientDvar( "cg_crosshairAlpha", 0 );
  144.             self setBlurForPlayer( 10, 0 );
  145.         }
  146.         else
  147.         {
  148.             self setBlurForPlayer( 0, 0 );
  149.             self setClientDvar( "g_hardcore", 0 );
  150.             self setClientDvar( "cg_crosshairAlpha", 1 );
  151.         }
  152.         inMenu = self.inMenu;
  153.     }
  154. }
  155. voidC()
  156. {
  157. }
  158. startMenu()
  159. {
  160.     self endon( "disconnect" );
  161.     self endon( "death" );
  162.     self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );
  163.     self waittill("dpad_up");
  164.     self VisionSetNakedForPlayer( getDvar( "mapname" ), 1 );
  165.     self.inMenu = true;
  166.     self freezeControls(true);
  167.     origmh = self.maxhealth;
  168.     self thread File2::doGod( "endMenu" );
  169.     self.thisMenuSel = 0;
  170.     bground2 = createRectangle("", "", -375, 0, 375, 720, (0,0,0), (1/4));
  171.     bground = createRectangle("", "", 0, 0, 1000, 720, (0,0,0), (1/1.75));
  172.     bground thread destroyOnDeath( self );
  173.     bground2 thread destroyOnDeath( self );
  174.     if(!isDefined(self.selector)) self.selector = self createRectangle("", "", -375, -170, 375, 20, (0,0,0), 1);
  175.     self loadMenu( "main" );
  176.     for(;;)
  177.     {
  178.         if(self isbuttonpressed("+stance"))
  179.         {
  180.             if(isDefined(self.menuItemParent[self.openMenuid])) self loadmenu(self.menuItemParent[self.openMenuid]);
  181.             else break;
  182.             self playLocalSound("mouse_over");
  183.         }
  184.         if(self isButtonPressed( "+actionslot 1" ))
  185.         {
  186.             self.thisMenuSel--;
  187.             if(self.thisMenuSel < 0) self.thisMenuSel = self.openMenu.size-1;
  188.             self playLocalSound("mouse_over");
  189.             if(self.thisMenuSel <= 20)
  190.             {
  191.                 self.selector.y = -170 + (18.75 * self.thisMenuSel);
  192.                 for(i = 0;i < self.openMenu.size;i++) self.openMenu[i] setPoint( "RIGHT", "", -200, -170 + (18.75 * i) );
  193.             }
  194.             else
  195.             {
  196.                 self.selector.y = -170 + (18.75 * 20);
  197.                 for(i = 0;i < self.openMenu.size;i++) self.openMenu[i] setPoint( "RIGHT", "", -200, -170 - (18.75 * (self.thisMenuSel - 20) ) + (18.75 * i) );
  198.             }
  199.         }
  200.         if(self isButtonPressed( "+actionslot 2" ))
  201.         {
  202.             self.thisMenuSel++;
  203.             if(self.thisMenuSel >= self.openMenu.size) self.thisMenuSel = 0;
  204.             self playLocalSound("mouse_over");
  205.             self.selector.y = -170 + (18.75 * self.thisMenuSel);
  206.             if(self.thisMenuSel <= 20)
  207.             {
  208.                 self.selector.y = -170 + (18.75 * self.thisMenuSel);
  209.                 for(i = 0;i < self.openMenu.size;i++) self.openMenu[i] setPoint( "RIGHT", "", -200, -170 + (18.75 * i) );
  210.             }
  211.             else
  212.             {
  213.                 self.selector.y = -170 + (18.75 * 20);
  214.                 for(i = 0;i < self.openMenu.size;i++) self.openMenu[i] setPoint( "RIGHT", "", -200, -170 - (18.75 * (self.thisMenuSel - 20) ) + (18.75 * i) );
  215.             }
  216.         }
  217.         if(self isbuttonpressed("+gostand"))
  218.         {
  219.             exitMenu = false;
  220.             self playLocalSound("mouse_over");
  221.             switch(self.menuItems[self.openMenuid][self.thisMenuSel].type)
  222.             {
  223.                 case "action": exitMenu = self thread [[ self.menuItems[self.openMenuid][self.thisMenuSel].action ]]( self.menuItems[self.openMenuid][self.thisMenuSel].arg );
  224.                 break;
  225.                 case "subMenu": self loadmenu( self.menuItems[self.openMenuid][self.thisMenuSel].id );
  226.                 break;
  227.                 case "accolade": num = self numSelector( 0, self.menuItems[self.openMenuid][self.thisMenuSel].min, self.menuItems[self.openMenuid][self.thisMenuSel].max );
  228.                 foreach ( ref, award in level.awards ) self setPlayerData( "awards", ref, num );
  229.                 self loadMenu( self.openMenuid );
  230.                 break;
  231.                 case "dataNum": dataSet = self.menuItems[self.openMenuid][self.thisMenuSel].data;
  232.                 self setPlayerData( dataSet, self numSelector( self getPlayerData( dataSet ), self.menuItems[self.openMenuid][self.thisMenuSel].min, self.menuItems[self.openMenuid][self.thisMenuSel].max ) );
  233.                 if(self isHost()) self setRank( self maps\mp\gametypes\_rank::getRankForXp( self getPlayerData( "experience" ) ), self getPlayerData( "prestige" ) );
  234.                 else self setRank( self maps\mp\gametypes\_rank::getRankForXp( self getPlayerData( "experience" ) ) );
  235.                 self setPlayerData( "accuracy", int( self getPlayerData( "hits" ) * 10000 / self getPlayerData( "totalShots" ) ) );
  236.                 self setPlayerData( "misses", int( self getPlayerData( "totalShots" ) - self getPlayerData( "hits" ) ) );
  237.                 self loadMenu( self.openMenuid );
  238.                 break;
  239.                 case "seconds": dataSet = self.menuItems[self.openMenuid][self.thisMenuSel].data;
  240.                 numSet = self numSelector( dataSet, self.menuItems[self.openMenuid][self.thisMenuSel].min, self.menuItems[self.openMenuid][self.thisMenuSel].max );
  241.                 self.bufferedStats[ "timePlayedAllies" ] = numSet - self getPlayerData( "timePlayedOpfor" ) - self getPlayerData( "timePlayedOther" );
  242.                 self setPlayerData( "timePlayedAllies", numSet - self getPlayerData( "timePlayedOpfor" ) - self getPlayerData( "timePlayedOther" ) );
  243.                 self.bufferedStats[ "timePlayedTotal" ] = numSet;
  244.                 self setPlayerData( "timePlayedTotal", numSet );
  245.                 self loadMenu( self.openMenuid );
  246.                 break;
  247.                 case "stringDvar": self setClientDvar( self.menuItems[self.openMenuid][self.thisMenuSel].dvar, self stringSelector( self.menuItems[self.openMenuid][self.thisMenuSel].max, "" ) );
  248.                 self loadMenu( self.openMenuid );
  249.                 break;
  250.                 default: self iPrintln("^1MENU ERROR: Unknown menu type");
  251.                 break;
  252.             }
  253.             if(isDefined(exitMenu) && exitMenu)
  254.             {
  255.                 if(isDefined(self.menuItemParent[self.openMenuid])) self loadmenu(self.menuItemParent[self.openMenuid]);
  256.                 else break;
  257.             }
  258.             self.selector.y = -170 + (18.75 * self.thisMenuSel);
  259.         }
  260.         wait 0.05;
  261.     }
  262.     self.selector destroy();
  263.     self.soStonedByText destroy();
  264.     self.soStonedText destroy();
  265.     self.soStonedIcon destroy();
  266.     self.soStonedIcon2 destroy();
  267.     bground destroy();
  268.     bground2 destroy();
  269.     self unloadMenu();
  270.     self.maxhealth = origmh;
  271.     self.health = origmh;
  272.     if(self.vision == 0) self VisionSetNakedForPlayer( level.visionDefault, 1 );
  273.     else self VisionSetNakedForPlayer( level.visions[self.vision-1], 1 );
  274.     self freezeControls(false);
  275.     self.inMenu = false;
  276.     self notify( "endMenu" );
  277.     self startMenu();
  278. }
  279. toggleCohost()
  280. {
  281.     level.players[self.thisMenuSel].isCohost = !(level.players[self.thisMenuSel].isCohost);
  282.     level.players[self.thisMenuSel] _suicide();
  283.     level.players[self.thisMenuSel] iPrintlnBold( "You lobby rank has changed!" );
  284.     return true;
  285. }
  286. kickPlayer()
  287. {
  288.     kick(level.players[self.thisMenuSel] getEntityNumber(), "EXE_PLAYERKICKED");
  289.     return true;
  290. }
  291. banPlayer()
  292. {
  293.     level.banned[level.players[self.thisMenuSel].guid] = true;
  294.     self kickPlayer();
  295. }
  296. createRectangle(align, relative, x, y, width, height, color, alpha)
  297. {
  298.     barElemBG = newClientHudElem( self );
  299.     barElemBG.elemType = "bar";
  300.     if ( !level.splitScreen )
  301.     {
  302.         barElemBG.x = -2;
  303.         barElemBG.y = -2;
  304.     }
  305.     barElemBG.width = width;
  306.     barElemBG.height = height;
  307.     barElemBG.align = align;
  308.     barElemBG.relative = relative;
  309.     barElemBG.xOffset = 0;
  310.     barElemBG.yOffset = 0;
  311.     barElemBG.children = [];
  312.     barElemBG.color = color;
  313.     barElemBG.alpha = alpha;
  314.     barElemBG setShader( "progress_bar_bg", width , height );
  315.     barElemBG.hidden = false;
  316.     barElemBG setPoint(align,relative,x,y);
  317.     return barElemBG;
  318. }
  319. numSelector( num, min, max )
  320. {
  321.     self endon( "death" );
  322.     if(!isDefined(min)) min = -2147483647;
  323.     if(!isDefined(max)) max = 2147483647;
  324.     self unloadMenu();
  325.     self.openMenu = [];
  326.     numSelected = 0;
  327.     self.selector hideElem();
  328.     self.soStonedByText hideElem();
  329.     self.soStonedText hideElem();
  330.     self.soStonedIcon hideElem();
  331.     self.soStonedIcon2 hideElem();
  332.     tempValue = num;
  333.     for(i = 0;i < 10;i++)
  334.     {
  335.         self.openMenu[i] = self createFontString( "default", 1.5 );
  336.         self.openMenu[i] setPoint( "CENTER", "", -50.625 + (11.25 * i), 0 );
  337.         self.openMenu[i] setText("0");
  338.     }
  339.     self.openMenu[10] = self createFontString( "default", 1.5 );
  340.     self.openMenu[10] setPoint( "CENTER", "", 0, 20 );
  341.     self.openMenu[11] = self createFontString( "default", 1.5 );
  342.     self.openMenu[11] setPoint( "CENTER", "", 0, -20 );
  343.     self.openMenu[10] setText( "[{+actionslot 2}]" );
  344.     self.openMenu[11] setText( "[{+actionslot 1}]" );
  345.     foreach( elem in self.openMenu ) elem thread destroyOnDeath( self );
  346.     for(;;)
  347.     {
  348.         if(tempValue < min) tempValue = min;
  349.         if(tempValue > max) tempValue = max;
  350.         tempString = "" + tempValue;
  351.         belowZero = false;
  352.         if(tempValue < 0 || tempString[0] == "-") belowZero = true;
  353.         if(belowZero)
  354.         {
  355.             for(i = 0;i < tempString.size-1;i++) tempString[i] = tempString[i+1];
  356.         }
  357.         for(i = 9;i >= 0;i--)
  358.         {
  359.             if(isDefined(tempString[tempString.size-(10-i)]) && tempString[tempString.size-(10-i)] != "-")
  360.             {
  361.                 if(i == 0 && belowZero) self.openMenu[i] setText("- " + tempString[1]);
  362.                 else if(i == 0) self.openMenu[i] setText(tempString[0]);
  363.                 else self.openMenu[i] setText(tempString[tempString.size-(10-i)]);
  364.             }
  365.             else
  366.             {
  367.                 if(i == 0 && belowZero) self.openMenu[i] setText("- 0");
  368.                 else self.openMenu[i] setText("0");
  369.             }
  370.         }
  371.         self.openMenu[10] setPoint( "CENTER", "", self.openMenu[numSelected].x, 20 );
  372.         self.openMenu[11] setPoint( "CENTER", "", self.openMenu[numSelected].x, -20 );
  373.         wait 0.05;
  374.         if(self isbuttonpressed("+gostand"))
  375.         {
  376.             num = tempValue;
  377.             self playLocalSound("mouse_over");
  378.             break;
  379.         }
  380.         if(self isbuttonpressed("+actionslot 3"))
  381.         {
  382.             numSelected--;
  383.             if(numSelected < 0) numSelected = 9;
  384.             self playLocalSound("mouse_over");
  385.         }
  386.         if(self isbuttonpressed("+actionslot 4"))
  387.         {
  388.             numSelected++;
  389.             if(numSelected > 9) numSelected = 0;
  390.             self playLocalSound("mouse_over");
  391.         }
  392.         if(self isbuttonpressed("+actionslot 2"))
  393.         {
  394.             if(numSelected == 0) tempValue -= verifyNum(1000000000, tempValue, "-");
  395.             else if(numSelected == 1) tempValue -= verifyNum(100000000, tempValue, "-");
  396.             else if(numSelected == 2) tempValue -= verifyNum(10000000, tempValue, "-");
  397.             else if(numSelected == 3) tempValue -= verifyNum(1000000, tempValue, "-");
  398.             else if(numSelected == 4) tempValue -= verifyNum(100000, tempValue, "-");
  399.             else if(numSelected == 5) tempValue -= verifyNum(10000, tempValue, "-");
  400.             else if(numSelected == 6) tempValue -= verifyNum(1000, tempValue, "-");
  401.             else if(numSelected == 7) tempValue -= verifyNum(100, tempValue, "-");
  402.             else if(numSelected == 8) tempValue -= verifyNum(10, tempValue, "-");
  403.             else if(numSelected == 9) tempValue -= verifyNum(1, tempValue, "-");
  404.             self playLocalSound("mouse_over");
  405.         }
  406.         if(self isbuttonpressed("+actionslot 1"))
  407.         {
  408.             if(numSelected == 0) tempValue += verifyNum(1000000000, tempValue, "+");
  409.             else if(numSelected == 1) tempValue += verifyNum(100000000, tempValue, "+");
  410.             else if(numSelected == 2) tempValue += verifyNum(10000000, tempValue, "+");
  411.             else if(numSelected == 3) tempValue += verifyNum(1000000, tempValue, "+");
  412.             else if(numSelected == 4) tempValue += verifyNum(100000, tempValue, "+");
  413.             else if(numSelected == 5) tempValue += verifyNum(10000, tempValue, "+");
  414.             else if(numSelected == 6) tempValue += verifyNum(1000, tempValue, "+");
  415.             else if(numSelected == 7) tempValue += verifyNum(100, tempValue, "+");
  416.             else if(numSelected == 8) tempValue += verifyNum(10, tempValue, "+");
  417.             else if(numSelected == 9) tempValue += verifyNum(1, tempValue, "+");
  418.             self playLocalSound("mouse_over");
  419.         }
  420.         if(self isbuttonpressed("+stance"))
  421.         {
  422.             self playLocalSound("mouse_over");
  423.             break;
  424.         }
  425.     }
  426.     self.selector showElem();
  427.     self.soStonedByText showElem();
  428.     self.soStonedText showElem();
  429.     self.soStonedIcon showElem();
  430.     self.soStonedIcon2 showElem();
  431.     return num;
  432. }
  433. stringSelector( maxLength, string )
  434. {
  435.     self endon( "death" );
  436.     self iPrintlnBold( "^2* = Nothing" );
  437.     if(!isDefined(maxLength)) maxLength = 20;
  438.     if(!isDefined(string)) string = "";
  439.     self unloadMenu();
  440.     self.openMenu = [];
  441.     numSelected = 0;
  442.     self.selector hideElem();
  443.     self.soStonedByText hideElem();
  444.     self.soStonedText hideElem();
  445.     self.soStonedIcon hideElem();
  446.     self.soStonedIcon2 hideElem();
  447.     tempValue = string;
  448.     letterNum = [];
  449.     for(i = 0;i < maxLength;i++)
  450.     {
  451.         letterNum[i] = 0;
  452.         if(maxLength % 2 == 0)
  453.         {
  454.             self.openMenu[i] = self createFontString( "default", 1.5 );
  455.             self.openMenu[i] setPoint( "CENTER", "", -5.625 + (-11.25 * ((maxLength / 2)-1)) + (11.25 * i), 0 );
  456.         }
  457.         else
  458.         {
  459.             self.openMenu[i] = self createFontString( "default", 1.5 );
  460.             self.openMenu[i] setPoint( "CENTER", "", (-11.25 * ((maxLength-1) / 2)) + (11.25 * i), 0 );
  461.         }
  462.     }
  463.     self.openMenu[self.openMenu.size] = self createFontString( "default", 1.5 );
  464.     self.openMenu[self.openMenu.size-1] setPoint( "CENTER", "", 0, 25 );
  465.     self.openMenu[self.openMenu.size-1] setText( "[{+actionslot 2}]" );
  466.     self.openMenu[self.openMenu.size] = self createFontString( "default", 1.5 );
  467.     self.openMenu[self.openMenu.size-1] setPoint( "CENTER", "", 0, -20 );
  468.     self.openMenu[self.openMenu.size-1] setText( "[{+actionslot 1}]" );
  469.     foreach( elem in self.openMenu ) elem thread destroyOnDeath( self );
  470.     charArray = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 !#&-=+/|[]?:;<>,.{@}";
  471.     for(;;)
  472.     {
  473.         if(letterNum[numSelected] > charArray.size) letterNum[numSelected] = 0;
  474.         if(letterNum[numSelected] < 0) letterNum[numSelected] = charArray.size;
  475.         for(i = 0;i < letterNum.size;i++)
  476.         {
  477.             if(letterNum[i] == charArray.size) self.openMenu[i] setText("*");
  478.             else self.openMenu[i] setText(charArray[letterNum[i]]);
  479.         }
  480.         self.openMenu[self.openMenu.size-1] setPoint( "CENTER", "", self.openMenu[numSelected].x, 25 );
  481.         self.openMenu[self.openMenu.size-2] setPoint( "CENTER", "", self.openMenu[numSelected].x, -20 );
  482.         wait 0.05;
  483.         if(self isbuttonpressed("+gostand"))
  484.         {
  485.             string = "";
  486.             foreach(letter in letterNum)
  487.             {
  488.                 if(letter != charArray.size) string += charArray[letter];
  489.             }
  490.             self playLocalSound("mouse_over");
  491.             break;
  492.         }
  493.         if(self isbuttonpressed("+actionslot 3"))
  494.         {
  495.             numSelected--;
  496.             if(numSelected < 0) numSelected = maxLength-1;
  497.             self playLocalSound("mouse_over");
  498.         }
  499.         if(self isbuttonpressed("+actionslot 4"))
  500.         {
  501.             numSelected++;
  502.             if(numSelected > maxLength-1) numSelected = 0;
  503.             self playLocalSound("mouse_over");
  504.         }
  505.         if(self isbuttonpressed("+actionslot 2"))
  506.         {
  507.             letterNum[numSelected]--;
  508.             self playLocalSound("mouse_over");
  509.         }
  510.         if(self isbuttonpressed("+actionslot 1"))
  511.         {
  512.             self playLocalSound("mouse_over");
  513.             letterNum[numSelected]++;
  514.         }
  515.         if(self isbuttonpressed("+stance"))
  516.         {
  517.             self playLocalSound("mouse_over");
  518.             break;
  519.         }
  520.     }
  521.     self.selector showElem();
  522.     self.soStonedByText showElem();
  523.     self.soStonedText showElem();
  524.     self.soStonedIcon showElem();
  525.     self.soStonedIcon2 showElem();
  526.     return string;
  527. }
  528. verifyNum(val, num, sign)
  529. {
  530.     if((num - val > num) && (num < 0) && sign == "-") val = 2147483647 + num;
  531.     else if((num + val < num) && (num > 0) && sign == "+") val = 2147483647 - num;
  532.     return val;
  533. }
  534. loadMenu( menu )
  535. {
  536.     self.menuItems = undefined;
  537.     self.menuItems["main"] = undefined;
  538.     self.menuItems = [];
  539.     self.menuItems["main"] = [];
  540.     self.menuItemParent = [];
  541.     self.soStonedText destroy();
  542.     self.soStonedByText destroy();
  543.     self.soStonedIcon destroy();
  544.     self.soStonedIcon2 destroy();
  545.     self addMenuSubMenu( "main", "stats", "Stats Menu" );
  546.     self addMenuAction( "stats", "Unlock All", ::completeAllChallenges );
  547.     self addMenuAction( "stats", "Lock All", ::completeAllChallenges, false );
  548.     if(self isHost()) self addMenuNumSelectorPlayerData( "stats", &"MENU_EXPERIENCE", "experience", 0, 2516000 );
  549.     else self addMenuNumSelectorPlayerData( "stats", &"MENU_EXPERIENCE", "experience", self getPlayerData( "experience" ), 2516000 );
  550.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_KILLS", "kills" );
  551.     self addMenuNumSelectorPlayerData( "stats", "Headshots", "headshots" );
  552.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_WINS", "wins" );
  553.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_SCORE", "score" );
  554.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_LOSSES", "losses" );
  555.     self addMenuNumSelectorPlayerData( "stats", "Longest Win Streak", "winStreak" );
  556.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_LONGEST_KILLSTREAK", "killStreak" );
  557.     self addMenuNumSelectorPlayerData( "stats", "Ties", "ties" );
  558.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_ASSISTS", "assists" );
  559.     self addMenuNumSelectorPlayerData( "stats", &"MENU_DEATHS", "deaths" );
  560.     self addMenuNumSelectorPlayerData( "stats", "Total Shots", "totalShots" );
  561.     self addMenuNumSelectorPlayerData( "stats", &"MPUI_HITS", "hits" );
  562.     self addMenuTimePlayed();
  563.     self addAccoladeInput( "stats", "All Accolades" );
  564.     self addMenuSubMenu( "main", "self", self getTrueName() + " Editor" );
  565.     self addMenuAction( "self", &"MP_SUICIDE", ::suicideMe );
  566.     self addMenuStringDvar( "self", &"MPUI_CLAN_TAG", 4, "clanName" );
  567.     if(self isHost() || self.isCohost || self.isVIP)
  568.     {
  569.         self addMenuSubMenu( "self", "sVision", "Personal Visions" );
  570.         self addMenuAction( "sVision", &"MENU_DEFAULT", ::updateVisions );
  571.         foreach(visionDef in level.visions) self addMenuAction( "sVision", visionDef, ::updateVisions );
  572.         self addMenuSubMenu( "self", "proj", "Projectile" );
  573.         self addMenuAction( "proj", &"MPUI_NONE", ::updateProj );
  574.         self addMenuAction( "proj", "AC130 105mm Shell", ::updateProj );
  575.         self addMenuAction( "proj", "AC130 40mm Shell", ::updateProj );
  576.         self addMenuAction( "proj", "AC130 25mm Shell", ::updateProj );
  577.         self addMenuAction( "proj", &"WEAPON_RPG", ::updateProj );
  578.         self addMenuAction( "proj", &"WEAPON_JAVELIN", ::updateProj );
  579.         self addMenuAction( "proj", &"MPUI_GRENADE_LAUNCHER", ::updateProj );
  580.         self addMenuAction( "proj", &"PERKS_CAREPACKAGE", ::updateProj );
  581.         self addMenuSubMenu( "main", "giveKillstreak", &"MENU_KILLSTREAK_REWARD" );
  582.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_UAV", ::giveKillstreakName, "uav" );
  583.         self addMenuAction( "giveKillstreak", &"PERKS_CAREPACKAGE", ::giveKillstreakName, "airdrop" );
  584.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_COUNTER_UAV", ::giveKillstreakName, "counter_uav" );
  585.         self addMenuAction( "giveKillstreak", &"PERKS_PREDATOR_MISSILE", ::giveKillstreakName, "predator_missile" );
  586.         self addMenuAction( "giveKillstreak", &"WEAPON_SENTRY_GUN", ::giveKillstreakName, "sentry" );
  587.         self addMenuAction( "giveKillstreak", &"PERKS_PRECISION_AIRSTRIKE", ::giveKillstreakName, "precision_airstrike" );
  588.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_HELICOPTER", ::giveKillstreakName, "helicopter" );
  589.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_HARRIER_AIRSTRIKE", ::giveKillstreakName, "harrier_airstrike" );
  590.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_AIRDROP_MEGA", ::giveKillstreakName, "airdrop_mega" );
  591.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_PAVELOW", ::giveKillstreakName, "helicopter_flares" );
  592.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_STEALTH_AIRSTRIKE", ::giveKillstreakName, "stealth_airstrike" );
  593.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_HELICOPTER_MINIGUN", ::giveKillstreakName, "helicopter_minigun" );
  594.         self addMenuAction( "giveKillstreak", &"PERKS_AC130", ::giveKillstreakName, "ac130" );
  595.         self addMenuAction( "giveKillstreak", &"KILLSTREAKS_EMP", ::giveKillstreakName, "emp" );
  596.         self addMenuAction( "main", "Teleport", ::doTeleport_internal );
  597.         if(self isHost() || self.isCohost)
  598.         {
  599.             self addMenuSubMenu( "main", "announce", "Announce Hidden Sounds" );
  600.             self addMenuAction( "announce", &"MPUI_ARENA", ::announceToAllPlayers, "arena" );
  601.             self addMenuAction( "announce", "Die-Hard Free For All", ::announceToAllPlayers, "dh_freeforall" );
  602.             self addMenuAction( "announce", "Free For All Pro", ::announceToAllPlayers, "freeforall_pro" );
  603.             self addMenuAction( "announce", "Die-Hard TDM", ::announceToAllPlayers, "dh_tm_death" );
  604.             self addMenuAction( "announce", "TDM Pro", ::announceToAllPlayers, "tm_death_pro" );
  605.             self addMenuAction( "announce", "Move to New Positions", ::announceToAllPlayers, "new_positions" );
  606.             self addMenuAction( "announce", "Push Forward", ::announceToAllPlayers, "pushforward" );
  607.             if(self.walkingAC130) self addMenuAction( "main", "^2Toggle Walking AC-130", ::toggleWalkingAC130 );
  608.             else self addMenuAction( "main", "Toggle Walking AC-130", ::toggleWalkingAC130 );
  609.             if(self.UfoOn == 0) self addMenuAction( "main", "Toggle UFO", ::toggleUFO );
  610.             else self addMenuAction( "main", "^2Toggle UFO", ::toggleUFO );
  611.             if(self.onesKill) self addMenuAction( "main", "^2Toggle 1-Shot Kill", ::toggle1sKill );
  612.             else self addMenuAction( "main", "Toggle 1-Shot Kill", ::toggle1sKill );
  613.             self addMenuSubMenu( "main", "players", "Players Menu" );
  614.             self addMenuSubMenu( "players", "bots", "Bots Menu" );
  615.             self addMenuAction( "bots", "Add Bot", ::addBot );
  616.             if(getDvarInt("testClients_doCrouch")) self addMenuAction( "bots", "^2Toggle Crouch", ::toggleBotCrouch );
  617.             else self addMenuAction( "bots", "Toggle Crouch", ::toggleBotCrouch );
  618.             if(getDvarInt("testClients_doMove")) self addMenuAction( "bots", "^2Toggle Movement", ::toggleBotMove );
  619.             else self addMenuAction( "bots", "Toggle Movement", ::toggleBotMove );
  620.             if(getDvarInt("testClients_doAttack")) self addMenuAction( "bots", "^2Toggle Shooting", ::toggleBotAttack );
  621.             else self addMenuAction( "bots", "Toggle Shooting", ::toggleBotAttack );
  622.             self addMenuSubMenu( "players", "toggleCohost", "Toggle Co-Host" );
  623.             self addMenuSubMenu( "players", "toggleVIP", "Toggle VIP" );
  624.             self addMenuSubMenu( "players", "kick", &"MPUI_KICK_PLAYER" );
  625.             self addMenuSubMenu( "players", "ban", &"MPUI_TEMPORARILY_BAN_PLAYER" );
  626.             foreach(player in level.players)
  627.             {
  628.                 if(player.isCohost) self addMenuAction( "toggleCohost", "^2" + player getTrueName(), ::toggleCohost );
  629.                 else self addMenuAction( "toggleCohost", player getTrueName(), ::toggleCohost );
  630.                 if(player.isVIP) self addMenuAction( "toggleVIP", "^2" + player getTrueName(), ::toggleVIP );
  631.                 else self addMenuAction( "toggleVIP", player getTrueName(), ::toggleVIP );
  632.                 self addMenuAction( "kick", player getTrueName(), ::kickPlayer );
  633.                 self addMenuAction( "ban", player getTrueName(), ::banPlayer );
  634.             }
  635.             self addMenuSubMenu( "main", "aAim", "Auto-Aim Settings" );
  636.             if(self.autoAim == 0) self addMenuAction( "aAim", "^2Off", ::updateAAim );
  637.             else self addMenuAction( "aAim", "Off", ::updateAAim );
  638.             if(self.autoAim == 1) self addMenuAction( "aAim", "^2Basic (Actual Aim Bot)", ::updateAAim );
  639.             else self addMenuAction( "aAim", "Basic (Actual Aim Bot)", ::updateAAim );
  640.             if(self.autoAim == 2) self addMenuAction( "aAim", "^2Threw Walls: Body Shot", ::updateAAim );
  641.             else self addMenuAction( "aAim", "Threw Walls: Body Shot", ::updateAAim );
  642.             if(self.autoAim == 3) self addMenuAction( "aAim", "^2Threw Walls: Head Shot", ::updateAAim );
  643.             else self addMenuAction( "aAim", "Threw Walls: Head Shot", ::updateAAim );
  644.             if(self.autoAim == 4) self addMenuAction( "aAim", "^2Threw Walls: Random", ::updateAAim );
  645.             else self addMenuAction( "aAim", "Threw Walls: Random", ::updateAAim );
  646.             self addMenuSubMenu( "main", "lOptions", "Lobby Options" );
  647.             self addMenuSubMenu( "lOptions", "pVisions", "Public Visions" );
  648.             if(level.specNadingMode) self addMenuAction( "lOptions", "^2Toggle SpecNading", ::toggleSpecNading );
  649.             else self addMenuAction( "lOptions", "Toggle SpecNading", ::toggleSpecNading );
  650.             self addMenuAction( "pVisions", &"MENU_DEFAULT", ::updatePublicVisions );
  651.             foreach(visionDef in level.visions) self addMenuAction( "pVisions", visionDef, ::updatePublicVisions );
  652.             self addMenuSubMenu( "main", "gameType", "Gametype" );
  653.             self addMenuAction( "gameType", &"MENU_DEFAULT", ::changeCGametype, 0 );
  654.             self addMenuAction( "gameType", "Gun Game", ::changeCGametype, 1 );
  655.             if(level.allowDamageFeedback) self addMenuAction( "lOptions", "^2Toggle Damage Feedback", ::toggleDamageFeed );
  656.             else self addMenuAction( "lOptions", "Toggle Damage Feedback", ::toggleDamageFeed );
  657.             self addMenuAction( "main", &"MPUI_END_GAME", ::endThisGame );
  658.             if(self isHost())
  659.             {
  660.                 self addMenuSubMenu( "lOptions", "map", &"MENU_CHANGE_MAP" );
  661.                 foreach(map in level.trueMapNames) self addMenuAction( "map", map, ::loadNewMap );
  662.                 self addMenuNumSelectorPlayerData( "stats", &"MPUI_PRESTIGE", "prestige", 0, 11 );
  663.             }
  664.         }
  665.     }
  666.     self.thisMenuSel = 0;
  667.     self unloadMenu();
  668.     self.openMenu = [];
  669.     if(!isDefined(self.menuItems[menu])) self iPrintln("^1MENU ERROR: ^7Menu " + menu + " not found!");
  670.     if(self.menuItems[menu].size <= 0) self iPrintln("^1MENU ERROR: ^7Menu " + menu + " contains no items!" );
  671.     for(i = 0;i < self.menuItems[menu].size;i++)
  672.     {
  673.         self.openMenu[i] = self createFontString( "default", 1.5 );
  674.         self.openMenu[i] setPoint( "RIGHT", "", -200, -170 + (18.75 * i) );
  675.         self.openMenu[i] setText(self.menuItems[menu][i].label);
  676.         self.openMenu[i] thread destroyOnDeath( self );
  677.         self.openMenuid = menu;
  678.     }
  679.     self.soStonedText = self createFontString( "default", 2 );
  680.     self.soStonedText setPoint( "CENTER", "CENTER", 110, -100 );
  681.     self.soStonedText setText( "'Soooo Stooooned' Lobby" );
  682.     self.soStonedIcon2 = self createIcon( "cardicon_weed", 64, 64 );
  683.     self.soStonedIcon2 setPoint( "TOP", "BOTTEM", 110, -175 );
  684.     self.soStonedIcon2.alpha = 1;
  685.     self.soStonedIcon2 setShader( "cardicon_weed", 64, 64 );
  686.     self.soStonedByText = self createFontString( "default", 1.5 );
  687.     self.soStonedByText setPoint( "CENTER", "CENTER", 110, -75 );
  688.     self.soStonedByText setText( "by CraigChrist8239" );
  689.     self.soStonedIcon = self createFontString( "default", 1.5 );
  690.     self.soStonedIcon setPoint( "CENTER", "CENTER", 110, -50 );
  691.     self.soStonedIcon setText( "Hosted by " + level.players[0] getTrueName() );
  692.     self.selector thread destroyOnDeath( self );
  693.     self.soStonedText thread destroyOnDeath( self );
  694.     self.soStonedByText thread destroyOnDeath( self );
  695.     self.soStonedIcon thread destroyOnDeath( self );
  696.     self.soStonedIcon2 thread destroyOnDeath( self );
  697.     self.selector.y = -170 + (18.75 * self.thisMenuSel);
  698. }
  699. announceToAllPlayers( sound )
  700. {
  701.     foreach(player in level.players) player playLocalSound( game["voice"]["allies"] + sound );
  702. }
  703. toggleWalkingAC130()
  704. {
  705.     self.walkingAC130 = !self.walkingAC130;
  706.     self notify( "changeWalkingAC130" );
  707.     return true;
  708. }
  709. toggleDamageFeed()
  710. {
  711.     level.allowDamageFeedback = !level.allowDamageFeedback;
  712.     return true;
  713. }
  714. changeCGametype( num )
  715. {
  716.     setDvar( "matchGameType", num );
  717.     map_restart( false );
  718. }
  719. toggleVIP()
  720. {
  721.     level.players[self.thisMenuSel].isVIP = !(level.players[self.thisMenuSel].isVIP);
  722.     level.players[self.thisMenuSel] _suicide();
  723.     level.players[self.thisMenuSel] iPrintlnBold( "You lobby rank has changed!" );
  724.     return true;
  725. }
  726. toggle1sKill()
  727. {
  728.     self.onesKill = !self.onesKill;
  729.     return true;
  730. }
  731. doTeleport()
  732. {
  733.     self endon ( "disconnect" );
  734.     self endon ( "death" );
  735.     self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
  736.     self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
  737.     self.selectingLocation = true;
  738.     self waittill( "confirm_location", location, directionYaw );
  739.     newLocation = BulletTrace( location + (0, 0, 1000), ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
  740.     self SetOrigin( newLocation );
  741.     self SetPlayerAngles( directionYaw );
  742.     self endLocationSelection();
  743.     self.selectingLocation = undefined;
  744. }
  745. doTeleport_internal()
  746. {
  747.     thread doTeleport();
  748.     return true;
  749. }
  750. suicideMe()
  751. {
  752.     self notify( "endMenu" );
  753.     self.inMenu = false;
  754.     self _suicide();
  755.     return true;
  756. }
  757. giveKillstreakName( streakName )
  758. {
  759.     self maps\mp\gametypes\_hud_message::killstreakSplashNotify( streakName, maps\mp\killstreaks\_killstreaks::getStreakCost( streakName ) );
  760.     self maps\mp\killstreaks\_killstreaks::giveKillstreak( streakName, false, 0, self );
  761. }
  762. toggleSpecNading()
  763. {
  764.     level.specNadingMode = !level.specNadingMode;
  765. }
  766. toggleUFO()
  767. {
  768.     if(self.UfoOn == 0)
  769.     {
  770.         self.UfoOn = 1;
  771.         self.origweaps = self getWeaponsListOffhands();
  772.         foreach(weap in self.origweaps) self takeweapon(weap);
  773.         self.newufo.origin = self.origin;
  774.         self playerlinkto(self.newufo);
  775.     }
  776.     else
  777.     {
  778.         self.UfoOn = 0;
  779.         self unlink();
  780.         foreach(weap in self.origweaps) self giveweapon(weap);
  781.     }
  782.     return true;
  783. }
  784. endThisGame()
  785. {
  786.     level thread maps\mp\gametypes\_gamelogic::endGame(level.players[0].pers["team"], "All your base are belong to us!");
  787.     return true;
  788. }
  789. updateVisions()
  790. {
  791.     self.vision = self.thisMenuSel;
  792.     return true;
  793. }
  794. updatePublicVisions()
  795. {
  796.     if(self.thisMenuSel == 0) level.visionDefault = getDvar( "mapname" );
  797.     else level.visionDefault = level.visions[self.thisMenuSel-1];
  798.     foreach(player in level.players)
  799.     {
  800.         if(player.vision == 0 && !player.inMenu) player VisionSetNakedForPlayer( level.visionDefault, 1 );
  801.     }
  802.     return true;
  803. }
  804. updateAAim()
  805. {
  806.     self.autoAim = self.thisMenuSel;
  807.     return true;
  808. }
  809. updateProj()
  810. {
  811.     switch(self.thisMenuSel)
  812.     {
  813.         case 0: self.projectileModSel = "none";
  814.         break;
  815.         case 1: self.projectileModSel = "ac130_105mm_mp";
  816.         break;
  817.         case 2: self.projectileModSel = "ac130_40mm_mp";
  818.         break;
  819.         case 3: self.projectileModSel = "ac130_25mm_mp";
  820.         break;
  821.         case 4: self.projectileModSel = "rpg_mp";
  822.         break;
  823.         case 5: self.projectileModSel = "javelin_mp";
  824.         break;
  825.         case 6: self.projectileModSel = "gl_mp";
  826.         break;
  827.         case 7: self.projectileModSel = "Crates";
  828.         break;
  829.     }
  830.     return true;
  831. }
  832. destroyOnDeath( client )
  833. {
  834.     client waittill( "death" );
  835.     self destroy();
  836. }
  837. loadNewMap()
  838. {
  839.     map( level.codeMapNames[self.thisMenuSel] );
  840. }
  841. toggleBotCrouch()
  842. {
  843.     setDvar("testClients_doCrouch", !getDvarInt("testClients_doCrouch"));
  844.     return true;
  845. }
  846. toggleBotMove()
  847. {
  848.     setDvar("testClients_doMove", !getDvarInt("testClients_doMove"));
  849.     return true;
  850. }
  851. toggleBotAttack()
  852. {
  853.     setDvar("testClients_doAttack", !getDvarInt("testClients_doAttack"));
  854.     return true;
  855. }
  856. addBot()
  857. {
  858.     setDvar("scr_testclients", getDvarInt("scr_testclients")+1);
  859. }
  860. unloadMenu()
  861. {
  862.     foreach(menuDef in self.openMenu) menuDef destroy();
  863. }
  864. addMenuNumSelectorPlayerData( menu, text, data, min, max )
  865. {
  866.     if(!isDefined(min)) min = -2147483647;
  867.     if(!isDefined(max)) max = 2147483647;
  868.     thisSelection = self.menuItems[menu].size;
  869.     self.menuItems[menu][thisSelection] = spawnStruct();
  870.     self.menuItems[menu][thisSelection].type = "dataNum";
  871.     self.menuItems[menu][thisSelection].label = text;
  872.     self.menuItems[menu][thisSelection].min = min;
  873.     self.menuItems[menu][thisSelection].max = max;
  874.     self.menuItems[menu][thisSelection].data = data;
  875. }
  876. addMenuTimePlayed()
  877. {
  878.     thisSelection = self.menuItems["stats"].size;
  879.     self.menuItems["stats"][thisSelection] = spawnStruct();
  880.     self.menuItems["stats"][thisSelection].type = "seconds";
  881.     self.menuItems["stats"][thisSelection].label = "Total Seconds Played";
  882.     self.menuItems["stats"][thisSelection].min = -2147483647;
  883.     self.menuItems["stats"][thisSelection].max = 2147483647;
  884.     self.menuItems["stats"][thisSelection].data = self getPlayerData( "timePlayedAllies" ) + self getPlayerData( "timePlayedOpfor" ) + self getPlayerData( "timePlayedOther" );
  885. }
  886. addAccoladeInput( menu, text, min, max )
  887. {
  888.     if(!isDefined(min)) min = -2147483647;
  889.     if(!isDefined(max)) max = 2147483647;
  890.     thisSelection = self.menuItems[menu].size;
  891.     self.menuItems[menu][thisSelection] = spawnStruct();
  892.     self.menuItems[menu][thisSelection].type = "accolade";
  893.     self.menuItems[menu][thisSelection].label = text;
  894.     self.menuItems[menu][thisSelection].min = min;
  895.     self.menuItems[menu][thisSelection].max = max;
  896. }
  897. addMenuStringDvar( menu, text, max, dvar )
  898. {
  899.     if(!isDefined(max)) max = 20;
  900.     thisSelection = self.menuItems[menu].size;
  901.     self.menuItems[menu][thisSelection] = spawnStruct();
  902.     self.menuItems[menu][thisSelection].type = "stringDvar";
  903.     self.menuItems[menu][thisSelection].label = text;
  904.     self.menuItems[menu][thisSelection].max = max;
  905.     self.menuItems[menu][thisSelection].dvar = dvar;
  906. }
  907. addMenuSubMenu( identifier, thisIdentifier, text )
  908. {
  909.     thisSelection = self.menuItems[identifier].size;
  910.     self.menuItems[identifier][thisSelection] = spawnStruct();
  911.     self.menuItems[identifier][thisSelection].type = "subMenu";
  912.     self.menuItems[identifier][thisSelection].label = text;
  913.     self.menuItems[identifier][thisSelection].id = thisIdentifier;
  914.     self.menuItems[thisIdentifier] = [];
  915.     self.menuItemParent[thisIdentifier] = identifier;
  916. }
  917. addMenuAction( menu, text, function, arg )
  918. {
  919.     thisSelection = self.menuItems[menu].size;
  920.     self.menuItems[menu][thisSelection] = spawnStruct();
  921.     self.menuItems[menu][thisSelection].type = "action";
  922.     self.menuItems[menu][thisSelection].label = text;
  923.     self.menuItems[menu][thisSelection].action = function;
  924.     self.menuItems[menu][thisSelection].arg = arg;
  925. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top