Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Coinflip v1.0
- Usage:
- !coinflip [points]
- Command:
- $overwritefile("C:\xampp\htdocs\ankhbot\coinflip.txt","")
- $readapi(http://localhost:8080/ankhbot/coinflip.php?input=$dummyormsg&user=$user)
- $readline(C:\xampp\htdocs\ankhbot\coinflip.txt)
- */
- if (isset($_GET['input']) && isset($_GET['user'])) {
- $input = (int) $_GET['input'];
- $user = $_GET['user'];
- $command = '';
- $msg = '';
- if ($input <= 0) {
- $msg .= '/w ' . $user . ' Usage: !coinflip <points> (min: 1)';
- } else {
- // Remove the bet from the user.
- $command .= '$removepoints("' . $user . '","' . $input . '","' . $input . '","","/w ' . $user . ' You do not have ' . $input . ' points. FeelsBadMan","false")';
- if (mt_rand(0, 1) == 1) {
- // Player wins.
- $msg .= $user . ' won the coin flip and got ' . $input . ' points! PogChamp';
- $command .= '$addpoints("' . $user . '","' . $input*2 . '","' . $input*2 . '","","")';
- } else {
- // Player lose.
- $msg .= $user . ' lost the coin flip and lost ' . $input . ' points! BibleThump';
- }
- }
- $file = "coinflip.txt";
- $fh = fopen($file, 'w');
- $fw = fwrite($fh, $command . $msg . PHP_EOL);
- fclose($fh);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement