Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: [Mccodes Version 2] Monorail  (Read 209 times)

MonoD

  • Basic Member
  • *
  • Reputation Power: 23
  • MonoD has no influence.
  • Offline Offline
  • Posts: 34
    • MSN Messenger - Contact@Monodistrict.com
    • View Profile
    • WWW
    • Email
[Mccodes Version 2] Monorail
« on: July 05, 2011, 08:33:10 PM »
Hi again, This isn't much at all, however i noticed many games with the standard monorail, All i have done is cleaned the code and changed it around a little bit.

Feel free to use!

Screenshots:





monorail.php:
Code: [Select]
<?php
include_once(DIRNAME(__FILE__) . '/globals.php');
echo 
"<h3>The Monorail</h3>";
$_GET['travel'] = abs((int) $_GET['travel']);
if (!
$_GET['travel']) {
        echo 
"Welcome to the Monorail Station, It costs \$1000 for a ticket.<br /> Where would you like to travel today?<br /><br />";
        
$q $db->query("SELECT * FROM cities WHERE cityid != {$ir['location']} AND cityminlevel <= {$ir['level']}");
        echo 
"<table width='80%' cellspacing='1' class='table'><tr><th>Name</th><th>Description</th><th>Min Level</th><th>Action</th></tr>";
        while (
$r $db->fetch_row($q)) {
                echo 
"<tr><td>{$r['cityname']}</td><td>{$r['citydesc']}</td><td>{$r['cityminlevel']}</td><td><a href='monorail.php?travel={$r['cityid']}'>Travel</a></td></tr>";
        }
        echo 
"</table>";
} else {
        if (
$ir['money'] < 1000) {
                echo 
"<b>Error:</b> You do not have enough money, It costs \$1000 for a ticket.<br /><br /> &gt <a href='monorail.php'>Back</a>";
        } else if (((int) 
$_GET['travel']) != $_GET['travel']) {
                echo 
"<b>Error:</b> Invalid city ID, Please try again!<br /><br /> &gt <a href='monorail.php'>Back</a>";
        } else {
                
$q $db->query("SELECT * FROM cities WHERE cityid = {$_GET['travel']} AND cityminlevel <= {$ir['level']}");
                if (!
$db->num_rows($q)) {
                        echo 
"<b>Error:</b> Either the city does not exist or you are not a high enough level!<br /><br /> &gt <a href='monorail.php'>Back</a>";
                } else {
                        
$db->query("UPDATE users SET money=money-1000,location={$_GET['travel']} WHERE userid=$userid");
                        
$r $db->fetch_row($q);
                        echo 
"<b>Success:</b> You have paid \$1000 and travelled to {$r['cityname']} on the monorail!<br /><br /> &gt <a href='monorail.php'>Back</a>";
                }
        }
}
$h->endpage();
?>

Thanks!
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.