Forum

ASSIST, AMERICA'S ARMY COMMUNITY


Author Topic: mapvote  (Read 4115 times)

0 Members and 1 Guest are viewing this topic.

Offline 82nd_DXO_COL=Shad

mapvote
« on: Tuesday, June 24, 2014, 12:51:49 PM »
mapvote is unusable in a server.  It's primary bug is that it allows 1 player to change the map by spamming 'YES'.  It does not seem to ignore a player within the vote time after they have specified 'YES' or 'NO' or asked for a map vote.  That may not be the actual case, if indeed it only allows one vote per player per timer, but somehow 1 or 2 players in a populated server are able to do it, and there is no feedback from the server.
The other problem is that you cannot list the map names.  Experienced players might know what they are, but they do not allow for a truly public browsing of the map choices.
I suggest you keep an array of playernames with their vote choice, as well as where they are at in a list command (as there are a lot of map names) that resets with the timer as well as some feedback to the player who has already started a mapvote.
If you need help I can code unrealscript and have access to crusade's original mapvote for 2.5

Offline ELiZ

Re: mapvote
« Reply #1 on: Tuesday, June 24, 2014, 19:36:02 PM »
A maplist would not fit into the chat window.

This is the check for how many votes are required, I see nothing wrong with it:
Code: [Select]
MvVotesRequired = Level.Game.GetNumPlayers() / 2 + 1;
Playername is already saved and checked against:

Code: [Select]
class MVHandler extends BroadcastHandler HideCategories(Movement,Collision,Lighting,LightColor,Karma,Force);

var array<string> Voters;
var int iRequiredVotes;

function BroadcastText (PlayerReplicationInfo SenderPRI, PlayerController Receiver, string Msg, name Type)
{
if ((SenderPRI.PlayerName == Receiver.PlayerReplicationInfo.PlayerName) && (Caps(Msg) == "YES") && CheckCanVote(SenderPRI.PlayerName))
{
Voters.Length = Voters.Length + 1;
Voters[Voters.Length - 1] = SenderPRI.PlayerName;
Level.Game.BroadcastHandler.Broadcast(None, SenderPRI.PlayerName $ " has added their vote for a map change! [" $ string(Voters.Length) $ "/" $ string(iRequiredVotes) $ "]");
  }
else
{
    Super.BroadcastText(SenderPRI,Receiver,Msg,Type);
  }
}

function bool CheckCanVote (string PlayerName)
{
local int i;

i = 0;

if ( i < Voters.Length )
{
if ( PlayerName == Voters[i] )
{
return False;
}
    i++;
}
return True;
}
« Last Edit: Tuesday, June 24, 2014, 19:37:58 PM by ELiZ »

Offline KiLLaMaN

Re: mapvote
« Reply #2 on: Tuesday, June 24, 2014, 19:53:47 PM »
A maplist would not fit into the chat window.

This is the check for how many votes are required, I see nothing wrong with it:
Code: [Select]
MvVotesRequired = Level.Game.GetNumPlayers() / 2 + 1;
Playername is already saved and checked against:

Code: [Select]
class MVHandler extends BroadcastHandler HideCategories(Movement,Collision,Lighting,LightColor,Karma,Force);

var array<string> Voters;
var int iRequiredVotes;

function BroadcastText (PlayerReplicationInfo SenderPRI, PlayerController Receiver, string Msg, name Type)
{
if ((SenderPRI.PlayerName == Receiver.PlayerReplicationInfo.PlayerName) && (Caps(Msg) == "YES") && CheckCanVote(SenderPRI.PlayerName))
{
Voters.Length = Voters.Length + 1;
Voters[Voters.Length - 1] = SenderPRI.PlayerName;
Level.Game.BroadcastHandler.Broadcast(None, SenderPRI.PlayerName $ " has added their vote for a map change! [" $ string(Voters.Length) $ "/" $ string(iRequiredVotes) $ "]");
  }
else
{
    Super.BroadcastText(SenderPRI,Receiver,Msg,Type);
  }
}

function bool CheckCanVote (string PlayerName)
{
local int i;

i = 0;

if ( i < Voters.Length )
{
if ( PlayerName == Voters[i] )
{
return False;
}
    i++;
}
return True;
}
I can verify that the mapvote counts the same player voting twice. A while back we had a full server on PCR (82nd server I believe) and these 2 idiots came into the server and voted it to Urban(or mout?) with just the two of them. Unless that was a different map vote mod, it's definitely broken.

Offline teddy_grizzly_bear

  • Used to be known as nobody
  • Administrator
  • Epic Poster
  • *
  • Posts: 4,847
  • what are you looking at?
    • View Profile
  • AA: teddy_grizzIy_bear
Re: mapvote
« Reply #3 on: Tuesday, June 24, 2014, 20:35:25 PM »
I can verify that the mapvote counts the same player voting twice. A while back we had a full server on PCR (82nd server I believe) and these 2 idiots came into the server and voted it to Urban(or mout?) with just the two of them. Unless that was a different map vote mod, it's definitely broken.
I, too can verify that I can vote twice for one map if I want to.


"Mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true." Bertrand Russell

Offline ELiZ

Re: mapvote
« Reply #4 on: Tuesday, June 24, 2014, 21:44:01 PM »
When you say "spam", what interval does that mean?
Does it work with normal chat speed, or do they have use some type of bind?

Does it say "X has added their vote for a map change!" for all the votes a single player casts?
A screenshot of log file would be valuable for that.


Offline KiLLaMaN

Re: mapvote
« Reply #5 on: Wednesday, June 25, 2014, 00:08:50 AM »
When you say "spam", what interval does that mean?
Does it work with normal chat speed, or do they have use some type of bind?

