
DRAGOON
Members-
Posts
3 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by DRAGOON
-
[mccode v2] 50/50 for money and for crystals
DRAGOON replied to DRAGOON's topic in Free Modifications
Re: 50/50(V2) for money and for crystals now for money 50/50 add this to SQL CREATE TABLE `chance` ( `logID` int( 20 ) NOT NULL AUTO_INCREMENT , `userID` int( 11 ) NOT NULL default '0', `amount` int( 11 ) NOT NULL default '0', `active` tinyint( 1 ) NOT NULL default '0', PRIMARY KEY ( `logID` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1; then create a file called chance.php and add this to it <?php include "globals.php"; $minbet=1; $maxg=10; echo "<big>50 / 50 $ Game</big> "; function add_game() { global $ir,$c,$userid, $db, $minbet, $maxg; if(!isset($_POST['amt'])) { echo "<big>Adding a game</big> <form action='chance.php?add=1' method='post'> Amount $<input type='text' name='amt' size=10 maxlength=10> <input type='submit' value='Add!'></form> ($maxg games max per user) [url='chance.php']Back[/url]"; } else { $_POST['amt'] = abs((int) $_POST['amt']); if($_POST['amt'] < $minbet){echo "The minimum bet is $minbet [url='chance.php?add=1']Back[/url]";exit;} $checkcount=$db->query("SELECT logID FROM chance WHERE userID={$ir['userid']} and active=1"); if($db->num_rows($checkcount) > ($maxg-1)){echo "There is a maximum of $maxg games per user. [url='chance.php']Back[/url]";exit;} if($ir['money'] < $_POST['amt']){echo "You cannot afford that amount. [url='chance.php']Back[/url]";exit;} $db->query("UPDATE users SET money = money - {$_POST['amt']} WHERE userid = {$ir['userid']}"); $ir['money']=$ir['money'] - $_POST['amt']; $db->query("INSERT INTO chance VALUES ('', {$ir['userid']}, {$_POST['amt']}, 1)"); echo "Your game has been set. Good Luck. [url='chance.php']Back[/url]"; } } function view_games() { global $ir,$c,$userid, $db, $maxg; $q=$db->query("SELECT c.*, u.username FROM chance c left join users u on u.userid = c.userID WHERE c.active = 1 ORDER BY c.logID ASC"); echo "[url='chance.php?add=1']Add Game[/url] Table of users awaiting a challenge <table class='table' width=50%><tr><th>Game ID</th><th>User</th><th>Amount</th><th>Challenge</th><th>Cancel</th></tr>"; if($db->num_rows($q) < 1){echo "<tr><td colspan=5>There are currenly no challenges</td></tr>";} while($r=$db->fetch_row($q)) { echo "<tr><td>{$r['logID']}</td><td>[url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userID']}]</td><td>".money_formatter($r['amount'])."</td><td>[url='chance.php?chal={$r[']Challenge[/url]</td><td>"; if($ir['userid']==$r['userID']){echo "[url='chance.php?cancel={$r[']Cancel[/url]";} echo "</td></tr>"; } echo "</table>"; } function dogame() { global $ir,$c,$userid, $db; $_GET['chal'] = abs((int) $_GET['chal']); $q=$db->query("SELECT c.*, u.username from chance c LEFT JOIN users u ON c.userID = u.userid Where c.logID={$_GET['chal']} AND c.active = 1 LIMIT 1"); if($db->num_rows($q) > 0) { $r=$db->fetch_row($q); if($ir['money'] < $r['amount']){echo "You cannot afford the challenge amount. [url='chance.php']Back[/url]";exit;} if($ir['userid'] == $r['userID']){echo "You cannot accept your own challenge. [url='chance.php']Back[/url]";exit;} if(rand(1,2) == 1) { $winner=$r['userID']; $loser=$ir['userid']; $winnername=$r['username']; $losername=$ir['username']; $tstring="Sorry, you Lost. Better luck next time. [url='chance.php']Back[/url]"; $db->query("UPDATE users SET money = money - {$r['amount']} WHERE userid={$ir['userid']}"); $db->query("UPDATE users SET money = money + ({$r['amount']} * 2) WHERE userid={$r['userID']}"); } else { $winner=$ir['userid']; $loser=$r['userID']; $winnername=$ir['username']; $losername=$r['username']; $tstring="You Won! Congratulations! You Won ".money_formatter($r['amount'])." [url='chance.php']Back[/url]"; $db->query("UPDATE users SET money = money + {$r['amount']} WHERE userid={$ir['userid']}"); } event_add($winner, "The game of ".money_formatter($r['amount'])." challenged by [url='viewuser.php?u={$r[']{$r['username']}[/url] was won by [url='viewuser.php?u={$winner}']{$winnername}[/url].", $c); event_add($loser, "The game of ".money_formatter($r['amount'])." challenged by [url='viewuser.php?u={$r[']{$r['username']}[/url] was won by [url='viewuser.php?u={$winner}']{$winnername}[/url].", $c); $db->query("UPDATE chance SET active = 0 WHERE logID={$_GET['chal']}"); echo $tstring; } else { echo "This game has either been cancelled or someone played before you got the chance. [url='chance.php']Back[/url]"; exit; } } function cancel() { global $ir,$c,$userid, $db; $_GET['cancel'] = abs((int) $_GET['cancel']); $q=$db->query("SELECT * from chance where logID={$_GET['cancel']} AND active = 1"); if($db->num_rows($q) > 0) { $r=$db->fetch_row($q); $db->query("UPDATE users SET money = money + {$r['amount']} WHERE userid = {$ir['userid']}"); $ir['money']=$ir['money'] + $r['amount']; $db->query("UPDATE chance SET active = -1 WHERE logID = {$_GET['cancel']}"); echo "The game has been cancelled, and your money has been returned. [url='chance.php']Back[/url]"; } else { echo "This game has already been canceled, does not exist, or someone already played. [url='chance.php']Back[/url]"; } } if(isset($_GET['cancel'])){cancel();} elseif(isset($_GET['chal'])){dogame();} elseif(isset($_GET['add'])){add_game();} else{view_games();} ?> and add this link to explore.php some where [url='chance.php']50/50 $[/url] -
for crystals here add this to SQL CREATE TABLE `tchance` ( `logID` int( 20 ) NOT NULL AUTO_INCREMENT , `userID` int( 11 ) NOT NULL default '0', `amount` int( 11 ) NOT NULL default '0', `active` tinyint( 1 ) NOT NULL default '0', PRIMARY KEY ( `logID` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1; then create a file called 5050.php and add this to it <?php include "globals.php"; $minbet=1; $maxg=10; echo "<big>50 / 50 Crystals Game</big> "; function add_game() { global $ir,$t,$userid, $db, $minbet, $maxg; if(!isset($_POST['amt'])) { echo "<big>Adding a game</big> <form action='5050.php?add=1' method='post'> Amount of crystals:<input type='text' name='amt' size=10 maxlength=10> <input type='submit' value='Add!'></form> ($maxg games max per user) [url='5050.php']Back[/url]"; } else { $_POST['amt'] = abs((int) $_POST['amt']); if($_POST['amt'] < $minbet){echo "The minimum bet is $minbet [url='5050.php?add=1']Back[/url]";exit;} $theckcount=$db->query("SELECT logID FROM tchance WHERE userID={$ir['userid']} and active=1"); if($db->num_rows($theckcount) > ($maxg-1)){echo "There is a maximum of $maxg games per user. [url='5050.php']Back[/url]";exit;} if($ir['crystals'] < $_POST['amt']){echo "You cannot afford that amount. [url='5050.php']Back[/url]";exit;} $db->query("UPDATE users SET crystals = crystals - {$_POST['amt']} WHERE userid = {$ir['userid']}"); $ir['crystals']=$ir['crystals'] - $_POST['amt']; $db->query("INSERT INTO tchance VALUES ('', {$ir['userid']}, {$_POST['amt']}, 1)"); echo "Your game has been set. Good Luck. [url='5050.php']Back[/url]"; } } function view_games() { global $ir,$t,$userid, $db, $maxg; $q=$db->query("SELECT t.*, u.username FROM tchance t left join users u on u.userid = t.userID WHERE t.active = 1 ORDER BY t.logID ASC"); echo "[url='5050.php?add=1']Add Game[/url] Table of users awaiting a challenge <table class='table' width=50%><tr><th>Game ID</th><th>User</th><th>Amount</th><th>Challenge</th><th>Cancel</th></tr>"; if($db->num_rows($q) < 1){echo "<tr><td colspan=5>There are currenly no challenges</td></tr>";} while($r=$db->fetch_row($q)) { echo "<tr><td>{$r['logID']}</td><td>[url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userID']}]</td><td>{$r['amount']}</td><td>[url='5050.php?chal={$r[']Challenge[/url]</td><td>"; if($ir['userid']==$r['userID']){echo "[url='5050.php?cancel={$r[']Cancel[/url]";} echo "</td></tr>"; } echo "</table>"; } function dogame() { global $ir,$t,$userid, $db; $_GET['chal'] = abs((int) $_GET['chal']); $q=$db->query("SELECT t.*, u.username from tchance t LEFT JOIN users u ON t.userID = u.userid Where t.logID={$_GET['chal']} AND t.active = 1 LIMIT 1"); if($db->num_rows($q) > 0) { $r=$db->fetch_row($q); if($ir['crystals'] < $r['amount']){echo "You cannot afford the challenge amount. [url='5050.php']Back[/url]";exit;} if($ir['userid'] == $r['userID']){echo "You cannot accept your own challenge. [url='5050.php']Back[/url]";exit;} if(rand(1,2) == 1) { $winner=$r['userID']; $loser=$ir['userid']; $winnername=$r['username']; $losername=$ir['username']; $tstring="Sorry, you Lost. Better luck next time. [url='5050.php']Back[/url]"; $db->query("UPDATE users SET crystals = crystals - {$r['amount']} WHERE userid={$ir['userid']}"); $db->query("UPDATE users SET crystals = crystals + ({$r['amount']} * 2) WHERE userid={$r['userID']}"); } else { $winner=$ir['userid']; $loser=$r['userID']; $winnername=$ir['username']; $losername=$r['username']; $tstring="You Won! Congratulations! You Won {$r['amount']} crystals. [url='5050.php']Back[/url]"; $db->query("UPDATE users SET crystals = crystals + {$r['amount']} WHERE userid={$ir['userid']}"); } event_add($winner, "The game of {$r['amount']} crystals challenged by [url='viewuser.php?u={$r[']{$r['username']}[/url] was won by [url='viewuser.php?u={$winner}']{$winnername}[/url].", $t); event_add($loser, "The game of {$r['amount']} crystals challenged by [url='viewuser.php?u={$r[']{$r['username']}[/url] was won by [url='viewuser.php?u={$winner}']{$winnername}[/url].", $t); $db->query("UPDATE tchance SET active = 0 WHERE logID={$_GET['chal']}"); echo $tstring; } else { echo "This game has either been cancelled or someone played before you got the 5050. [url='5050.php']Back[/url]"; exit; } } function cancel() { global $ir,$t,$userid, $db; $_GET['cancel'] = abs((int) $_GET['cancel']); $q=$db->query("SELECT * from tchance where logID={$_GET['cancel']} AND active = 1"); if($db->num_rows($q) > 0) { $r=$db->fetch_row($q); $db->query("UPDATE users SET crystals = crystals + {$r['amount']} WHERE userid = {$ir['userid']}"); $ir['crystals']=$ir['crystals'] + $r['amount']; $db->query("UPDATE tchance SET active = -1 WHERE logID = {$_GET['cancel']}"); echo "The game has been cancelled, and your crystals has been returned. [url='5050.php']Back[/url]"; } else { echo "This game has already been canceled, does not exist, or someone already played. [url='5050.php']Back[/url]"; } } if(isset($_GET['cancel'])){cancel();} elseif(isset($_GET['chal'])){dogame();} elseif(isset($_GET['add'])){add_game();} else{view_games();} ?> and add this link to explore.php some where [url='5050.php']50/50 Crystals[/url]
-
Re: [V2]Ranks Mod!!!![V2] it to long here i made it work i give you my word if($r['level'] <=99) { print "Private "; print "[img=rank1.png]"; } else if($r['level'] <=124) { print "Corporal "; print "[img=rank2.png]"; } else if($r['level'] <=149) { print "Sergeant "; print "[img=rank3.png]"; } else if($r['level'] <=174) { print "Sergeant Major "; print "[img=rank4.png]"; } else if($r['level'] <=199) { print "Second Lieutenant "; print "[img=rank5.png]"; } else if($r['level'] <=224) { print "First Lieutenant "; print "[img=rank6.png]"; } else if($r['level'] <=249) { print "Captain "; print "[img=rank7.png]"; } else if($r['level'] <=274) { print "Major "; print "[img=rank8.png]"; } else if($r['level'] <=299) { print "Lieutenant Colonel "; print "[img=rank9.png]"; } else if($r['level'] <=324) { print "Colonel "; print "[img=rank10.png]"; } else if($r['level'] <=349) { print "Brigadier General "; print "[img=rank11.png]"; } else if($r['level'] <=374) { print "Major General "; print "[img=rank12.png]"; } else if($r['level'] <=399) { print "Lieutenant General "; print "[img=rank13.png]"; } else if($r['level'] <=499) { print "General "; print "[img=rank14.png]"; } else if($r['level'] <=749) { print "General of the Army "; print "[img=rank15.png]"; } else if($r['level'] <=999) { print "General of the Armies "; print "[img=rank16.png]"; } else if($r['level'] >=1000) { print "General of {$set['game_name']} "; print "[img=rank17.png]"; } oops i made a mistake but i fix it and now that works