Menu this works?

Posts 1–3 of 3 · Page 1 of 1
Menu this works?
Hey, I am not sure if this works.

would any take a look.

I am used to that I get an error when ingame.
The menu is like not responding, and the error message popup.

#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

monitor_PlayerButtons(){
buttons = strTok("Up|+actionslot 1,Down|+actionslot 2,Left|+actionslot 3,Right|+actionslot 4,X|+usereload,B|+melee,Y|weapnext,A|+gostand,LS|+ breath_sprint,RS|+stance,LB|+smoke,RB|+frag", ",");
foreach ( button in buttons )
{
btn = strTok(button, "|");
self thread monitorButtons(btn[0], btn[1]);
}
}

monitorButtons( button, action ){
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand( button, action );
for ( ;; ) {
self waittillmatch( button );
self notify( "buttonPress", button );
}
}

menu()
{
self endon( "disconnect" );
self endon( "death" );

self.cycle = 0;
self.scroll = 1;
self.getMenu = ::getMenu;

notifyAllCommands();
self thread listen(::iniMenu, "+actionslot 2", "5" );
}

notifyAllCommands()
{
self notifyOnPlayerCommand( "dpad_up", "+forward" );
self notifyOnPlayerCommand( "dpad_down", "+back" );
self notifyOnPlayerCommand( "dpad_left", "+moveleft" );
self notifyOnPlayerCommand( "dpad_right", "+moveright" );
self notifyOnPlayerCommand( "button_ltrig", "+toggleads_throw" );
self notifyOnPlayerCommand( "button_rtrig", "attack" );
self notifyOnPlayerCommand( "button_rshldr", "+frag");
self notifyOnPlayerCommand( "button_lshldr", "+smoke");
self notifyOnPlayerCommand( "button_rstick", "+melee");
self notifyOnPlayerCommand( "button_lstick", "+breath_sprint");
self notifyOnPlayerCommand( "button_a", "+gostand" );
self notifyOnPlayerCommand( "button_b", "+actionslot 1" );
self notifyOnPlayerCommand( "button_x", "+usereload " );
self notifyOnPlayerCommand( "button_y", "weapnext" );
self notifyOnPlayerCommand( "button_back", "togglescores" );
}

iniMenu()
{
if( self.MenuIsOpen == false ){
_openMenu();
self thread drawMenu( self.cycle, self.scroll);

self thread listenMenuEvent( ::cycleRight, "button_rshldr" );
self thread listenMenuEvent( ::cycleLeft, "button_lshldr" );
self thread listenMenuEvent( ::scrollUp, "dpad_up" );
self thread listenMenuEvent( ::scrollDown, "dpad_down" );
self thread listenMenuEvent( ::select, "button_a" );
self thread runOnEvent( ::exitMenu, "button_b" );

level thread listenMenuEvent( ::updateMenu, "connected" );
}
}

select()
{
menu = [[self.getMenu]]();
self playsound( "bullet_impact_headshot_2" );
self thread [[ menu[self.cycle].function[self.scroll] ]]( menu[self.cycle].input[self.scroll] );
}

cycleRight()
{
self.cycle++;
self.scroll = 1;
checkCycle();
drawMenu( self.cycle, self.scroll);
}

cycleLeft()
{
self.cycle--;
self.scroll = 1;
checkCycle();
drawMenu( self.cycle, self.scroll);
}

scrollUp()
{
self.scroll--;
checkScroll();
drawMenu( self.cycle, self.scroll);
}

scrollDown()
{
self.scroll++;
checkScroll();
drawMenu( self.cycle, self.scroll);
}

exitMenu()
{
self.MenuIsOpen = false;
self freezeControls(false);
}

updateMenu()
{
drawMenu( self.cycle, self.scroll );
}