Does it say "X has added their vote for a map change!" for all the votes a single player casts?
A screenshot of log file would be valuable for that.


na, it's not a bind. They just type "yes", then open up the console and hit the up arrow and enter to enter "yes" again. All that the server does is say the updated total of the vote. like, "vote the switch to [insertmap] x/needed" It goes up by one every time the player types "yes", regardless if they already voted or not.

I would try to get a screenshot but I don't know of any server that still uses the mod due to this very problem.

Offline 82nd_DXO_COL=Shad

Re: mapvote
« Reply #6 on: Wednesday, June 25, 2014, 00:28:33 AM »
Voters is the string array that is checked for a playername already voting and the number of votes YES
CheckCanVote()  should return false is a player has already voted, so....Maybe there is an issue with SenderPRI.PlayerName in BroadcastText() being different each time, or maybe Voters is not getting reset.  Perhaps it is filling up over time. As a precaution maybe clear out Voters in CancelMapVote().  That would reset the Voters list every timer/mapvote

Technically enough players joining the server and saying YES while the vote is in progress can tip the vote as all this method does is just count 'YES's between different player names.

Log of that particular night on PCR with KillaMan (about 12-16 in server):
Quote
[05/05/2014 01:08:49]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:08:53]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:09:07]   [email protected]   [ASSAULT SOUTH] yes
[05/05/2014 01:09:40]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:09:54]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:00]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:02]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:07]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:07]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:09]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:12:36]   Far_Side   [ASSAULT SOUTH] why do people always gotta F u c k it up
[05/05/2014 01:12:40]   [SWISS]t3ddy   [ASSAULT NORTH] good way to empty the server I guess...
« Last Edit: Wednesday, June 25, 2014, 01:23:55 AM by 82nd_DXO_COL=Shad »

Offline Ganja

Re: mapvote
« Reply #7 on: Wednesday, June 25, 2014, 02:42:46 AM »
About the map list being too big, perhaps you can split it up in different kind of maps so it would fit?

Like SF maps, lng range etc etc

Offline [SWISS]Merlin

Re: mapvote
« Reply #8 on: Wednesday, June 25, 2014, 04:13:25 AM »
map voting at all has a problem.

you as a player can say mapvote xxx  while doing so and if you do it again while the voting process is ongoing, you will "destroy" the whole mapvote process until a new restart of the server is done.
it will not work anymore, thats a fact. you can try that on the swiss servers (maybe there are different vesions about mapvote, don't know - but doing this above will NOT change the map at all)

edit:
and for the maplist: i think a solution could be to show it up at aao25.com - maplist - mapsnames to vote for (i do have it already, i will send the link if needed)
« Last Edit: Wednesday, June 25, 2014, 04:22:00 AM by [SWISS]Merlin »

Offline teddy_grizzly_bear

  • Used to be known as nobody
  • Administrator
  • Epic Poster
  • *
  • Posts: 4,847
  • what are you looking at?
    • View Profile
  • AA: teddy_grizzIy_bear
Re: mapvote
« Reply #9 on: Wednesday, June 25, 2014, 04:55:56 AM »
I looked at the code and to me it seems like it's only checking if the player's name matches the first one in the array Voters (on the 0th position). While I'm not really familiar with the syntax, there doesn't seem to be a loop that would force it to check all names in Voters. It checks the 0th position and then adds 1 to i, but doesn't repeat the check with the next position.


"Mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true." Bertrand Russell

Offline ELiZ

Re: mapvote
« Reply #10 on: Wednesday, June 25, 2014, 08:49:51 AM »
I looked at the code and to me it seems like it's only checking if the player's name matches the first one in the array Voters (on the 0th position). While I'm not really familiar with the syntax, there doesn't seem to be a loop that would force it to check all names in Voters. It checks the 0th position and then adds 1 to i, but doesn't repeat the check with the next position.

Look like you are right.

Current version of the mapvote mod was based of a decompile of the original mod.

A correct version would be:
Code: [Select]
function bool CheckCanVote (string PlayerName)
{
local int i;

for( i=0; i< Voters.Length; i++ )
{
if ( PlayerName == Voters[i] )
{
return False;
}
}
return True;
}
« Last Edit: Wednesday, June 25, 2014, 08:54:20 AM by ELiZ »

Offline teddy_grizzly_bear

  • Used to be known as nobody
  • Administrator
  • Epic Poster
  • *
  • Posts: 4,847
  • what are you looking at?
    • View Profile
  • AA: teddy_grizzIy_bear
Re: mapvote
« Reply #11 on: Wednesday, June 25, 2014, 09:09:32 AM »
Yay! I was good for something! :D


"Mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true." Bertrand Russell

Offline [SWISS]Merlin

Re: mapvote
« Reply #12 on: Wednesday, June 25, 2014, 09:10:47 AM »
nice!
ELiZ, is there any way to correct that?
would be great...

Offline Ganja

Re: mapvote
« Reply #13 on: Wednesday, June 25, 2014, 11:26:16 AM »
He just did, didn't he?

Offline teddy_grizzly_bear

  • Used to be known as nobody
  • Administrator
  • Epic Poster
  • *
  • Posts: 4,847
  • what are you looking at?
    • View Profile
  • AA: teddy_grizzIy_bear
Re: mapvote
« Reply #14 on: Wednesday, June 25, 2014, 12:33:54 PM »
He just did, didn't he?
He's yet to implement it into the game I believe, but in general, the bug should be fixed by what ELiZ wrote.

But the part where you're allowed to start another mapvote while one is already under way, would need some additional work.


"Mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true." Bertrand Russell

 

Download Assist

×

Download Game Client


Download Server Manager