Answered Menu Locking

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
I have game modes located in my menu, but I want it to where once you load a gamemode and the game restarts, that the menu is locked and it will not open until you go back. How can I lock the menu?
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,093
Reaction score
2,881
Points
1,103
I have game modes located in my menu, but I want it to where once you load a gamemode and the game restarts, that the menu is locked and it will not open until you go back. How can I lock the menu?
With a simple code in your init. :smile: I recommed to take a look at sources which have the feature already. So you can look how they solved it.
 

[nobody@CCM:]

Member
Messages
95
Reaction score
86
Points
18
so all you do is make a Var to check if the menu is locked or unlocked lets begin.

add this into your MonitorButtons (Maybe called something different):
self.menuLocked = false;

Once you have done that you need to do a check on your open button monitoring, Example:
if(self actionSlotOneButtonPressed() && !self.menu.open && !self.menuLocked)

Once you have done both of them you can start working on the lock menu and unlockMenu:
Code:
LockMenu()
{
    //self _closeMenu();
    //wait .3;
    self.menuLocked = true;
    self iprintln("^1Menu Now Locked");
}
UnlockMenu()
{
    self.menuLocked = false;
    self iprintln("^2Menu Now Unlocked");
}

NOTE: I recommend running your close menu when you lock your menu so they wont be any issues down the line, also take note the text above is all examples and may not work so you will need to make it suite the base you are using.

~Extinct
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
so all you do is make a Var to see if the menu is open or closed.

add this into your MonitorButtons (Maybe called something different):
self.menuLocked = false;

Once you have done that you need to do a check on your open button monitoring, Example:
if(self actionSlotOneButtonPressed() && !self.menu.open && !self.menuLocked)

Once you have done both of them you can start working on the lock menu and unlockMenu:
Code:
LockMenu()
{
    //self _closeMenu();
    //wait .3;
    self.menuLocked = true;
    self iprintln("^1Menu Now Locked");
}
UnlockMenu()
{
    self.menuLocked = false;
    self iprintln("^2Menu Now Unlocked");
}

NOTE: I recommend running your close menu when you lock your menu so they wont be any issues down the line, also take note the text above is all examples and may not work so you will need to make it suite the base you are using.

~Extinct
Thanks, I'll test it.
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
Let me know if you need anymore help, @CabCon and @StonedYoda first of all why didn't you just help him and it isn't a code in the inits dafuq, that is utter nonsense, If its that simple why tf didn't you just help him.

~Extinct
I added everything as you said correctly... So when I use
Code:
gameSelector(G)
{
    self resetdvars();
    self thread kickAllBots();
    iPrintln("^2Changing Game Mode...");
    setDvar("customgametype",G);
    self fastRestart();
    //self LockMenu();
}
Would I lock the menu there?
 

[nobody@CCM:]

Member
Messages
95
Reaction score
86
Points
18
I added everything as you said correctly... So when I use
Code:
gameSelector(G)
{
    self resetdvars();
    self thread kickAllBots();
    iPrintln("^2Changing Game Mode...");
    setDvar("customgametype",G);
    self fastRestart();
    //self LockMenu();
}
Would I lock the menu there?
looks good :smile:
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,093
Reaction score
2,881
Points
1,103
Let me know if you need anymore help, @CabCon and @StonedYoda first of all why didn't you just help him and it isn't a code in the inits dafuq, that is utter nonsense, If its that simple why tf didn't you just help him.

~Extinct
Thank you, I was online on my smartphone. But I also thought he want something similar like a gamemode menu. Like the menus in w@w have it. :smile:
 

The Dark Side

Former Staff Member
Messages
1,004
Reaction score
770
Points
993
I have game modes located in my menu, but I want it to where once you load a gamemode and the game restarts, that the menu is locked and it will not open until you go back. How can I lock the menu?
You could simply change the onplayerconnect and onplayerspawn to a different name (In your gamemode), then the menu wont be called with the gamemode. :smile: I've had this problem before. If you need anymore help, message me on skype "ryan.fout1" ill be happy to help. <3 :smile:
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,093
Reaction score
2,881
Points
1,103
You could simply change the onplayerconnect and onplayerspawn to a different name (In your gamemode), then the menu wont be called with the gamemode. :grinning: I've had this problem before. If you need anymore help, message me on skype "ryan.fout1" ill be happy to help. <3 :grinning:
Thank you :smile:
 
Top