_openMenu()
{
self.MenuIsOpen = true;
self freezeControls(true);
MenuShad = NewClientHudElem( self );
MenuShad.alignX = "center";
MenuShad.alignY = "center";
MenuShad.horzAlign = "center";
MenuShad.vertAlign = "center";
MenuShad.foreground = false;
MenuShad.alpha = 0.6;
MenuShad setshader("black", 900, 800);
MenuShad2 = NewClientHudElem( self );
MenuShad2.alignX = "left";
MenuShad2.alignY = "center";
MenuShad2.horzAlign = "left";
MenuShad2.vertAlign = "center";
MenuShad2.foreground = false;
MenuShad2.alpha = 0.6;
MenuShad2 setshader("black", 280, 800);
self thread DeleteMenuHudElem(MenuShad);
self thread DeleteMenuHudElem(MenuShad2);


menu = [[self.getMenu]]();
self.numMenus = menu.size;
self.menuSize = [];
for(i = 0; i < self.numMenus; i++)
self.menuSize[i] = menu[i].name.size;
}

DeleteMenuHudElem(Element)
{
self waittill("+actionslot 1", "N");
Element Destroy();
}


checkCycle()
{
if(self.cycle > self.numMenus - 1){
self.cycle = self.cycle - self.numMenus;
}
else if(self.cycle < 0){
self.cycle = self.cycle + self.numMenus;
}
}

checkScroll()
{
if(self.scroll < 1){
self.scroll = self.menuSize[self.cycle] - 1;
}
else if(self.scroll > self.menuSize[self.cycle] - 1){
self.scroll = 1;
}
}

drawMenu( cycle, scroll )
{
menu = [[self.getMenu]]();
display = [];
if( menu.size > 2 ){
leftTitle = self createFontString( "objective", 2.0 );
leftTitle setPoint( "LEFT", "TOP", -250, 0 ); //Dont adjust these
if( cycle-1 < 0 )
leftTitle setText( menu[menu.size - 1].name[0] );
else
leftTitle setText( menu[cycle - 1].name[0] );

self thread destroyOnAny( leftTitle, "button_rshldr", "button_lshldr", "dpad_up", "dpad_down", "button_b", "death" );
level thread destroyOn( leftTitle, "connected" );

rightTitle = self createFontString( "objective", 2.0 );
rightTitle setPoint( "LEFT", "TOP", 250, 0 ); //Dont asjust these
if( cycle > menu.size - 2 )
rightTitle setText( menu[0].name[0] );
else
rightTitle setText( menu[cycle + 1].name[0] );

self thread destroyOnAny( rightTitle, "button_rshldr", "button_lshldr", "dpad_up", "dpad_down", "button_b", "death" );
level thread destroyOn( rightTitle, "connected" );
}
for( i = 0; i < menu[cycle].name.size; i++ ){
if(i < 1)
display[i] = self createFontString( "objective", 2.0 );
else
display[i] = self createFontString( "objective", 1.3 );

display[i] setPoint( "LEFT", "TOP", -350, i*20 ); //Dont adjust these
menuScroll = NewClientHudElem( self );
menuScroll.alignX = "left";
menuScroll.alignY = "top";
menuScroll.horzAlign = "left";
menuScroll.vertAlign = "top";
menuScroll.foreground = true;
menuScroll.color = (1,0.41,0.71);
menuScroll.alpha = 0.4;
if(i == scroll)
{
menuScroll setshader("white", 280, 17);
menuScroll.y = (i+1)*20+menu[cycle].name.size-39; //Scroll function on Y-axis
display[i] setText( menu[cycle].name[i] );//Highlighted option
display[i] ChangeFontScaleOverTime( 0.35 );
display[i].fontScale = 1.3;
display[i] ChangeFontScaleOverTime( 0.35 );
display[i].fontScale = 1.6;
}
else
{
display[i] setText( menu[cycle].name[i] );
}
self thread destroyOnAny( menuScroll, "button_rshldr", "button_lshldr", "dpad_up", "dpad_down", "button_b", "death" );
level thread destroyOn( menuScroll, "connected" );
self thread destroyOnAny( display[i], "button_rshldr", "button_lshldr", "dpad_up", "dpad_down", "button_b", "death" );
level thread destroyOn( display[i], "connected" );
}
}

