= 5) { if($CharacterInfo['money'] >= $theBet) { $winnings = ceil($theBet * 1.2); $winningsText = format($winnings); $coin = mt_rand(1,1000001); if($coin <= 500000) { $coinText = "heads"; $coin = 1; } elseif($coin <= 1000000) { $coinText = "tails"; $coin = 2; } else { $coinText = "edge"; $coin = 3; } if($coin == (int)$post['call']) { print "Congratulations! you flipped {$coinText} and won yourself {$winningsText} KD!"; updateCharacter("money", "(money + {$winnings})", $CharacterInfo['id']); } elseif($coin != 3) { print "You flipped {$coinText} and did not win! Better luck next time!"; updateCharacter("money", "(money - {$theBet})", $CharacterInfo['id']); } else { $winnings = ceil($theBet * 10000); print "The coin landed on the edge. You just won the jackpot of {$winningsText} KD!!!!"; updateCharacter("money", "(money - {$winnings})", $CharacterInfo['id']); } if($coin < 3) mysql_query("INSERT INTO game_coin_stats (result, thedate) VALUES ('{$coin}', NOW())"); } else print "You don't have enough money for that bet!"; } else print "The bet must be more than 5KD."; } else print "Please only bet with a number."; break; case "rps_throwHand": if(is_numeric($post['bet'])) { $theBet = (int)$post['bet']; if($theBet >= 5) { if($CharacterInfo['money'] >= $theBet) { $winnings = ceil($theBet * 1.4); $PC = mt_rand(1,3); if($PC == 1) $handText = "rock"; elseif($PC == 2) $handText = "paper"; elseif($PC == 3) $handText = "sissors"; $playerCall = (int)$post['call']; $won = false; $lost = false; switch($playerCall) { case 1: // Player did rock if($PC == 1) { print "The computer also played rock. You lose {$theBet} KD."; $lost = true; } elseif($PC == 2) { print "The computer played paper. You lose {$theBet} KD."; $lost = true; } elseif($PC == 3) { print "The computer played sissors. You won {$winnings} KD"; $won = true; } break; case 2: // Player did paper if($PC == 1) { print "The computer played rock. You won {$winnings}!"; $won = true; } elseif($PC == 2) { print "The computer also played paper. You lost {$theBet} KD"; $lost = true; } elseif($PC == 3) { print "The computer played sissors. You lost {$theBet} KD"; $lost = true; } break; case 3: // Player did sissors if($PC == 1) { print "The computer played rock. You lost {$theBet} KD."; $lost = true; } elseif($PC == 2) { print "The computer played paper. You won {$winnings} KD."; $won = true; } elseif($PC == 3) { print "The computer also played sissors. You lost {$theBet} KD"; $lost = true; } break; } if($won) updateCharacter("money", "(money + {$winnings})", $CharacterInfo['id']); elseif($lost) updateCharacter("money", "(money - {$theBet})", $CharacterInfo['id']); mysql_query("INSERT INTO game_rps_stats (result, thedate) VALUES ('{$PC}', NOW())"); } else print "You don't have enough money for that bet!"; } else print "The bet must be more than 5KD"; } else print "Please only bet with a number."; break; case "lottery_buyTicket": if(isset($_POST["balls"])){ $balls = explode("&", urldecode($post_safe['balls'])); if($CharacterInfo['money'] >= 100){ if(count($balls) == 6){ $selBalls = array(); foreach($balls as $ball) { $t_id = explode("=", $ball); $selBalls[] = $t_id[1]; } sort($selBalls); $ticket = implode(",", $selBalls); $sqlCheck = mysql_query("SELECT id FROM game_lottery WHERE user_id = '{$CharacterInfo['id']}' AND ticket = '{$ticket}'"); if($sqlCheck && mysql_num_rows($sqlCheck) == 0) { mysql_query("INSERT INTO game_lottery (user_id, ticket) values ('{$CharacterInfo['id']}', '$ticket')") or print(mysql_error() . " " . __FILE__ . " #" . __LINE__); updateCharacter("money", "(money - 100)", $CharacterInfo['id']); print "Ticket purchased! Your numbers: " . implode(" ", $selBalls) . "
Good luck!"; } else print "It seems you already have a ticket with these numbers!"; } else { print "You can only select 6 balls!"; } } else { print "Please get more money from the bank!"; } } else { print "Please select some balls to use!"; } break; } ?>