Jump to content
MakeWebGames

CJ - Twitch

Members
  • Posts

    391
  • Joined

  • Last visited

Everything posted by CJ - Twitch

  1. my gDo.php file.. <?php if(!isset($_GET['uStat']) || !isset($_GET['uAmount'])) { echo ('An error has occured, please try again.'); exit; } //DB connections. session_start(); include "mysql.php"; global $c; $is=mysql_query("SELECT * FROM userstats WHERE userid=".$_SESSION['userid']."",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); // $Data = mysql_fetch_array(mysql_query("SELECT `energy`,`will`,`maxenergy` FROM `users` WHERE (`userid` = ".$_SESSION['userid'].")")) or die(mysql_error()); if(!in_array($_GET['uStat'], array('strength','agility','defence','accuracy'))) { echo ('An error has occured, please try again.'); exit; } if(!ctype_digit($_GET['uAmount'])) { echo ('An error has occured, please try again.'); exit; } if($_GET['uAmount'] > $Data['energy']) { echo ('You don\'t have enough energy to train this amount. <span style = "font-size:10px; color: #8B0000;">You have '.number_format($Data['energy']).'/'.number_format($Data['maxenergy']).' energy available</span> '); exit; } if($_GET['uStat'] == strength) { $Gain = (0.0002*$ir['strength'])+(0.00212*$Data['will']+0.55)*$_GET['uAmount']; $NewGain = mt_rand(($Gain * 0.9),($Gain * 1.1)); } elseif($_GET['uStat'] == agility) { $Gain = (0.0002*$ir['agility'])+(0.00212*$Data['will']+0.55)*$_GET['uAmount']; $NewGain = mt_rand(($Gain * 0.9),($Gain * 1.1)); } elseif($_GET['uStat'] == defence) { $Gain = (0.0002*$ir['defence'])+(0.00212*$Data['will']+0.25)*$_GET['uAmount']; $NewGain = mt_rand(($Gain * 0.9),($Gain * 1.1)); } elseif($_GET['uStat'] == accuracy) { $Gain = (0.0002*$ir['strength'])+(0.00212*$Data['will']+0.55)*$_GET['uAmount']; $NewGain = mt_rand(($Gain * 0.9),($Gain * 1.1)); } else { $Gain = "0"; } echo ('<span style = "color:green; font-weight:bold;">You gained '.number_format($NewGain, 4).' '.$_GET['uStat'].' by training '.number_format($_GET['uAmount']).' times.</span> <span style = "font-size:10px; color: #8B0000;">You have '.number_format($Data['energy']).'/'.number_format($Data['maxenergy']).' energy available</span>'); mysql_query("UPDATE `users` SET `energy` = `energy` - ".intval($_GET['uAmount']*5).", `will` = `will` - ".intval($_GET['uAmount'] * 0.2)." WHERE (`userid` = ".$_SESSION['userid'].")"); mysql_query("UPDATE `userstats` SET ".$_GET['uStat']." = ".$_GET['uStat']." + ".$NewGain." WHERE (`userid` = ".$_SESSION['userid'].")"); exit(); ?> Screenie.
  2. I'll take a screenshot..
  3. This mod allows the users Energy to go into minuses.
  4. Works Great. ;)
  5. Awesome work!
  6. I have set it to 0 seconds as I'm on localhost but my hosting has unlimited bandwidth so it will be 2 seconds. I have decided I will be purchasing some of your mods. xD Just been playing about with TTT and made it look a little better. (No offence but the images you bit were crap) Also here is a better screenie if you want to use it.
  7. I actually suggested this before...
  8. I will check it out now. :)
  9. Meh its on local host. :P I will change it when I upload it. :)
  10. Why did you make it to reload every 5 seconds? I've changed it to 1 second or does that use lots of bandwidth?
  11. Its a raw file. :)
  12. Awesome, I'll take a look. :)
  13. Ah, ok. If I buy another game will I get the hall of fame for tic-tac-toe?
  14. Could you please convert this to V1 please? This is what I have so far.   <?php //----------------------------------- // Mod created by Dave Macaulay ([email protected]) // For free use only with Mccodes V2 // For use of mod this must remain intack! //------------------------------------ if(!$_GET['print']) { session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); echo '[b]Bank Account[/b] '; } else { session_start(); require_once "mysql.php"; require_once "global_func.php"; $userid=$_SESSION['userid']; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); $userid = $_SESSION['userid']; $is = mysql_query("SELECT bankmoney,money FROM `users` WHERE `userid` = ".$userid) or die(mysql_error()); $ir = mysql_fetch_array($is); } define('__BANKPRICE__', 5000); define('__THIS__', basename($_SERVER['SCRIPT_FILENAME'])); $_POST['amount'] = abs((int) $_POST['amount']); if($_GET['get_bank']) { echo ($_GET['simple'] ? $ir['bankmoney'] : money_formatter($ir['bankmoney'])); exit; } if($_GET['get_hand']) { echo ($_GET['simple'] ? $ir['money'] : money_formatter($ir['money'])); exit; } if($ir['bankmoney'] < 0) { new_account(); if(!$_GET['print']) { $h->endpage(); } exit; } switch($_GET['a']) { case 'deposit': deposit(); break; case 'withdraw': withdraw(); break; default: index(); break; } function new_account() { global $ir,$c,$c,$userid; if(!$_GET['print']) { ?> <script type="text/javascript"> function openAccount() { var c = confirm("Are you sure you want to open a bank account for <?=money_formatter(__BANKPRICE__)?>?"); if(c) { $('#main_text').html('Opening account... '); $('#main_text').append('Checking you have the correct funds... '); if(<?=$ir['money']?> < <?=__BANKPRICE__?>) { $('#main_text').append('<span style="color: red;">Incorrect funds, You need another <?=money_formatter((__BANKPRICE__)-$ir['money'])?>... '); } else { $.post('<?=__THIS__?>?open=true&print=1', function(data) { if(data == 'not_enough_money') { $('#main_text').append('<span style="color: red;">Incorrect funds... '); } else if(data == 'opened') { $('#main_text').append('<span style="color: green;">You have succesfully opened your brand new bank account!</span> > [url="javascript:void(0);"]View Account[/url]'); } }); } } } function showBank() { $.get('<?=__THIS__?>?print=1', function(data) { $('#main_text').html(data); }); } </script> <?php } if($_GET['open']) { if($ir['money'] < __BANKPRICE__) { echo 'not_enough_money'; exit; } else { mysql_query("UPDATE `users` SET `money` = `money` - ".__BANKPRICE__.", `bankmoney` = 0 WHERE `userid` = ".$userid); echo 'opened'; exit; } } else { echo ' <span id="main_text"> You currently don\'t have a bank account with us, Would you like to open an account for only [i]'.money_formatter(__BANKPRICE__).'[/i]! > [url="javascript:void(0);"]Open an account![/url] </span>'; } } function index() { global $ir,$c,$c,$userid; ?> <script type="text/javascript"> function makeTrans(type) { if(type != 'withdraw' && type != 'deposit') { alert("Script Error!"); } else { var data = $('[name='+type+']'); $.post('<?=__THIS__?>?print=true&a=' + type, { 'amount' : data.val() }, function(data) { $('#' + type + '_callback').html(data); $.post('<?=__THIS__?>?print=true&get_bank=true', function(data) { $('#bank_money').html(data); }); $.post('<?=__THIS__?>?print=true&get_bank=true&simple=true', function(data) { $('[name=withdraw]').val(data); }); $.post('<?=__THIS__?>?print=true&get_hand=true&simple=true', function(data) { $('[name=deposit]').val(data); }); }); } } </script> <?php echo 'You currently have [i]<span id="bank_money">'.money_formatter($ir['bankmoney']).'</span>[/i] in your bank account. You are earning 2% interest on this daily. [url="javascript:void(0);"]> Withdraw[/url] <div id="withdraw" style="background: #ffffd3;border: 1px #ffff99 solid;display: none;padding: 20px;width: 250px;margin: 5px;"> <form action="" method="post" onsubmit="makeTrans(\'withdraw\');return false;"><input type="text" name="withdraw" value="'.($ir['bankmoney'] ? $ir['bankmoney'] : 0).'" /> <input type="submit" value="Withdraw" /></form> <div id="withdraw_callback"> [size="1"]Please select the amount you wish to withdraw then hit the withdraw button next to it.[/size] </div> </div> [url="javascript:void(0);"]> Deposit[/url] <div id="deposit" style="background: #ffffd3;border: 1px #ffff99 solid;display: none;padding: 20px;width: 250px;margin: 5px;"> <form action="" method="post" onsubmit="makeTrans(\'deposit\');return false;"><input type="text" name="deposit" value="'.($ir['money'] ? $ir['money'] : 0).'" /> <input type="submit" value="Deposit" /></form> <div id="deposit_callback"> [size="1"]Please choose the amount of money you wish to store in your account.[/size] </div> </div> '; } function deposit() { global $c,$ir,$c,$userid; if($_POST['amount'] > $ir['money']) { echo '<span style="color:red;">You do not have that much money to deposit!</span>'; } else { $fee = ceil($_POST['amount']*15/100); $fee = ($fee > 3000 ? 3000 : $fee); $gain = $_POST['amount'] - $fee; mysql_query("UPDATE `users` SET `bankmoney` = `bankmoney` + ".$gain.", `money` = `money` - ".$_POST['amount']." WHERE userid=".$userid); echo 'You deposited '.money_formatter($_POST['amount']).' into your account. [size="1"]The 15% fee of '.money_formatter($fee).' was taken depositing you a final amount of '.money_formatter($gain).'.[/size]'; } } function withdraw() { global $c,$ir,$c,$userid; if($_POST['amount'] > $ir['bankmoney']) { echo '<span style="color:red;">You dont have enough money saved to withdraw that much!</span>'; } else { mysql_query("UPDATE `users` SET `bankmoney` = `bankmoney` - ".$_POST['amount'].", `money` = `money` + ".$_POST['amount']." WHERE userid=".$userid); $ir['money'] += $_POST['amount']; echo 'You withdrew '.money_formatter($_POST['amount']).' into your hand from your account. [size="1"]You know have '.money_formatter($ir['money']).' in your hand.[/size]'; } } if(!$_GET['print']) { $h->endpage(); } ?>
  15. Hall of fame doesn't work for V2, V1 or lite. You didn't give us an SQL of ttt_ranks. $cnt=mysql_query("SELECT * FROM {$gpre}ranks ORDER BY {$by} {$order}");
  16. Could you make it so if they have had there first go they can only surrender. If they surrender the money goes to the other player. This is so they don't leave the table because there losing. :)
  17. Cheers. Got it working. ;)
  18. And Chat doesn't work.
  19. Seany Baby! Could you help me please? I have converted this to use with v1/lite but I have an error. My ttt_play.php file.. [expander] <?php include "ttt_config.php"; $gamepage="ttt"; session_start(); require_once "mysql.php"; require_once "global_func.php"; $userid=$_SESSION['userid']; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); include $gpre."func.php"; $currenttime=time(); $is=mysql_query("SELECT * FROM users WHERE userid={$_SESSION['userid']}"); $ir=mysql_fetch_array($is); $move = abs((int)$_POST['move']); $_POST['chattxt']=mysql_escape($_POST['chattxt']); $game=mysql_query("SELECT * FROM ".$gpre."room WHERE id=".$ir['{$gpre}room']."", $c) or die("1"); if(mysql_num_rows($game)==0){die("You are not currently in a room... <a href=sb_rooms.php?g=".$gpre.">Click here to pick a room</a><meta http-equiv=\"refresh\" content=\"0;url=sb_rooms.php?g={$gpre}\" />");} $ga=mysql_fetch_array($game); $roomid = $ga['id']; if($_POST['chattxt']) { $_POST['chattxt'] = preg_replace("/[^a-zA-Z0-9?!.'\",\s]/", "", $_POST['chattxt']); $_POST['chattxt'] = addslashes($_POST['chattxt']); $_POST['chattxt']="[b]".$ir['username']." said: [/b]".$_POST['chattxt']; mysql_query("INSERT INTO {$gpre}chat ({$gpre}room, timestamp, txt) VALUES({$ir["{$gpre}room"]}, unix_timestamp(), '{$_POST['chattxt']}')"); die(); } $gia = mysql_query("SELECT * FROM {$gpre}game WHERE {$gpre}room=$roomid"); $gi = mysql_fetch_array($gia); $gamerunning = mysql_num_rows($gia); if($ga['play_time']>0 && $gi['winner']==0) //only if the game has started / first move made { $uin=mysql_fetch_array(mysql_query("SELECT username FROM users WHERE userid={$ga['turn']}")); $username = $uin['username']; if($username) { //Check the clock - 35 seconds per move $lastmove = $ga['play_time']; $ctime = time(); $timespent = $ctime - $lastmove; $timeleft = 35 - $timespent; if($timeleft <= 0) { //lost their turn toggle_turn($roomid); $txt = "$username ran out of time and lost his/her move."; mysql_query("INSERT INTO ttt_chat (ttt_room, timestamp, txt) VALUES($roomid, unix_timestamp(), '$txt')"); $game=mysql_query("SELECT * FROM {$gpre}room WHERE id={$ir["{$gpre}room"]}", $c) or die("1"); $ga=mysql_fetch_array($game); } else if($ga['turn']==$ir['userid']) { $timetxt = " You have [b]<div id='timeleft' style='display: inline;'>{$timeleft}</div> seconds[/b] to make a move."; } } } if($ga['p1']==$ir['userid']){$opuid = $ga['p2'];} if($ga['p2']==$ir['userid']){$opuid = $ga['p1'];} $oun = mysql_fetch_array(mysql_query("SELECT username FROM users WHERE userid=$opuid")); $opponent = $oun['username']; $wintxt = ""; if($gi['winner']!=0) { if($gi['winner']==$ir['userid']) { if($ga['bet']>0){$winamt = $ga['bet']*2;$bettxt = " (Received \$".number_format($winamt).")";} $wintxt = "<h3>{$ir['username']} won!{$bettxt}</h3>"; } else if($gi['winner']==$opuid) { if($ga['bet']>0){$winamt = $ga['bet']*2;$bettxt = " (Received \$".number_format($winamt).")";} $wintxt = "<h3>{$opponent} won!{$bettxt}</h3>"; } else { if($ga['bet']>0){$winamt = $ga['bet'];$bettxt = " (Both received \$".number_format($winamt).")";} $wintxt = "<h3>Tie game!{$bettxt}</h3>"; } $displayreplay = 1; if($_POST['replay']==1) { if($ga['bet']<=$ir['money']) { if($gi['replay']==$opuid) { set_up_replay($roomid, $opuid, $ir['userid'], $ga['bet']); } else { mysql_query("UPDATE {$gpre}game SET replay={$ir['userid']} WHERE {$gpre}room=$roomid"); } } } if($ga['bet']>$ir['money']) { $badreplaymsg=1; } } $turntxt = ""; if($ga['turn']==$ir['userid']) { $turntxt = "<h3><font color=green>Your Turn!</font></h3>"; } else if($gi['winner']==0 && $gamerunning>0) { $turntxt = "<h3><font color=red>Opponent's Turn.</font></h3>"; } if($gi['x']==$ir['userid']){$mymark = " (X)";$oppmark = " (O)";} else{$mymark = " (O)";$oppmark = " (X)";} $vstxt = "<h3>{$ir['username']}{$mymark} vs. {$opponent}{$oppmark}</h3>"; if($ga['p1']>0 && $ga['p2'] > 0 && $gamerunning==0) { //game not yet started create_game($ga['id']); } else if((($ga['p1']>0 && $ga['p2'] == 0) || ($ga['p1']==0 && $ga['p2'] > 0)) && $gamerunning==1 && $ga['play_time']>0) { //game started, other player left, award win, unless no moves yet made if($ga['p1']>0){$winner=$ga['p1'];}else{$winner=$ga['p2'];} if($gi['winner']==0) { award_win($roomid, $winner); $defaultwin = "Opponent left, so you won the game (along with any bets)."; } else { $defaultwin = "Opponent left."; } set_up_replay($roomid, $winner, -1, $ga['bet']); } else if(($ga['p1']>0 && $ga['p2'] == 0) || ($ga['p1']==0 && $ga['p2'] > 0)) { $waittxt = "Waiting for another person to join..."; $vstxt = ""; } if($move) { make_move($move, $userid, $roomid); } print"<h1>Tic-Tac-Toe</h1>"; if($waittxt) { print"{$waittxt}"; } else if($defaultwin) { print"{$defaultwin}"; } else { print"{$vstxt}{$wintxt}{$turntxt}"; if($displayreplay) { if($badreplaymsg) { print"You don't have enough money to play again. "; } else if($gi['replay']==$ir['userid']) { print"Asking opponent to play again... "; } else { replay_option($roomid); } } draw_board($roomid, $userid, $ga['turn']); print $timetxt; //print" <font size=1>To make your move, click an open square <u>once</u>!</font>"; } ?> [/expander] But whenever I play it I get.. "1" printed on the screen. If you need me to post any other files I will...
  20. Errm.. Try..   RewriteEngine On RewriteCond %{HTTP_HOST} ^crimgame\.com$ RewriteRule (.*) http://www.crimgame.com/$1 [R=301,L]
  21. I think it matters. You can use .htaccess rewrite mod. http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html
  22. CJ - Twitch

    PHP GD Question

    PHP GD is a fairly hard tool to work with. As stated above HTML is a browser thing with images do not process. An alternative would be to learn flash and PHP. Good luck -
  23. Haha. Yeah fair enough.
×
×
  • Create New...