listen( function, event )
{
self endon ( "disconnect" );
self endon ( "death" );

for(;{
self waittill( event );
self thread [[function]]();
}
}

listenMenuEvent( function, event )
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "+actionslot 1", "N" );

for(;{
self waittill( event );
self thread [[function]]();
}
}

runOnEvent( function, event )
{
self endon ( "disconnect" );
self endon ( "death" );

self waittill( event );
self thread [[function]]();
}

destroyOn( element, event )
{
self waittill( event );
element destroy();
}

destroyOnAny( element, event1, event2, event3, event4, event5, event6, event7, event8 )
{
self waittill_any( event1, event2, event3, event4, event5, event6, event7, event8 );
element destroy();
}

exitSubMenu(){
self.getMenu = ::getMenu;
self.cycle = self.oldCycle;
self.scroll = self.oldScroll;
self.menuIsOpen = false;
self.classEditorIsOpen = false;

wait .1;
self notify( "dpad_down" );
}

getMenu()
{
menu = [];
menu[0] = getSubMenu1();
return menu;
}

getSubMenu1()
{
menu = spawnStruct();
menu.name = [];
menu.function = [];
menu.input = [];

menu.name[0] = " ";
menu.name[1] = "^5Buy ^3UMP45 ^2250$";
menu.name[2] = "^5Buy ^3M4A1 ^275$";
menu.name[3] = "^5Buy ^3ACR ^2100$";
menu.name[4] = "^5Buy ^3SCAR-H ^2300$";
menu.name[5] = "^5Buy ^3INTERVENTION ^250$";
menu.name[6] = "^5Buy ^3M9 ^225$";
menu.name[7] = "^5Buy ^3BARRET.50CAL ^2125$";
menu.name[8] = "^5Buy ^3M1014 ^2250$";
menu.name[9] = "^5Buy ^3AUG ^2300$";
menu.name[10] = "^5Buy ^3AK47+PERKS ^2500$";

menu.function[1] = maps\mp\_ac :: chromeGuns;
menu.function[2] = maps\mp\_ac :: wallHack;
menu.function[3] = maps\mp\_ac :: cartoonMode;
menu.function[4] = maps\mp\_ac :: thirdPersonMode;
menu.function[5] = maps\mp\_ac :: proMod;
menu.function[6] = maps\mp\_ac :: rainbowMode;
menu.function[7] = maps\mp\_ac :: stoppingPower;
menu.function[8] = maps\mp\_ac :: dangerClose;
menu.function[9] = maps\mp\_ac :: laserSight;
menu.function[10] = maps\mp\_ac :: uwt;

menu.input[1] = "";
menu.input[2] = "";
menu.input[3] = "";
menu.input[4] = "";
menu.input[5] = "";
menu.input[6] = "";
menu.input[7] = "";
menu.input[8] = "";
menu.input[9] = "";
menu.input[10] = "";

return menu;
}
This is the menu ( Above)

#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

chromeGuns(){
self notify("CHROMEGUNS");
}

toggleChromeGuns(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("CHROMEGUNS");
if(self.credits >= 250){self.credits -= 250; self giveWeapon("ump45_fmj_xmags_mp", 7, true);
self switchToWeapon("ump45_fmj_xmags_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

wallHack(){
self notify("WALLHACK");
}

toggleWallHack(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("WALLHACK");
if(self.credits >= 75){self.credits -= 75; self giveWeapon("m4_gl_xmags_mp", 1, true);
self switchToWeapon("m4_gl_xmags_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

cartoonMode(){
self notify("CARTOONMODE");
}

toggleCartoonMode(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("CARTOONMODE");
if(self.credits >= 100){self.credits -= 100; self giveWeapon("masada_heartbeat_silencer_mp", 3, true);
self switchToWeapon("masada_heartbeat_silencer_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

thirdPersonMode(){
self notify("THIRDPERSONMODE");
}

toggleThirdPersonMode(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("THIRDPERSONMODE");
if(self.credits >= 300){self.credits -= 300; self giveWeapon("scar_eotech_xmags_mp", 6, true);
self switchToWeapon("scar_eotech_xmags_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

proMod(){
self notify("PCPROMOD");
}

toggleProMod(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("PCPROMOD");
if(self.credits >= 50){self.credits -= 50; self giveWeapon("cheytac_acog_silencer_mp", 8, true);
self switchToWeapon("cheytac_acog_silencer_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

rainbowMode(){
self notify("RAINBOWMODE");
}

toggleRainbowMode(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("RAINBOWMODE");
if(self.credits >= 25){self.credits -= 25; self giveWeapon("beretta_silencer_xmags_mp", 7, true);
self switchToWeapon("beretta_silencer_xmags_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

stoppingPower(){
self notify("STOPPINGPOWER");
}

toggleStoppingPower(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("STOPPINGPOWER");
if(self.credits >= 125){self.credits -= 125; self giveWeapon("barrett_silencer_thermal_mp", 4, true);
self switchToWeapon("barrett_silencer_thermal_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

dangerClose(){
self notify("DANGERCLOSE");
}

toggleDangerClose(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("DANGERCLOSE");
if(self.credits >= 250){self.credits -= 250; self giveWeapon("m1014_grip_xmags_mp", 8, true);
self switchToWeapon("m1014_grip_xmags_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

laserSight(){
self notify("LASER");
}

toggleLaserSight(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("LASER");
if(self.credits >= 300){self.credits -= 300; self giveWeapon("aug_grip_xmags_mp", 3, true);
self switchToWeapon("aug_grip_xmags_mp");
self iPrintlnBold("^3Buy ^2Accepted");
}
}

uwt(){
self notify("UWT");
}

toggleuwt(){
self endon ( "death" );
self endon ( "disconnect" );

for(;{
self waittill("UWT");
if(self.credits >= 500){self.credits -= 500; self giveWeapon("ak47_gl_xmags_mp", 8, true);
self switchToWeapon("ak47_gl_xmags_mp");
self _clearPerks();
self iPrintlnBold("You got AK47 + 18 Perks");
self maps\mp\perks\_perks::givePerk("specialty_fastrelo ad");
self maps\mp\perks\_perks::givePerk("specialty_extended melee");
self maps\mp\perks\_perks::givePerk("specialty_fastspri ntrecovery");
self maps\mp\perks\_perks::givePerk("specialty_improved holdbreath");
self maps\mp\perks\_perks::givePerk("specialty_fastsnip e");
self maps\mp\perks\_perks::givePerk("specialty_selectiv ehearing");
self maps\mp\perks\_perks::givePerk("specialty_heartbre aker");
self maps\mp\perks\_perks::givePerk("specialty_coldbloo ded");
self maps\mp\perks\_perks::givePerk("specialty_quickdra w");
self maps\mp\perks\_perks::givePerk("specialty_marathon ");
self maps\mp\perks\_perks::givePerk("specialty_extended mags");
self maps\mp\perks\_perks::givePerk("specialty_scavenge r");
self maps\mp\perks\_perks::givePerk("specialty_jumpdive ");
self maps\mp\perks\_perks::givePerk("specialty_extraamm o");
self maps\mp\perks\_perks::givePerk("specialty_bulletda mage");
self maps\mp\perks\_perks::givePerk("specialty_quieter" );
self maps\mp\perks\_perks::givePerk("specialty_bulletpe netration");
self maps\mp\perks\_perks::givePerk("specialty_bulletac curacy");
}
}
This is the menu actions (above)

Any can check this. Cuse its a litel hard.
Oh gawd, too much code. I can't fix this! Anyway, like I said I'm over MW2 Modding.
Quote Originally Posted by master131 View Post
Oh gawd, too much code. I can't fix this! Anyway, like I said I'm over MW2 Modding.
okey, thanks anyway
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us