PDA

View Full Version : Change the number of maps in a map vote


ghostofmybrain
06-16-2010, 18:41
I was fooling around with adminvote.sma, trying to make it so that if an admin put up a map vote they could choose more than 4 maps for the vote.

Now, I have absolutely no knowledge of amx scripting. I was just messing around with it, and trying to logically figure out what things I would need to change, and try to find all the instances where these things were referenced. But the bottom line is I have no idea what I'm doing.

I found

new g_voteCount[4]

and made it

new g_voteCount[6]

Then I also found

g_validMaps = 0
g_optionName[0][0] = 0
g_optionName[1][0] = 0
g_optionName[2][0] = 0
g_optionName[3][0] = 0

and changed it to

g_validMaps = 0
g_optionName[0][0] = 0
g_optionName[1][0] = 0
g_optionName[2][0] = 0
g_optionName[3][0] = 0
g_optionName[4][0] = 0
g_optionName[5][0] = 0


It compiled fine, but when I tried to pull up a map vote it didn't do anything different. I was still limited to four maps.

Can somebody point me in the right direction for editting this?

edgaras85
06-16-2010, 18:52
Try
public checkVotes()
{
new best = 0

if (!g_yesNoVote)
{
for (new a = 0; a < 4; ++a)
if (g_voteCount[a] > g_voteCount[best])

best = a
}
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
:arrow:
public checkVotes()
{
new best = 0

if (!g_yesNoVote)
{
for (new a = 0; a < 6; ++a)
if (g_voteCount[a] > g_voteCount[best])

best = a
}
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3] + g_voteCount[4] + g_voteCount[5]

and
if (argc > 5) argc = 5
:arrow:
if (argc > 7) argc = 7

ghostofmybrain
06-16-2010, 19:13
That gave me some errors:

(260) : error 032: array index out of bounds (variable "g_optionName")
(261) : error 032: array index out of bounds (variable "g_optionName")
(344 -- 346) : error 047: array sizes do not match, or destination array is too small
(439 -- 440) : error 047: array sizes do not match, or destination array is too small
(570 -- 572) : error 047: array sizes do not match, or destination array is too small



So I tried editting new g_optionName[4][64] to new g_optionName[6][64]

And every time I saw g_voteCount = {0, 0, 0, 0,} I changed it to g_voteCount = {0, 0, 0, 0, 0, 0}


It compiled that time, but still doesn't allow me to vote for more than 4 maps.

Also, I have no idea what I was doing, I was just changing the lines where it told me there was an error, lol.

fysiks
06-16-2010, 19:48
Try this:

Fixed and Tested.

ghostofmybrain
06-16-2010, 21:12
That didn't work either.

fysiks
06-16-2010, 22:40
That didn't work either.

What doesn't work about it? Does it compile for you? Are there any errors in the logs? You need to be specific, we can't read your mind.

ghostofmybrain
06-16-2010, 22:55
I mean I put your plugin on the server and it still does not allow me to choose more than four maps.

fysiks
06-17-2010, 00:15
I mean I put your plugin on the server and it still does not allow me to choose more than four maps.

According to my testing you are lying to me (kind of). It shows the maps in the vote perfectly fine! And, it works perfectly fine if you choose one of the first 4 options. The only thing that doesn't work is a vote for maps 5 or 6.

It works perfect now.

ghostofmybrain
06-17-2010, 00:21
Maybe you uploaded the wrong thing? I put your plugin from post 4 onto the server (and I recompile the code, both cause the same thing to happen), choose "Vote for new map" in the amxmodx menu, and I cannot put up any maps beyond 4. Once I get to four, every single other map gets greyed out and the only option I can choose is to start the vote. I tested it on my linux server and on my windows server, so I'm not sure why it's working for you but not for me. :(

fysiks
06-17-2010, 00:29
Maybe you uploaded the wrong thing? I put your plugin from post 4 onto the server (and I recompile the code, both cause the same thing to happen), choose "Vote for new map" in the amxmodx menu, and I cannot put up any maps beyond 4. Once I get to four, every single other map gets greyed out and the only option I can choose is to start the vote. I tested it on my linux server and on my windows server, so I'm not sure why it's working for you but not for me. :(

That would be because the amx_votemapmenu command (the command used by amxmodmenu)is NOT in adminvote.sma. This is the first time you've mentioned using a menu.

ghostofmybrain
06-17-2010, 00:51
That would be because the amx_votemapmenu command (the command used by amxmodmenu)is NOT in adminvote.sma. This is the first time you've mentioned using a menu.
Well, like I said, I'm really new at this. I didn't mention it because I didn't know it was pertinent, but I can see you're getting frustrated at my noobishness. So I appologize for wasting your time, and thank you for helping me narrow down my question better.


Does anybody know which .sma to edit to change the fact that when I pull up a map vote through the amx menu it only allows me to vote for four maps? Once I can find where it is, I'll try to look around and fix it on my own (best way to learn, IMO), but if I can't figure it out I'll post for more help. :D

fysiks
06-17-2010, 00:53
mapsmenu.sma

ghostofmybrain
06-17-2010, 19:18
According to my testing you are lying to me (kind of). It shows the maps in the vote perfectly fine! And, it works perfectly fine if you choose one of the first 4 options. The only thing that doesn't work is a vote for maps 5 or 6.

It works perfect now.

Ok, I editted the mapsmenu to allow me to choose 6 instead of 4 maps through the amxmodmenu vote for maps menu, but I'm getting this same problem - any vote for map 5 or map 6 isn't registered.

This is what I have:

fysiks
06-17-2010, 19:43
Line 60, change 527 to MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|M ENU_KEY_5|MENU_KEY_6

ghostofmybrain
06-17-2010, 21:27
Now options 5 and 6 cancel the vote.

fysiks
06-17-2010, 21:42
Line 181, change 3 to 5.

ghostofmybrain
06-17-2010, 21:46
Ohhh, I thought that might have been the case, but I was confused about how it was > 3 instead of > 4, so I wrote it off as being unrelated.

It works perfectly now, thanks for the help!

By the way, what did the 527 I editted out of line 60 mean?

fysiks
06-18-2010, 00:04
By the way, what did the 527 I editted out of line 60 mean?

527 = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|M ENU_KEY_0

When I did adminvote.sma for you it proved to me that I needed to add the extra keys to the original registering of the menu so that it would send those keystrokes through to the function that handles the menu.

So, only keys 1, 2, 3, 4 and 0 are sent through to the handling function when using 527.

Hectik17
03-13-2017, 15:05
I dont mean to raise the dead but how could i have more that 4 maps in a cfg file execing this

Amx_votemaps map1 map2 map3 map4

Is there a easy way to let it have more than 4 maps? I need a list at the end of a pug to have all oug maps, and not be restricted to 4.

Atm i have to use two seperate cfgs.