AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change the number of maps in a map vote (https://forums.alliedmods.net/showthread.php?t=129782)

ghostofmybrain 06-16-2010 18:41

Change the number of maps in a map vote
 
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

Code:

new g_voteCount[4]
and made it

Code:

new g_voteCount[6]
Then I also found

Code:

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

Code:

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

Re: Change the number of maps in a map vote
 
Try
PHP Code:

public checkVotes()
{
 new 
best 0
 
 
if (!g_yesNoVote)
 {
  for (new 
04; ++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:
PHP Code:

public checkVotes()
{
 new 
best 0
 
 
if (!g_yesNoVote)
 {
  for (new 
06; ++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
PHP Code:

if (argc 5argc 

:arrow:
PHP Code:

if (argc 7argc 


ghostofmybrain 06-16-2010 19:13

Re: Change the number of maps in a map vote
 
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

Re: Change the number of maps in a map vote
 
2 Attachment(s)
Try this:

Fixed and Tested.

ghostofmybrain 06-16-2010 21:12

Re: Change the number of maps in a map vote
 
That didn't work either.

fysiks 06-16-2010 22:40

Re: Change the number of maps in a map vote
 
Quote:

Originally Posted by ghostofmybrain (Post 1211010)
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

Re: Change the number of maps in a map vote
 
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

Re: Change the number of maps in a map vote
 
Quote:

Originally Posted by ghostofmybrain (Post 1211064)
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

Re: Change the number of maps in a map vote
 
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

Re: Change the number of maps in a map vote
 
Quote:

Originally Posted by ghostofmybrain (Post 1211108)
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.


All times are GMT -4. The time now is 14:48.

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