-
Posts
579 -
Joined
-
Last visited
-
Days Won
5
Content Type
Profiles
Forums
Events
Everything posted by Seker
-
Alright, I know this is an old mod, but I've done it on V1, as well as added a Crystal Temple option to add more attacks, so I thought I would share in case anyone might find this useful. First off, the SQL: ALTER TABLE `users` ADD `attacklimit` int(11) NOT NULL default '20' Open attack.php and find: else if ($_GET['ID'] == $userid) { print "<font color='red'><b>Only the crazy attack themselves.</font></b>"; $h->endpage(); exit; } Under that, add: else if ($ir['attacklimit'] <= 0) { print "You are out of attacks for today!</br> <a href='index.php'>Back</a>"; $h->endpage(); exit; } Open attackmug.php and find: mysql_query( "UPDATE users SET hp=1,hospital=hospital+3,hospreason='Mugged by <a href=\'viewuser.php?u={$userid}\'>{$ir['username']}</a>' WHERE userid={$r['userid']}", $c); Under that, add: mysql_query("UPDATE users SET attacklimit=attacklimit-1 WHERE userid=$userid"); Open attackleave.php and find: mysql_query( "UPDATE users SET hp=1,hospital=hospital+10,hospreason='Attacked by <a href=\'viewuser.php?u={$userid}\'>{$ir['username']}</a>' WHERE userid={$r['userid']}", $c); Under that, add: mysql_query("UPDATE users SET attacklimit=attacklimit-1 WHERE userid=$userid"); Open attacklost.php and find: mysql_query("UPDATE users SET exp=0 WHERE exp<0", $c); Under that, add: mysql_query("UPDATE users SET attacklimit=attacklimit-1 WHERE userid=$userid"); Open attacklost.php and find: mysql_query( "UPDATE users SET hp=1,hospital=hospital+6,hospreason='Hospitalized by <a href=\'viewuser.php?u={$userid}\'>{$ir['username']}</a>' WHERE userid={$r['userid']}", $c); Under that, add: mysql_query("UPDATE users SET attacklimit=attacklimit-1 WHERE userid=$userid"); Add this to your cron_day: mysql_query("UPDATE users SET attacklimit=30 WHERE donatordays = 0"); mysql_query("UPDATE users SET attacklimit=40 WHERE donatordays > 1"); Open crystaltemple.php and find: <a href='crystaltemple.php?spend=refill'>Energy Refill - 12 Crystals</a><br /> Under that, add: <a href='crystaltemple.php?spend=attacks'>20 More Attacks - 200 Crystals</a><br /> Now, find: else { mysql_query( "UPDATE users SET energy=maxenergy,crystals=crystals-12 WHERE userid=$userid", $c); print "You have paid 12 crystals to refill your energy bar."; } } Under that, add: else if ($_GET['spend'] == 'attacks') { if ($ir['crystals'] < 200) { print "You don't have enough crystals!"; } else { mysql_query( "UPDATE users SET attacklimit=attacklimit+20,crystals=crystals-200 WHERE userid=$userid", $c); print "You have paid 200 crystals for 20 more attacks."; } } And, if you want your players to know how many attacks they have available, add this somewhere in index.php: Attacks: {$ir['attacklimit']}
-
Alright, I KNOW this is a VERY old mod, but as Nyna's gym seems to be the recommended go-to gym, and I could not get it to work for v1.1.1 after SEVERAL tries, I tried going with this. Having one issue, though, and wondering if anyone could lend a hand in figuring it out. The code is copied exactly, with the exception of the necessary conversion of "include(DIRNAME(__FILE__).'/globals.php')" Now, I'm not getting a single error. It just flat out doesn't work. I click on "Train" and nothing happens. Uses no energy or will and gives no stat gain. As I said, I've changed nothing but the necessary conversion piece. Here are the two codes: gym.php <?php // # Only to be posted on MAKEWEBGAMES # # Made by the user Zed # # No re-distribution or reselling # // 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']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); ?> <noscript>This gym requires the use of <b>JAVASCRIPT</b> in order to work.</noscript> <div style=" background-color: #dfdfdf; -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 2px solid #A7A7A7; padding: 10px; width: 70%;" id = "gContent" > <b>Welcome to the gym! What would you like to train today?</b> <span style = "font-size:10px; color: #8B0000;">You have <?php echo (''.number_format($ir['energy']).'/'.number_format($ir['maxenergy']).''); ?> energy available</span> </div> <table width = "75%" style = "border: 1px solid #A7A7A7; text-align:left; padding: 10px;"> <form action = "" method = ""> <tr style = "background: #CCCCCC; padding: 10px;"> <td width = "80%"> -Strength <span style = "font-size:10px; color: #8B0000;">-Increases the damage you make on impact</span> </td> <td width = "50%"> <input type = "text" value = "1" id = "strength" size = "1" /> <input type = "button" value = "Train" onClick = "javascript<b></b>: gDo('strength');" /> </td> </tr> <tr style = "background: #dfdfdf; padding: 10px;"> <td width = "80%"> -Defence <span style = "font-size:10px; color: #8B0000;">-Increases your ability to withstand damage</span> </td> <td> <input type = "text" value = "1" id = "defence" size = "1" /> <input type = "button" value = "Train" onClick = "javascript<b></b>: gDo('defence');" /> </td> </tr> <tr style = "background: #CCCCCC; padding: 10px;"> <td width = "80%"> -Speed <span style = "font-size:10px; color: #8B0000;">-Increases your likelihood to make contact with your opponent</span> </td> <td> <input type = "text" value = "1" id = "speed" size = "1" /> <input type = "button" value = "Train" onClick = "javascript<b></b>: gDo('speed');" /> </td> </tr> </form> </table> <?php $h->endpage(); ?> <script type = "text/javascript"> var xmlhttp; try { xmlhttp = new XMLHttpRequest(); } catch(e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Browser Incompatibility error!"); } } } function gDo(stat) { xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("gContent").innerHTML = xmlhttp.responseText; } } var uAmt = document.getElementById(stat).value; xmlhttp.open("GET","gDo.php?uStat=" + stat +"&uAmount="+ uAmt, true); xmlhttp.send(); } </script> gDo.php <?php // # Only to be posted on MAKEWEBGAMES # # Made by the user Zed # # No re-distribution or reselling # // if(!isset($_GET['uStat']) || !isset($_GET['uAmount'])) { echo ('An error has occured, please try again.'); exit; } //DB connections. session_start(); include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; // $Data = mysql_fetch_assoc(mysql_query("SELECT `energy`,`will`,`maxenergy` FROM `users` WHERE (`userid` = ".$_SESSION['userid'].")")) or die(mysql_error()); if(!in_array($_GET['uStat'], array('strength','speed','defence'))) { 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; } //Formula, YES it sucks but you can change it whenever. $Gain = $_GET['uAmount'] * $Data['will'] / 551; echo ('<span style = "color:green; font-weight:bold;">You gained '.number_format($Gain, 3).' '.$_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']).", `will` = `will` - ".intval($_GET['uAmount'])." * 2 WHERE (`userid` = ".$_SESSION['userid'].")"); mysql_query("UPDATE `userstats` SET ".$_GET['uStat']." = ".$_GET['uStat']." + ".intval($Gain)." WHERE (`userid` = ".$_SESSION['userid'].")"); exit; ?>
-
Okay, so I've added a jail script. And, ever since I added it, every click on a crime lands the user straight in jail. I've tested this on several different crimes and with several different accounts. Every attempt lands you straight in the clink. I feel like it has to have something to do with my docrime.php as I have not messed with the SQL formulas at all, and before I added the jail, crimes were actually succeeding. Could really use some help with this if anyone's got a minute to check out the code. docrime.php: <?php /*----------------------------------------------------- -- Free Mod For CE -- docrime.php edited by $Bull$$ EYE$ -----------------------------------------------------*/ 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']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $_GET['c']=abs((int) $_GET['c']); if(!$_GET['c']) { print "Invalid crime"; } else { $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else { $ec="\$sucrate=".str_replace(array("LEVEL","EXP"," WILL","IQ"), array($ir['level'], $ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']).";"; eval($ec); print $r['crimeITEXT']; $ir['brave']-=$r['crimeBRAVE']; mysql_query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,100) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/5); mysql_query("UPDATE users SET crimes=crimes+1 WHERE userid={$ir['userid']}",$c); mysql_query("UPDATE users SET money={$ir['money']},exp={$ir['exp']} WHERE userid=$userid",$c); } else { print $r['crimeFTEXT']; $jailtime=(int) (10); mysql_query("UPDATE users SET jail=$jailtime WHERE userid=$userid", $c); mysql_query("UPDATE users SET jailreason='Failed a crime' WHERE userid=$userid", $c); } } print " <a href='docrime.php?c={'c']}>Try Again</a> <a href='criminal.php'>Crimes</a>"; } $h->endpage(); ?>
-
He's contacted me and I'm going to see what we can work out. But thanks all for the help.
-
Yeah, as I've said, I've sent in two support tickets, as well as a message to him on here. No answer yet. Not completely unreasonable on the weekend, so I'll give it a little more time. Don't think the domain's in danger by waiting just another day. I'll see how it goes. Thanks for the help, Bastard.
-
This domain name is not registered Talk about problematic... Considering I already paid for it, what can I do to fix this?
-
The only reason I'm wondering if it's an actual nameserver issues is because this is what it says in my client portal on W3Theory: Domain Management - (Back to My Domains) Registration Date: 12/04/2012 Domain: ***.net Payment Method: PayPal First Payment Amount: *** Recurring Amount: *** Next Due Date: *** Registration Period: 1 Year/s Status: Pending And, in the welcome email, it stated my nameservers are Nameserver 1: ns1.w3theory.com Nameserver 2: ns2.w3theory.com
-
It was a new domain I registered at signup. Was I wrong to assume their nameservers were automatically applied?
-
Alright, so three days ago, I switched hosting to W3Theory. After seeing a few recommendations on here (albeit, none of which were posted in, at least, the last six months) I figured this was the best option. However, my domain still has not propagated, causing me to lose days of development work. I'm just curious if this kind of time frame is normal, or is W3Theory just not a viable choice anymore? I know propagation can take some time, but my previous experience registering on a different host led me to believe within 24 hours was average. Now, I'm not trying to flame W3Theory. Not at all. I just know I haven't received a response from a support ticket, or a direct message to Peter Leaman through MWG. Should I be worried at this point or just wait a while longer?
-
Ahh Thank you, thank you. It's just, every time you type in jail, you get a result of like thirty pages. I must have just glanced right over this. Appreciated.
-
So, before anyone thinks I'm just being lazy, I've tried searching on here using all kinds of different search terms. I just cannot find a jail script for version 1. Does anyone know where I could find one? Or, could someone at least tell me if it's possible to build one using the hospital script as a base?
-
Same mysql warning on the home page. I'm wondering. I thought I cleverly figured out how to display actual exp. needed next to the percentage by adding a function to the top of that page. Should it go in global_func.php somewhere, instead? And just reference it from index.php? i.e. Should I move $exp_n=(int)($ir['exp_needed']); to global_func.php? And just call it like I did here: ({$exp}/{$exp_n}) on index.php?
-
Okay, got it. So there's something still out of whack on my Index.php. I'm assuming so, at least, since that's the only page displaying it. The file referenced in the error is global_func.php and the original file I posted about is index.php. Thank you guys so much for your help. Been a very positive first experience in the forums.
-
Ahhh Thank you, thank you. I literally stared at this for two hours last night. As I said, I'm just learning and learning as I go on top of that, so I had no clue. Also, this shows up only on the index, now. It was there before I got this particular error, too, but I wasn't sure how to handle it. Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/drewsch1/public_html/test/global_func.phpon line 266 This is the line it's talking about: $c); return mysql_result($q, 0, 0) + 1; } Is this a problem with something on Index.php or Global_func.php?
-
When I do that, do I leave "index()" or 'index.php' or anything like that?
-
Okay, so a little background first. I've just recently decided I'd like to take up the challenge of creating and running a game. I chose purchase a V1 license for several reasons. The most obvious being the cost, but I also thought starting with a very basic base would only force me to figure out php coding faster. I've been perusing these forums the past few days, and have found a lot of resources that have helped me immensely so far. Anyway. On to my problem. I'm using a couple of mods in my index.php and they just aren't seeming to mesh with a simple table layout. Included with the standard code are some display options for attack stats, as well as displaying the player's bank at the bottom of the screen. Now, when I just add a table with the stats listed anywhere on the page, I didn't have any errors. However, when I tried to add tables around the stats to mesh with the rest of the layout, I get this error: Parse error: syntax error, unexpected '<' in /home/drewsch1/public_html/test/index.php on line 112 I was wondering if anyone would just be willing to do quick scan and point out any obvious problems I'm missing. I know it's messy as all get out, and I appreciate anyone taking a minute to help. Here's the section of code: break; default: <span class="highlight">index</span>(); break; } } else And here's the full page: <?php $housequery=1; 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']); $cm = money_formatter($ir['crystals'], ''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); $exp=(int)($ir['exp']/$ir['exp_needed']*100); $exp_n=(int)($ir['exp_needed']); print <<<OUT <table cellspacing="1" border="1" cellpadding="3" class="table" width="70%"> <tr><td colspan="2"><b>General Information</b></td></tr> {$geninf} <tr> <td><b>Name:</b> {$ir['username']}</td> <td><b>Crystals:</b> {$cm}</td> </tr> <tr> <td><b>Level:</b> {$ir['level']}</td> <td><b>Exp:</b> {$exp}% ({$exp}/{$exp_n})</td> </tr> <tr> <td><b>Money:</b> $fm</td> <td><b>HP:</b> {$ir['hp']}/{$ir['maxhp']}</td> </tr></br> OUT; $ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ']; $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); $ir['IQrank']=get_rank($ir['IQ'],'IQ'); $tsrank=get_rank($ts,'strength+agility+guard+labou r+IQ'); $ir['strength']=number_format($ir['strength']); $ir['agility']=number_format($ir['agility']); $ir['guard']=number_format($ir['guard']); $ir['labour']=number_format($ir['labour']); $ir['IQ']=number_format($ir['IQ']); $ts=number_format($ts); print <<<OUT <tr> <td colspan="2"><b>Stats Info</b></td></tr> <tr> <td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td> <td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td> </tr> <tr> <td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td> <td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td> </tr> <tr> <td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td> <td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td> </tr> </table> OUT; print <<<OUT <table cellspacing="1" border="1" cellpadding="3" class="table" width="70%"> <tr><td colspan="2"><b>Attack Statistics</b></td></tr> <tr> <td><b>Total Attacks:</b> {$r['atotal']}</td> <td><b>Attacks Won:</b> {$r['awon']}</td> </tr> <tr> <td><b>Attacks Lost: {$r['alost']}</td> <td><b>Times Attacked: {$r['tattacked']}</td> </tr> <tr> <td><b>People Left: {$r['pleft']}</td> <td><b>People Hospilatized: {$r['phosp']}</td> </tr> <tr> <td><b>People Mugged: {$r['pmugged']}</td> <td><b>Money Mugged: \${$r['mmugged']}</td> </tr> </table> OUT; print "<h3>Bank</h3>"; if($ir['bankmoney']>-1) { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: <span class="highlight">index</span>(); break; } } else { if(isset($_GET['buy'])) { if($ir['money']>19999) { print "Congratulations, you bought a bank account for \$20,000! <a href='index.php'>Start using my account</a>"; mysql_query("UPDATE users SET money=money-20000,bankmoney=0 WHERE userid=$userid",$c); } else { print "You do not have enough money to open an account. <a href='index.php'>Back</a>"; } } else { print "Open a bank account today, just \$20,000! <a href='index.php?buy'> Yes, sign me up!</a>"; } } function <span class="highlight">index</span>() { global $ir,$c,$userid,$h; print "\n<b>You currently have \${$ir['bankmoney']} in the bank.</b> At the end of each day, your bank balance will go up by 0.3%. <table width='75%' border='2' bordercolor='#lime'> <tr> <td width='50%'><b>Deposit Money</b> It will cost you 0% of the money you deposit, rounded up. The maximum fee is \$0.<form action='<span class="highlight">index</span>.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='{$ir['money']}' /> <input type='submit' value='Deposit' /></form></td> <td> <b>Withdraw Money</b> There is no fee on withdrawals.<form action='<span class="highlight">index</span>.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='{$ir['bankmoney']}' /> <input type='submit' value='Withdraw' /></form></td> </tr> </table>"; } function deposit() { global $ir,$c,$userid,$h; $_POST['deposit']=abs((int) $_POST['deposit']); if($_POST['deposit'] > $ir['money']) { print "You do not have enough money to deposit this amount."; } else { $fee=ceil($_POST['deposit']*0/100); if($fee > 0) { $fee=0; } $gain=$_POST['deposit']-$fee; $ir['bankmoney']+=$gain; mysql_query("UPDATE users SET bankmoney=bankmoney+$gain, money=money-{$_POST['deposit']} where userid=$userid",$c); print "You hand over \${$_POST['deposit']} to be deposited, after the fee is taken (\$$fee), \$$gain is added to your account. <b>You now have \${$ir['bankmoney']} in the bank.</b> <a href='index.php'> Back</a>"; } } function withdraw() { global $ir,$c,$userid,$h; $_POST['withdraw']=abs((int) $_POST['withdraw']); if($_POST['withdraw'] > $ir['bankmoney']) { print "You do not have enough banked money to withdraw this amount."; } else { $gain=$_POST['withdraw']; $ir['bankmoney']-=$gain; mysql_query("UPDATE users SET bankmoney=bankmoney-$gain, money=money+$gain where userid=$userid",$c); print "You ask to withdraw $gain, the banking lady grudgingly hands it over. <b>You now have \${$ir['bankmoney']} in the bank.</b> <a href='index.php'> Back</a>"; } } $h->endpage(); ?>