Advertisement
BaSs_HaXoR

[GSC] Black Ops 2 - Base Menu Verification System

Sep 9th, 2014
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 16.05 KB | None | 0 0
  1. #include maps/mp/_utility;
  2. #include common_scripts/utility;
  3. #include maps/mp/gametypes/_hud_util;
  4. #include maps/mp/_utility;
  5.  
  6. /* Black Ops 2 - Menu Base ( Multiplayers And Zombie )
  7.    Build: 1.0.0
  8.    Made By ZeiiKeN & Fanatik
  9.    Thanks for use my base menu
  10.    Please contact me if you encounter an error when you use my base menu
  11.    Skype: PS3Matrache
  12.    Visit: www.Xbox-Gen.fr
  13. */  
  14.  
  15. init( )
  16. {
  17.     level.clientid = 0;
  18.     level thread onplayerconnect( );
  19. }
  20. onplayerconnect( )
  21. {
  22.     for(;;)
  23.     {
  24.         level waittill( "connecting", player );
  25.         player thread onplayerspawned( );
  26.         player.clientid = level.clientid;
  27.         level.clientid++;
  28.         player.Verified = false;
  29.         player.VIP = false;
  30.         player.Admin = false;
  31.         player.CoHost = false;
  32.         player.MyAccess = "";
  33.     }
  34. }
  35. onplayerspawned( )
  36. {
  37.     self endon( "disconnect" );
  38.     level endon( "game_ended" );
  39.     for(;;)
  40.     {
  41.         self waittill( "spawned_player" );
  42.         if(self isHost())
  43.         {
  44.             self freezecontrols(false);
  45.             self.Verified = true;
  46.             self.VIP = true;
  47.             self.Admin = true;
  48.             self.CoHost = true;
  49.             self.MyAccess = "^1Host";
  50.             self thread BuildMenu();
  51.         }
  52.         else if ( self.CoHost == true)
  53.         {
  54.             self.Verified = true;
  55.             self.VIP = true;
  56.             self.Admin = true;
  57.             self.CoHost = true;
  58.             self.MyAccess = "^5Co-Host";
  59.             self freezecontrols(false);
  60.             self thread BuildMenu();
  61.         }
  62.         else if ( self.Admin == true)
  63.         {
  64.             self.Verified = true;
  65.             self.VIP = true;
  66.             self.Admin = true;
  67.             self.MyAccess = "^1Admin";
  68.             self freezecontrols(false);
  69.             self thread BuildMenu();
  70.         }
  71.         else if ( self.VIP == true)
  72.         {
  73.             self.Verified = true;
  74.             self.VIP = true;
  75.             self.MyAccess = "^3VIP";
  76.             self freezecontrols(false);
  77.             self thread BuildMenu();
  78.         }
  79.         else if ( self.Verified == true)
  80.         {
  81.             self.Verified = true;
  82.             self.MyAccess = "^1Verified";
  83.             self freezecontrols(false);
  84.             self thread BuildMenu();
  85.         }
  86.         else if ( self.Verified == false)
  87.         {
  88.             self.MyAccess = "";
  89.         }
  90.     }
  91. }
  92.  
  93. BuildMenu()
  94. {
  95.     self endon("disconnect");
  96.     self endon("death");
  97.     self.MenuOpen = false;
  98.     self.Menu = spawnstruct();
  99.     self InitialisingMenu();
  100.     self MenuStructure();
  101.     self thread MenuDeath();
  102.     while (1)
  103.     {
  104.         if(self SecondaryOffhandButtonPressed() && self.MenuOpen == false)
  105.         {
  106.             self MenuOpening();
  107.             self LoadMenu("Main Menu");
  108.         }
  109.         else if (self MeleeButtonPressed() && self.MenuOpen == true)
  110.         {
  111.             self MenuClosing();
  112.             wait 1;
  113.         }
  114.         else if(self StanceButtonPressed() && self.MenuOpen == true)
  115.         {
  116.             if(isDefined(self.Menu.System["MenuPrevious"][self.Menu.System["MenuRoot"]]))
  117.             {
  118.                 self.Menu.System["MenuCurser"] = 0;
  119.                 self SubMenu(self.Menu.System["MenuPrevious"][self.Menu.System["MenuRoot"]]);
  120.                 wait 0.5;
  121.             }
  122.         }
  123.         else if (self AdsButtonPressed() && self.MenuOpen == true)
  124.         {
  125.             self.Menu.System["MenuCurser"] -= 1;
  126.             if (self.Menu.System["MenuCurser"] < 0)
  127.             {
  128.                 self.Menu.System["MenuCurser"] = self.Menu.System["MenuTexte"][self.Menu.System["MenuRoot"]].size - 1;
  129.             }
  130.             self.Menu.Material["Scrollbar"] elemMoveY(.2, 60 + (self.Menu.System["MenuCurser"] * 15.6));
  131.             wait.2;
  132.         }
  133.         else if (self AttackButtonpressed() && self.MenuOpen == true)
  134.         {
  135.             self.Menu.System["MenuCurser"] += 1;
  136.             if (self.Menu.System["MenuCurser"] >= self.Menu.System["MenuTexte"][self.Menu.System["MenuRoot"]].size)
  137.             {
  138.                 self.Menu.System["MenuCurser"] = 0;
  139.             }
  140.             self.Menu.Material["Scrollbar"] elemMoveY(.2, 60 + (self.Menu.System["MenuCurser"] * 15.6));
  141.             wait.2;
  142.         }
  143.         else if(self UseButtonPressed() && self.MenuOpen == true)
  144.         {
  145.                 wait 0.2;
  146.                 if(self.Menu.System["MenuRoot"]=="Clients Menu") self.Menu.System["ClientIndex"]=self.Menu.System["MenuCurser"];
  147.                 self thread [[self.Menu.System["MenuFunction"][self.Menu.System["MenuRoot"]][self.Menu.System["MenuCurser"]]]](self.Menu.System["MenuInput"][self.Menu.System["MenuRoot"]][self.Menu.System["MenuCurser"]]);
  148.                 wait 0.5;
  149.         }
  150.         wait 0.05;
  151.     }
  152. }  
  153.  
  154. MenuStructure()
  155. {
  156.     if (self.Verified == true)
  157.     {
  158.     self MainMenu("Main Menu", undefined);
  159.     self MenuOption("Main Menu", 0, "Sub Menu 1", ::SubMenu, "Sub Menu 1");
  160.     self MenuOption("Main Menu", 1, "Sub Menu 2", ::SubMenu, "Sub Menu 2");
  161.     self MenuOption("Main Menu", 2, "Sub Menu 3", ::SubMenu, "Sub Menu 3");
  162.     self MenuOption("Main Menu", 3, "Sub Menu 4", ::SubMenu, "Sub Menu 4");
  163.     }
  164.     if (self.VIP == true)
  165.     {
  166.     self MenuOption("Main Menu", 4, "Sub Menu 5 (VIP)", ::SubMenu, "Sub Menu 5 (VIP)");
  167.     }
  168.     if (self.Admin == true)
  169.     {
  170.     self MenuOption("Main Menu", 5, "Sub Menu 6 (Admin)", ::SubMenu, "Sub Menu 6 (Admin)");
  171.     }
  172.     if (self.CoHost == true)
  173.     {
  174.     self MenuOption("Main Menu", 6, "Sub Menu 7 (Host)", ::SubMenu, "Sub Menu 7 (Host)");
  175.     self MenuOption("Main Menu", 7, "Clients Menu", ::SubMenu, "Clients Menu");
  176.     self MenuOption("Main Menu", 8, "All Clients", ::SubMenu, "All Clients");
  177.     }
  178.    
  179.     self MainMenu("Sub Menu 1", "Main Menu");
  180.     self MenuOption("Sub Menu 1", 0, "Fonctions Here", ::Test);
  181.     self MenuOption("Sub Menu 1", 1, "Fonctions Here", ::Test);
  182.     self MenuOption("Sub Menu 1", 2, "Fonctions Here", ::Test);
  183.     self MenuOption("Sub Menu 1", 3, "Fonctions Here", ::Test);
  184.     self MenuOption("Sub Menu 1", 4, "Fonctions Here", ::Test);
  185.     self MenuOption("Sub Menu 1", 5, "Fonctions Here", ::Test);
  186.    
  187.     self MainMenu("Sub Menu 2", "Main Menu");
  188.     self MenuOption("Sub Menu 2", 0, "Fonctions Here", ::Test);
  189.     self MenuOption("Sub Menu 2", 1, "Fonctions Here", ::Test);
  190.     self MenuOption("Sub Menu 2", 2, "Fonctions Here", ::Test);
  191.     self MenuOption("Sub Menu 2", 3, "Fonctions Here", ::Test);
  192.     self MenuOption("Sub Menu 2", 4, "Fonctions Here", ::Test);
  193.     self MenuOption("Sub Menu 2", 5, "Fonctions Here", ::Test);
  194.    
  195.     self MainMenu("Sub Menu 3", "Main Menu");
  196.     self MenuOption("Sub Menu 3", 0, "Fonctions Here", ::Test);
  197.     self MenuOption("Sub Menu 3", 1, "Fonctions Here", ::Test);
  198.     self MenuOption("Sub Menu 3", 2, "Fonctions Here", ::Test);
  199.     self MenuOption("Sub Menu 3", 3, "Fonctions Here", ::Test);
  200.     self MenuOption("Sub Menu 3", 4, "Fonctions Here", ::Test);
  201.     self MenuOption("Sub Menu 3", 5, "Fonctions Here", ::Test);
  202.    
  203.     self MainMenu("Sub Menu 4", "Main Menu");
  204.     self MenuOption("Sub Menu 4", 0, "Fonctions Here", ::Test);
  205.     self MenuOption("Sub Menu 4", 1, "Fonctions Here", ::Test);
  206.     self MenuOption("Sub Menu 4", 2, "Fonctions Here", ::Test);
  207.     self MenuOption("Sub Menu 4", 3, "Fonctions Here", ::Test);
  208.     self MenuOption("Sub Menu 4", 4, "Fonctions Here", ::Test);
  209.     self MenuOption("Sub Menu 4", 5, "Fonctions Here", ::Test);
  210.    
  211.     self MainMenu("Sub Menu 5 (VIP)", "Main Menu");
  212.     self MenuOption("Sub Menu 5 (VIP)", 0, "Fonctions Here", ::Test);
  213.     self MenuOption("Sub Menu 5 (VIP)", 1, "Fonctions Here", ::Test);
  214.     self MenuOption("Sub Menu 5 (VIP)", 2, "Fonctions Here", ::Test);
  215.     self MenuOption("Sub Menu 5 (VIP)", 3, "Fonctions Here", ::Test);
  216.     self MenuOption("Sub Menu 5 (VIP)", 4, "Fonctions Here", ::Test);
  217.     self MenuOption("Sub Menu 5 (VIP)", 5, "Fonctions Here", ::Test);
  218.    
  219.     self MainMenu("Sub Menu 6 (Admin)", "Main Menu");
  220.     self MenuOption("Sub Menu 6 (Admin)", 0, "Fonctions Here", ::Test);
  221.     self MenuOption("Sub Menu 6 (Admin)", 1, "Fonctions Here", ::Test);
  222.     self MenuOption("Sub Menu 6 (Admin)", 2, "Fonctions Here", ::Test);
  223.     self MenuOption("Sub Menu 6 (Admin)", 3, "Fonctions Here", ::Test);
  224.     self MenuOption("Sub Menu 6 (Admin)", 4, "Fonctions Here", ::Test);
  225.     self MenuOption("Sub Menu 6 (Admin)", 5, "Fonctions Here", ::Test);
  226.    
  227.     self MainMenu("Sub Menu 7 (Host)", "Main Menu");
  228.     self MenuOption("Sub Menu 7 (Host)", 0, "Fonctions Here", ::Test);
  229.     self MenuOption("Sub Menu 7 (Host)", 1, "Fonctions Here", ::Test);
  230.     self MenuOption("Sub Menu 7 (Host)", 2, "Fonctions Here", ::Test);
  231.     self MenuOption("Sub Menu 7 (Host)", 3, "Fonctions Here", ::Test);
  232.     self MenuOption("Sub Menu 7 (Host)", 4, "Fonctions Here", ::Test);
  233.     self MenuOption("Sub Menu 7 (Host)", 5, "Fonctions Here", ::Test);
  234.    
  235.     self MainMenu("Clients Menu", "Main Menu");
  236.     for (p = 0; p < level.players.size; p++) {
  237.         player = level.players[p];
  238.         self MenuOption("Clients Menu", p, "[" + player.MyAccess + "^7] " + player.name + "", ::SubMenu, "Client Function");
  239.     }
  240.     self thread MonitorPlayers();
  241.    
  242.     self MainMenu("Client Function", "Clients Menu");
  243.     self MenuOption("Client Function", 0, "Verify Player", ::Verify);
  244.     self MenuOption("Client Function", 1, "VIP Player", ::doVIP);
  245.     self MenuOption("Client Function", 2, "Admin Player", ::doAdmin);
  246.     self MenuOption("Client Function", 3, "Co-Host Player", ::doCoHost);
  247.     self MenuOption("Client Function", 4, "Unverified Player", ::doUnverif);
  248.     self MenuOption("Client Function", 5, "Fonctions Here", ::Test);
  249.    
  250.     self MainMenu("All Clients", "Main Menu");
  251.     self MenuOption("All Clients", 0, "Kill All Players", ::AllPlayersKilled);
  252.     self MenuOption("All Clients", 1, "Function Here", ::Test);
  253.     self MenuOption("All Clients", 2, "Function Here", ::Test);
  254.     self MenuOption("All Clients", 3, "Function Here", ::Test);
  255.     self MenuOption("All Clients", 4, "Function Here", ::Test);
  256. }
  257. MonitorPlayers()
  258. {
  259.     self endon("disconnect");
  260.     for(;;)
  261.     {
  262.         for(p = 0;p < level.players.size;p++)
  263.         {
  264.             player = level.players[p];
  265.             self.Menu.System["MenuTexte"]["Clients Menu"][p] = "[" + player.MyAccess + "^7] " + player.name;
  266.             self.Menu.System["MenuFunction"]["Clients Menu"][p] = ::SubMenu;
  267.             self.Menu.System["MenuInput"]["Clients Menu"][p] = "Client Function";
  268.             wait .01;
  269.         }
  270.         wait .5;
  271.     }
  272. }
  273. MainMenu(Menu, Return)
  274. {
  275.     self.Menu.System["GetMenu"] = Menu;
  276.     self.Menu.System["MenuCount"] = 0;
  277.     self.Menu.System["MenuPrevious"][Menu] = Return;
  278. }
  279. MenuOption(Menu, Index, Texte, Function, Input)
  280. {
  281.     self.Menu.System["MenuTexte"][Menu][Index] = Texte;
  282.     self.Menu.System["MenuFunction"][Menu][Index] = Function;
  283.     self.Menu.System["MenuInput"][Menu][Index] = Input;
  284. }
  285. SubMenu(input)
  286. {
  287.     self.Menu.System["MenuCurser"] = 0;
  288.     self.Menu.System["Texte"] fadeovertime(0.05);
  289.     self.Menu.System["Texte"].alpha = 0;
  290.     self.Menu.System["Texte"] destroy();
  291.     self.Menu.System["Title"] destroy();
  292.     self thread LoadMenu(input);
  293.     if(self.Menu.System["MenuRoot"]=="Client Function")
  294.     {
  295.     self.Menu.System["Title"] destroy();
  296.     player = level.players[self.Menu.System["ClientIndex"]];
  297.     self.Menu.System["Title"] = self createFontString("default", 2.0);
  298.     self.Menu.System["Title"] setPoint("LEFT", "TOP", 125, 30);
  299.     self.Menu.System["Title"] setText("[" + player.MyAccess + "^7] " + player.name);
  300.     self.Menu.System["Title"].sort = 3;
  301.     self.Menu.System["Title"].alpha = 1;
  302.     }
  303. }
  304. LoadMenu(menu)
  305. {
  306.     self.Menu.System["MenuCurser"] = 0;
  307.     self.Menu.System["MenuRoot"] = menu;
  308.     self.Menu.System["Title"] = self createFontString("default", 2.0);
  309.     self.Menu.System["Title"] setPoint("LEFT", "TOP", 125, 30);
  310.     self.Menu.System["Title"] setText(menu);
  311.     self.Menu.System["Title"].sort = 3;
  312.     self.Menu.System["Title"].alpha = 1;
  313.     string = "";
  314.     for(i=0;i<self.Menu.System["MenuTexte"][Menu].size;i++) string += self.Menu.System["MenuTexte"][Menu][i] + "\n";
  315.     self.Menu.System["Texte"] = self createFontString("default", 1.3);
  316.     self.Menu.System["Texte"] setPoint("LEFT", "TOP", 125, 60);
  317.     self.Menu.System["Texte"] setText(string);
  318.     self.Menu.System["Texte"].sort = 3;
  319.     self.Menu.System["Texte"].alpha = 1;
  320.     self.Menu.Material["Scrollbar"] elemMoveY(.2, 60 + (self.Menu.System["MenuCurser"] * 15.6));
  321. }
  322. SetMaterial(align, relative, x, y, width, height, colour, shader, sort, alpha)
  323. {
  324.     hud = newClientHudElem(self);
  325.     hud.elemtype = "icon";
  326.     hud.color = colour;
  327.     hud.alpha = alpha;
  328.     hud.sort = sort;
  329.     hud.children = [];
  330.     hud setParent(level.uiParent);
  331.     hud setShader(shader, width, height);
  332.     hud setPoint(align, relative, x, y);
  333.     return hud;
  334. }
  335. MenuDeath()
  336. {
  337.     self waittill("death");
  338.     self.Menu.Material["Background"] destroy();
  339.     self.Menu.Material["Scrollbar"] destroy();
  340.     self.Menu.Material["BorderMiddle"] destroy();
  341.     self.Menu.Material["BorderLeft"] destroy();
  342.     self.Menu.Material["BorderRight"] destroy();
  343.     self MenuClosing();
  344. }
  345. InitialisingMenu()
  346. {
  347.     self.Menu.Material["Background"] = self SetMaterial("LEFT", "TOP", 120, 0, 240, 1000, (1,1,1), "black", 0, 0);
  348.     self.Menu.Material["Scrollbar"] = self SetMaterial("LEFT", "TOP", 120, 60, 240, 15, (0,1,0), "white", 1, 0);
  349.     self.Menu.Material["BorderMiddle"] = self SetMaterial("LEFT", "TOP", 120, 50, 240, 1, (0,1,0), "white", 1, 0);
  350.     self.Menu.Material["BorderLeft"] = self SetMaterial("LEFT", "TOP", 119, 0, 1, 1000, (0,1,0), "white", 1, 0);
  351.     self.Menu.Material["BorderRight"] = self SetMaterial("LEFT", "TOP", 360, 0, 1, 1000, (0,1,0), "white", 1, 0);
  352. }
  353.  
  354. MenuOpening()
  355. {
  356.     self freezecontrols(true);
  357.     self setclientuivisibilityflag( "hud_visible", 0 );
  358.     self enableInvulnerability();
  359.     self.MenuOpen = true;
  360.     self.Menu.Material["Background"] elemFade(.5, 0.76);
  361.     self.Menu.Material["Scrollbar"] elemFade(.5, 0.6);
  362.     self.Menu.Material["BorderMiddle"] elemFade(.5, 0.6);
  363.     self.Menu.Material["BorderLeft"] elemFade(.5, 0.6);
  364.     self.Menu.Material["BorderRight"] elemFade(.5, 0.6);
  365. }
  366.  
  367. MenuClosing()
  368. {    
  369.     self setclientuivisibilityflag( "hud_visible", 1 );
  370.     self.Menu.Material["Background"] elemFade(.5, 0);
  371.     self.Menu.Material["Scrollbar"] elemFade(.5, 0);
  372.     self.Menu.Material["BorderMiddle"] elemFade(.5, 0);
  373.     self.Menu.Material["BorderLeft"] elemFade(.5, 0);
  374.     self.Menu.Material["BorderRight"] elemFade(.5, 0);
  375.     self freezecontrols(false);
  376.     self disableInvulnerability();
  377.     self.Menu.System["Title"] destroy();
  378.     self.Menu.System["Texte"] destroy();
  379.     wait 0.05;
  380.     self.MenuOpen = false;
  381. }  
  382.  
  383. elemMoveY(time, input)
  384. {
  385.     self moveOverTime(time);
  386.     self.y = input;
  387. }
  388.  
  389. elemMoveX(time, input)
  390. {
  391.     self moveOverTime(time);
  392.     self.x = input;
  393. }
  394.  
  395. elemFade(time, alpha)
  396. {
  397.     self fadeOverTime(time);
  398.     self.alpha = alpha;
  399. }
  400.  
  401. doUnverif()
  402. {
  403.     player = level.players[self.Menu.System["ClientIndex"]];
  404.     if(player isHost())
  405.     {
  406.         self iPrintln("You can't Un-Verify the Host!");
  407.     }
  408.     else
  409.     {
  410.         player.Verified = false;
  411.         player.VIP = false;
  412.         player.Admin = false;
  413.         player.CoHost = false;
  414.         player suicide();
  415.         self iPrintln( player.name + " is ^1Unverfied" );
  416.     }
  417. }
  418.  
  419. UnverifMe()
  420. {
  421.     self.Verified = false;
  422.     self.VIP = false;
  423.     self.Admin = false;
  424.     self.CoHost = false;
  425.     self suicide();
  426. }
  427.  
  428. Verify()
  429. {
  430.     player = level.players[self.Menu.System["ClientIndex"]];
  431.     if(player isHost())
  432.     {
  433.         self iPrintln("You can't Verify the Host!");
  434.     }
  435.     else
  436.     {
  437.         player UnverifMe();
  438.         player.Verified = true;
  439.         player.VIP = false;
  440.         player.Admin = false;
  441.         player.CoHost = false;
  442.         self iPrintln( player.name + " is ^1Verified" );
  443.     }
  444. }
  445. doVIP()
  446. {
  447.     player = level.players[self.Menu.System["ClientIndex"]];
  448.     if(player isHost())
  449.     {
  450.         self iPrintln("You can't Verify the Host!");
  451.     }
  452.     else
  453.     {
  454.         player UnverifMe();
  455.         player.Verified = true;
  456.         player.VIP = true;
  457.         player.Admin = false;
  458.         player.CoHost = false;
  459.         self iPrintln( player.name + " is ^3VIP" );
  460.     }
  461. }
  462. doAdmin()
  463. {
  464.     player = level.players[self.Menu.System["ClientIndex"]];
  465.     if(player isHost())
  466.     {
  467.         self iPrintln("You can't Verify the Host!");
  468.     }
  469.     else
  470.     {
  471.         player UnverifMe();
  472.         player.Verified = true;
  473.         player.VIP = true;
  474.         player.Admin = true;
  475.         player.CoHost = false;
  476.         self iPrintln( player.name + " is ^1Admin" );
  477.     }
  478. }
  479. doCoHost()
  480. {
  481.     player = level.players[self.Menu.System["ClientIndex"]];
  482.     if(player isHost())
  483.     {
  484.         self iPrintln("You can't Verify the Host!");
  485.     }
  486.     else
  487.     {
  488.         if (player.CoHost == false)
  489.         {
  490.             player UnverifMe();
  491.             player.Verified = true;
  492.             player.VIP = true;
  493.             player.Admin = true;
  494.             player.CoHost = true;
  495.             self iPrintln( player.name + " is ^5Co-Host" );
  496.         }
  497.     }
  498. }
  499.  
  500. AllPlayersKilled()
  501. {
  502.     foreach(player in level.players)
  503.     {
  504.         if(player isHost())
  505.         {
  506.             // For detecting host and exclude switch and cotinue to next client
  507.         }
  508.         else
  509.         {
  510.             player suicide();
  511.         }
  512.     }
  513.     self iPrintln("All Players: ^2Killed !");
  514. }
  515.  
  516. Test()
  517. {
  518.     self iPrintln("Main Menu By ^2ZeiiKeN ^7& ^2Fanatik");
  519.     self iPrintln("Visit: www.^2X^7box-^2G^7en.fr");
  520. }
  521.  
  522.  
  523.  
  524. Using the menu:
  525. Code:
  526. L2- Opening the menu
  527. L1& R1- Navigation
  528. Square- Activation
  529. Round- Exit submenu
  530. R3- Close menu
  531. Verifications:
  532. Code:
  533. Host
  534. Co-Host
  535. Admin
  536. VIP
  537. Verified
  538. Unverified
  539. Credits:
  540. Code:
  541. Menu Base Coded by:
  542. - ZeiiKeN
  543. - Fanatik
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement