- Joined
- Nov 21, 2012
- Messages
- 835
title looks silly but it isn't as easy as it seems ;]
I have bunch if integers data, after players click dialog button /multiplayer game/
so the result can be for example:
example1
VoteFor[0] = 0, VoteFor[1] = 1, VoteFor[2] = 0, VoteFor[3] = 2
VoteFor[4] = 0, VoteFor[5] = 0, VoteFor[6] = 0, VoteFor[7] = 0
VoteFor[11] = 0
example2
VoteFor[0] = 1, VoteFor[1] = 2, VoteFor[2] = 2, VoteFor[3] = 0
VoteFor[4] = 0, VoteFor[5] = 0, VoteFor[6] = 0, VoteFor[7] = 0
VoteFor[11] = 0
example3
VoteFor[0] = 1, VoteFor[1] = 2, VoteFor[2] = 1, VoteFor[3] = 0
VoteFor[4] = 0, VoteFor[5] = 0, VoteFor[6] = 0, VoteFor[7] = 0
VoteFor[11] = 3
what I need is function that returns player "winner's" id ( value in [] )
or
'-1' if there's no winner
so:
from example1 it should return '3' (Player(3) is a winner)
from example2 it should return '-1' (no winner)
from example3 it should return '11'
I have bunch if integers data, after players click dialog button /multiplayer game/
VoteFor[0] //- number of votes for red player
VoteFor[1] //- number of votes for blue player
.....
VoteFor[7] //- number of votes for pink player
VoteFor[11] //- numer of votes for "close system"
so the result can be for example:
example1
VoteFor[0] = 0, VoteFor[1] = 1, VoteFor[2] = 0, VoteFor[3] = 2
VoteFor[4] = 0, VoteFor[5] = 0, VoteFor[6] = 0, VoteFor[7] = 0
VoteFor[11] = 0
example2
VoteFor[0] = 1, VoteFor[1] = 2, VoteFor[2] = 2, VoteFor[3] = 0
VoteFor[4] = 0, VoteFor[5] = 0, VoteFor[6] = 0, VoteFor[7] = 0
VoteFor[11] = 0
example3
VoteFor[0] = 1, VoteFor[1] = 2, VoteFor[2] = 1, VoteFor[3] = 0
VoteFor[4] = 0, VoteFor[5] = 0, VoteFor[6] = 0, VoteFor[7] = 0
VoteFor[11] = 3
what I need is function that returns player "winner's" id ( value in [] )
or
'-1' if there's no winner
so:
from example1 it should return '3' (Player(3) is a winner)
from example2 it should return '-1' (no winner)
from example3 it should return '11'