Jump to content
MakeWebGames

Matsu

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by Matsu

  1. Re: [V2] Add item query Thanks, alabama. >.> I didn't know that one.
  2. Re: [V2] Add item query Wow, this is old....but no-one answered, and I actually know this one: (note: found topic using search function >.>)   $itemidexplore=x; $gain=rand(1,100); print "Inside the box were $gain bandaids."; $db->query("INSERT INTO inventory VALUES('',$itemidexplore,$userid,$gain)",$c);   change x to the id number of the item you want to input. Say if your bandaids were id number 2, you'd put $itemidexplore=2;
  3. Re: [mccode v2] Updated Help tutorial This could be helpful for the lazy....or people like me who just don't want to look at any more code...UGH. Ohgawd, I just realized this topic is like, 5 billion years old. Necropost FTL. >.<
  4. Re: looking for a specific mod - comments It does exist. Like I said, I've seen it in use by different game owners in 3 games. Therefore it must exist. Thank you for your time, though.
  5. Re: looking for a specific mod - comments We're actually using that mod now. It doesn't let the commentor or user commented on delete comments, the comment form is on a separate page, and there is no event when a comment is received, so this isn't the specific mod I happen to be looking for. Thank you, though.
  6. Hello...I'm not asking anyone to make me a mod. I am looking for a specific comments mod that does the following: Has three fields: Poster, Comment, Delete Gives an event that links to your profile when a comment is received Has a link back to the person that made the comment in the "Poster" field Allows the person that made the comment and the person that received the comment to delete comments made Allows comments to be made on another user's profile, but not your own Comments are made in a 60x40 form on viewuser.php I know this mod exists, because I've seen the exact same mod used in 3 games, one of which is separately owned. Unfortunately, when searching, I haven't been able to find out if it's free/paid/etc, or who offers it. Does anyone know? Who do I tell my game's owner to contact in order to buy it?
  7. Re: [mccode v2] Gym I know, if I don't know what I'm doing, I probably shouldn't touch it, but the owner of the game I'm working for wants to use Nyna gym, and also wants to have another gym that gives x2 stat gain to donators. For consistency, we want to use Nyna Gym for that as well. I don't know enough about coding to start removing things, so even though I added a string that keeps you from using it if you are in jail, I didn't remove any of the jail bits. I originally had a question, but I figured it out on my own. Here's the code with the parts I changed. >.> I hope Nyna-san doesn't mind.   <?php $macropage = "donorgym.php"; include "globals.php"; global $db, $h, $ir, $userid; if ($ir['hospital']) { echo " You cannot access the gym whilst in hospital</p>"; $h->endpage(); exit; } else if ($ir['jail']) { echo " You cannot access the gym whilst in jail</p>"; $h->endpage(); exit; } else if($ir['donatordays'] == 0) { echo 'You do not have the correct privileges to access this gym. If you want in, you will have to become a donator.'; $h->endpage(); exit; } $prefs = isset($_SESSION['gymprefs']) ? $_SESSION['gymprefs'] : array('what' => "all", 'expend' => "100%"); $what = $prefs['what']; $expend = $prefs['expend']; $message = false; $sql = sprintf("SELECT us.strength, us.agility, us.guard, us.labour, u.energy, u.will, u.jail FROM users u LEFT JOIN userstats us ON (u.userid = us.userid) WHERE (u.userid = %u)", $userid); $row = $db->fetch_row($db->query($sql)); $formID = preg_replace("`^([0-9A-F]{8})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{12})$`ms", "{\\1-\\2-\\3-\\4-\\5}", strtoupper(md5(serialize(array(session_id(), "Gym", null))))); if (isset($_POST['formID']) && is_string($_POST['formID']) && ($_POST['formID'] === $formID)) { $what = isset($_POST['what']) && is_string($_POST['what']) && preg_match("`^((all)|(strength)|(agility)|(guard)|(labour))$`ims", $_POST['what']) ? strtolower($_POST['what']) : $what; $expend = isset($_POST['expend']) && is_string($_POST['expend']) && preg_match("`^((100%)|(75%)|(50%)|(25%)|(value))$`ims", $_POST['expend']) ? strtolower($_POST['expend']) : $expend; $value = isset($_POST['value']) && is_string($_POST['value']) && preg_match("`^\d+$`ims", $_POST['value']) ? @intval($_POST['value']) : 0; $sql = sprintf("SELECT energy, will FROM users WHERE (userid = %u)", $userid); $rs = $db->query($sql); $info = $db->fetch_row($rs); $energy = $row['energy']; $will = $row['will']; switch ($expend) { case "100%": $value = $row['energy']; break; case "75%": $value = $row['energy'] * 0.75; break; case "50%": $value = $row['energy'] * 0.50; break; case "25%": $value = $row['energy'] * 0.25; break; default: break; } $value = floor($value); if ($value > $row['energy']) $message = "<span style='color:#C00;'>You don't have enough energy.</span>"; else { $prefs = array('what' => $what, 'expend' => $expend); $gain = 0; $will = $row['will']; for ($i = 0; $i < $value; $i++) { $gain += (mt_rand(1, 3) / mt_rand(500, 900) * mt_rand(500, 900) * (($will + 20) / 150)) * 4; $will = max(0, $will - mt_rand(1, 3)); } if ($row['jail']) $gain *= 0.5; $row['will'] = floor($will); $row['energy'] -= $value; switch ($what) { case "all": $message = sprintf("<span style='color:#070;'>You gain %s in each stat</span>", number_format($gain * 0.25, 0)); $row['strength'] += $gain * 0.25; $row['agility'] += $gain * 0.25; $row['guard'] += $gain * 0.25; $row['labour'] += $gain * 0.25; break; case "strength": $message = sprintf("<span style='color:#070;'>You gain %s in strength</span>", number_format($gain, 0)); $row['strength'] += $gain; break; case "agility": $message = sprintf("<span style='color:#070;'>You gain %s in agility</span>", number_format($gain, 0)); $row['agility'] += $gain; break; case "guard": $message = sprintf("<span style='color:#070;'>You gain %s in guard</span>", number_format($gain, 0)); $row['guard'] += $gain; break; case "labour": $message = sprintf("<span style='color:#070;'>You gain %s in labour</span>", number_format($gain, 0)); $row['labour'] += $gain; break; } $sql1 = sprintf("UPDATE userstats SET strength = %.6f, agility = %.6f, guard = %.6f, labour = %.6f WHERE (userid = %u)", $row['strength'], $row['agility'], $row['guard'], $row['labour'], $userid); $sql2 = sprintf("UPDATE users SET will = %u, energy = %d WHERE (userid = %u)", $row['will'], $row['energy'], $userid); $db->query($sql1); $db->query($sql2); } $_SESSION['gymprefs'] = $prefs; } $row['ranks'] = array ( 'strength' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (strength > %.6f)", $row['strength']))) + 1, 'agility' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (agility > %.6f)", $row['agility']))) + 1, 'guard' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (guard > %.6f)", $row['guard']))) + 1, 'labour' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (labour > %.6f)", $row['labour']))) + 1, 'total' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (strength + agility + guard + labour > %.6f)", $row['strength'] + $row['agility'] + $row['guard'] + $row['labour']))) + 1, ); echo "<style type='text/css'>"; echo "#gym { }"; echo "#gym h3, #gym p { }"; echo "#gym table { width:90%;border-collapse:collapse; }"; echo "#gym th { border:solid 1px #333;background:#F6F6F6 url(titlebg.gif);padding:3px;color:#333; }"; echo "#gym td { border:solid 1px #333;padding:3px;color:#333; }"; echo "#gym { }"; echo "</style>"; echo "<div id='gym'>"; echo sprintf("<h3>%sGym</h3>", $ir['jail'] ? "Jail " : ""); if ($message) echo sprintf(" %s</p>", $message); echo "<form name='train' id='train' action='donorgym.php' method='post' style='padding:0;margin:0;'>"; echo sprintf("<input type='hidden' name='formID' value='%s' />", $formID); echo "<table cellpadding='0' cellspacing='0'>"; echo "<tr>"; echo "<th class='sub' style='width:50%;'>Train</th>"; echo "<th class='sub' style='width:50%;'>Expend</th>"; echo "</tr>"; echo "<tr>"; echo "<td style='line-height:200%;'>"; echo sprintf("<input type='radio' name='what' id='what0' value='all' %sstyle='vertical-align:middle;' /><label for='what0' style='cursor:pointer;'>All (25%% energy in each) [Rank #%s]</label> ", $what === "all" ? "checked='checked' " : "", number_format($row['ranks']['total'])); echo sprintf("<input type='radio' name='what' id='what1' value='strength' %sstyle='vertical-align:middle;' /><label for='what1' style='cursor:pointer;'>Strength (%s) [Rank #%s]</label> ", $what === "strength" ? "checked='checked' " : "", number_format($row['strength']), number_format($row['ranks']['strength'])); echo sprintf("<input type='radio' name='what' id='what2' value='agility' %sstyle='vertical-align:middle;' /><label for='what2' style='cursor:pointer;'>Agility (%s) [Rank #%s]</label> ", $what === "agility" ? "checked='checked' " : "", number_format($row['agility']), number_format($row['ranks']['agility'])); echo sprintf("<input type='radio' name='what' id='what3' value='guard' %sstyle='vertical-align:middle;' /><label for='what3' style='cursor:pointer;'>Guard (%s) [Rank #%s]</label> ", $what === "guard" ? "checked='checked' " : "", number_format($row['guard']), number_format($row['ranks']['guard'])); echo sprintf("<input type='radio' name='what' id='what4' value='labour' %sstyle='vertical-align:middle;' /><label for='what4' style='cursor:pointer;'>Labour (%s) [Rank #%s]</label> ", $what === "labour" ? "checked='checked' " : "", number_format($row['labour']), number_format($row['ranks']['labour'])); echo "</td>"; echo "<td style='line-height:200%;'>"; echo sprintf("<input type='radio' name='expend' id='expend0' value='100%%' %sstyle='vertical-align:middle;' /><label for='expend0' style='cursor:pointer;'>100%% Energy</label> ", $expend === "100%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend1' value='75%%' %sstyle='vertical-align:middle;' /><label for='expend1' style='cursor:pointer;'>75%% Energy</label> ", $expend === "75%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend2' value='50%%' %sstyle='vertical-align:middle;' /><label for='expend2' style='cursor:pointer;'>50%% Energy</label> ", $expend === "50%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend3' value='25%%' %sstyle='vertical-align:middle;' /><label for='expend3' style='cursor:pointer;'>25%% Energy</label> ", $expend === "25%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend4' value='value' %sstyle='vertical-align:middle;' onclick='document.train.value.focus();' /><label for='expend4' style='cursor:pointer;'><input type='text' id='value' name='value' value='{$row['energy']}' size='8' onfocus='this.select();' /> Energy</label> ", $expend === "value" ? "checked='checked' " : "");//(C)2008,Nyna echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='2' style='text-align:center;padding:6px;'>"; echo "<input type='submit' name='submit' value='Train' />"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; echo "</div>"; echo "<p style='color:#CCC;'>An open-source extension from [url='http://nyna.co.uk/']Nyna[/url]</p>"; $h->endpage(); ?>
  8. If I want to change the gym so it lets you train all stats at once, would I do it like this? Change: $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Labour' => 'labour'); $_POST['amnt']=abs((int) $_POST['amnt']);   to   $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Labour' => 'labour', 'All Stats' => 'all'); $_POST['amnt']=abs((int) $_POST['amnt']);   and after: elseif($stat=="labour") { print "You walk over to some boxes filled with gym equipment and start moving them. You have gained {$gain} labour by moving {$_POST['amnt']} boxes. You now have {$inc} labour and {$inc2} energy left."; } add:   elseif($stat=="all") { print "You lift some weights, run on a tradmill, go swimming, and move boxes of gym equipment. You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights. You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running. You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming. You have gained {$gain} labour by moving {$_POST['amnt']} boxes. You now have {$inc} strength, {$inc2} agility, {$inc3} guard, {$inc4} labour and {$inc5} energy left."; }   I'm new to coding, and working as an admin on someone else's game, so I don't want to make the change and mess it up without being sure it's the right way to code this. Sorry if it sounds like too much of a newbie question for these forums. Never mind. We decided to use Nyna's gym modification, so it doesn't really matter.
  9. Re: Prob with max stats Thank you. The change worked.
  10. Re: Prob with max stats I'm just a newbie to coding, as I've only ever done html before, but....if I go from that advice, if I wanted to remove the decimal places from the stats entirely, I'd change it to decimal(x, 0) where x is the number of place values I give the actual stat. Is that correct?
×
×
  • Create New...