Raised This Month: $51 Target: $400
 12% 

Lock Menu Keys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 07-17-2018 , 22:09   Lock Menu Keys
Reply With Quote #1

Hello,

I'd like to be able to lock the menu keys after someone has voted (so the menu wouldnt react at all).
Any ideas? I'm using galileo btw.

Code:
		for (new choiceIdx = 0; choiceIdx < g_choiceCnt; ++choiceIdx)
		{
			voteCnt = g_mapVote[choiceIdx];
			vote_getTallyStr(voteTally, sizeof(voteTally)-1, voteCnt);
			
			if(g_vote[0] == 0)
			charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \w%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
			else
			charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \d%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
			keys |= (1<<choiceIdx);
		}

Last edited by wAyz; 07-17-2018 at 22:10.
wAyz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2018 , 00:17   Re: Lock Menu Keys
Reply With Quote #2

I thought galileo already had a workaround for that (effectively allowing the vote results to stay up without preventing people from changing weapons). If you could actually block the keys then people wouldn't be able to switch weapons since the same commands are used for both weapon slots and menu keys.
__________________

Last edited by fysiks; 07-18-2018 at 00:19.
fysiks is offline
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 07-18-2018 , 02:47   Re: Lock Menu Keys
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
I thought galileo already had a workaround for that (effectively allowing the vote results to stay up without preventing people from changing weapons). If you could actually block the keys then people wouldn't be able to switch weapons since the same commands are used for both weapon slots and menu keys.
That's correct. In my case it's not THAT much of a deal though because I'm running a KZ Server where you basically only use 2 weapons. I will think about it once again but I'd still like to know what i'd have to do to make it work.
Code:
if(g_vote[0] == 0)
{
	charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \w%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
	keys |= (1<<choiceIdx);
}
else
{
	charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \d%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
	keys |= (0<<choiceIdx);
}
I actually tried this already but it seems to be incorrect since it blocks everything from start of the vote already.

Last edited by wAyz; 07-18-2018 at 02:51.
wAyz is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-18-2018 , 02:56   Re: Lock Menu Keys
Reply With Quote #4

I don't know what gallileo is ( can't lookup atm ).

But if you wan't to lock the menu keys in the old menu system ( make them unusable ), it's as simple as not adding the specific key to the keys bitsum
Code:
keys |= (1<<choiceIdx);
Just delete it.

What fysiks said is a different story, but guess you don't need that
__________________
stuff

Last edited by maqi; 07-18-2018 at 02:56.
maqi is offline
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 07-18-2018 , 03:02   Re: Lock Menu Keys
Reply With Quote #5

Quote:
Originally Posted by maqi View Post
I don't know what gallileo is ( can't lookup atm ).

But if you wan't to lock the menu keys in the old menu system ( make them unusable ), it's as simple as not adding the specific key to the keys bitsum
Code:
keys |= (1<<choiceIdx);
Just delete it.

What fysiks said is a different story, but guess you don't need that
Well thanks but I guess I've tried this aswell already but it doesnt really work as intended.

Code:
if(g_vote[0] == 0)
{
	charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \w%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
	keys |= (1<<choiceIdx);
}
else
{
	charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \d%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
}
wAyz is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-18-2018 , 03:12   Re: Lock Menu Keys
Reply With Quote #6

Explain what happens, because it's the right solution ( If we are thinking about the same thing )

Edit: Are you sure
Code:
g_vote[0] == 0
Is the right condition to check for, I guess it would be something like
Code:
!g_vote[index]
Not sure since i didn't see the code and don't know what it does.
__________________
stuff

Last edited by maqi; 07-18-2018 at 03:24.
maqi is offline
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 07-18-2018 , 03:37   Re: Lock Menu Keys
Reply With Quote #7

Quote:
Originally Posted by maqi View Post
Explain what happens, because it's the right solution ( If we are thinking about the same thing )

Edit: Are you sure
Code:
g_vote[0] == 0
Is the right condition to check for, I guess it would be something like
Code:
!g_vote[index]
Not sure since i didn't see the code and don't know what it does.
yes it is, because the menu keys go grey right after i lock in a vote.

Code:
if(g_vote[0] == 0)
{
	charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \w%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
	keys |= (1<<choiceIdx);
}
else
charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt, "^n%s%i. \d%s%s", CLR_RED, choiceIdx+1, g_mapChoice[choiceIdx], voteTally);
It should work like inteded, but there's something else making the menu work again after i lock in a vote. Gotta figure out what exactly.

Last edited by wAyz; 07-18-2018 at 03:41.
wAyz is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-18-2018 , 03:56   Re: Lock Menu Keys
Reply With Quote #8

Well without the code, I can't help you any further. I can tell you that only way that can happen is if a new menu has been created/shown.

Then again, check for your condition, debug it a bit, just because it worked in a specific situation doesn't mean it's the right answer.
__________________
stuff
maqi is offline
Old 07-18-2018, 03:58
wAyz
This message has been deleted by wAyz.
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 07-18-2018 , 04:01   Re: Lock Menu Keys
Reply With Quote #9

It's not a small plugin since it's a whole map manager, but if you have the patience helping me i'll just post it.
Attached Files
File Type: sma Get Plugin or Get Source (galileo.sma - 408 views - 73.9 KB)
wAyz is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-18-2018 , 04:02   Re: Lock Menu Keys
Reply With Quote #10

PHP Code:
if(g_vote[0] == 0)
charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt"^n%s%i. \w%s%s"CLR_REDchoiceIdx+1g_mapChoice[choiceIdx], voteTally);
else
charCnt += formatex(voteStatus[charCnt], sizeof(voteStatus)-1-charCnt"^n%s%i. \d%s%s"CLR_REDchoiceIdx+1g_mapChoice[choiceIdx], voteTally);
keys |= (1<<choiceIdx); 
adding keys to the bitsum is not under the if/else statement, it's outside of it. Therefore it will always be set, the only thing that changes is the color \w to \d ( put it in the curly brackets together under the right condition )
__________________
stuff

Last edited by maqi; 07-18-2018 at 04:05.
maqi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode