I was thinking that you could check if a user has 5 votes and if so update the user table.
When someone clicks "vote" it'll check if any of the battlers have 5 votes. When one of the two does get five votes it will update the user and poll tables.
If you want to know about a particular code you can ask.
This is untested
PHP Code:
$poll = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "thread as thread
LEFT JOIN " . TABLE_PREFIX . "poll as poll ON (thread.pollid = poll.pollid)
WHERE thread.forumid = 5 AND pollid = '8' ");
$votes = explode("|||", $poll['votes']);
$options = explode("|||", $poll['options']);
foreach($votes as $vote => $num)
{
if($num >= 5)
{
$tallyvotes = $vote;
}
else
{
$tallyvotes = NULL;
}
}
if($tallyvotes)
{
foreach($options as $value => $player)
{
if($value == $tallyvotes)
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET wins = '".$vbulletin->userinfo['wins']." + 1' WHERE username = '$player' ");
}
else
{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET losses = '".$vbulletin->userinfo['losses']." + 1' WHERE username = '$player' ");
}
}
$db->query_write("UPDATE " . TABLE_PREFIX . "poll SET active = '0' WHERE pollid = '$poll[pollid]' ");
}