'; if (getInfo(id,pots,"WHERE creator='$userId'")) { $mode = $_POST['mode']; if ($mode == "disable") { $noraise = getInfo(noraise,pots,"WHERE creator='$userId'"); if ($noraise) $query = "UPDATE pots SET noraise='' WHERE creator='$userId'"; else $query = "UPDATE pots SET noraise='noraise' WHERE creator='$userId'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully '; if ($noraise) echo 'enabled'; else echo 'disabled'; echo ' raising.
'; echo '
'; echo '
'; } if ($mode == "drop") { $users = explode('.',getInfo(users,pots,"WHERE creator='$userId'")); $bets = explode('.',getInfo(bets,pots,"WHERE creator='$userId'")); $user = $_POST['user']; $username = getInfo(username,users,"WHERE id='$user'"); $position = position($user,$users); $bet = $bets[$position]; unset($users[$position]); unset($bets[$position]); $extra = getInfo(extra,pots,"WHERE creator='$userId'"); $extra += $bet; $query = "UPDATE pots SET extra='$extra' WHERE creator='$userId'"; mysql_query($query); $users = implode('.',$users); $bets = implode('.',$bets); $query = "UPDATE pots SET users='$users' WHERE creator='$userId'"; mysql_query($query); $query = "UPDATE pots SET bets='$bets' WHERE creator='$userId'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully dropped '.$username.'.
'; echo '
'; echo '
'; } if ($mode == "winner") { $winner = $_POST['winner']; $winnerName = getInfo(username,users,"WHERE id='$winner'"); $users = explode('.',getInfo(users,pots,"WHERE creator='$userId'")); $bets = explode('.',getInfo(bets,pots,"WHERE creator='$userId'")); $allin = explode('.',getInfo(allin,pots,"WHERE creator='$userId'")); $max = count($bets); $total = 0; for ($i = 0;$i < $max;$i++) { $total += $bets[$i]; } $total += getInfo(extra,pots,"WHERE creator='$userId'"); if ($winner == "all") { $each = truncate($total / $max); for ($i = 0;$i < $max;$i++) { $user = $users[$i]; $username = getInfo(username,users,"WHERE id='$user'"); $money = getInfo(money,users,"WHERE id='$userId'"); $money += $each; $query = "UPDATE users SET money='$money' WHERE id='$userId'"; mysql_query($query); sendMessage($username,"Gambling","You have won $each gold.","God"); } $query = "DELETE FROM pots WHERE creator='$userId'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully dispersed the winnings among all the remaining players.
'; echo '
'; echo '
'; } elseif (inArray($winner,$allin)) { $position = position($winner,$users); $bet = $bets[$position]; $current = getInfo("current",pots,"WHERE creator='$userId'"); $winnings = truncate(($current / $bet) * $total); $extra = 0 - $winnings; $money = getInfo(money,users,"WHERE id='$winner'"); $money += $winnings; $query = "UPDATE users SET money='$money' WHERE id='$winner'"; mysql_query($query); $query = "UPDATE pots SET extra='$extra' WHERE creator='$userId'"; mysql_query($query); sendMessage($winnerName,"Gambling","You have won $winnings gold.","God"); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully given '.$winnerName.'. There is still '.($total - $winnings).' gold left to disperse.
'; echo '
'; echo '
'; } else { $money = getInfo(money,users,"WHERE id='$winner'"); $money += $total; $query = "UPDATE users SET money='$money' WHERE id='$winner'"; mysql_query($query); $query = "UPDATE pots SET extra='$extra' WHERE creator='$userId'"; mysql_query($query); $query = "DELETE FROM pots WHERE creator='$userId'"; mysql_query($query); sendMessage($winnerName,"Gambling","You have won $total gold.","God"); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully given '.$winnerName.' the gold.
'; echo '
'; echo '
'; } } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Gambling Pot Control Panel
'; echo '
'; echo '
In order to control small gambling games, you can create pots, into which players can throw the money that they bet while playing. As the creator, however, you will be held responsible for giving the winner(s) their dues.
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Money Handling
'; echo '
'; echo '
'; echo 'Here, you may choose who won the bout. In some cases, when you choose a winner, money may still be left over - this will happen in the case that the winner could not meet all of the bets, despite putting all of their money into the pot. Because of this, they would only receive a fraction of the total winnings, while the rest would go to a runner-up. If it comes to a tie between all the players, you can choose to split the winnings between them all.

'; echo '
'; echo 'Winner :

'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Current Users
'; echo '
'; $users = explode('.',getInfo(users,pots,"WHERE creator='$userId'")); if (count($users) > 0) { $max = count($users); echo ''; for ($i = 0;$i < $max; $i++) { $user = $users[$i]; $username = getInfo(username,users,"WHERE id='$user'"); echo ''; echo ''; echo ''; echo ''; } echo '
'.$username.'
'; } else { echo '
No one has joined this pot.
'; } echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
You must have an open gambling pot to view this.
'; echo '
'; echo '
'; } echo ''; include "index-bottom.php" ?>