Jump to content
MakeWebGames

Need help with a custom airport thing - Keep it if you can fix!


2Pacalypse
 Share

Recommended Posts

Hi, just spent a little while yesterday making out this page.

It's an airport (monorail) for MCCode V2.

Although... it doesn't work lol

If anyone can help me get it working, I'd greatly appreciate it and if you can fix it up so it works, you're more than welcome to edit and use it yourself!

Here it is

<?php

include "globals.php";

switch($_GET['city'])
{
case 'portadown': portadown(); break;
case 'london': london(); break;
case 'washington': washington(); break;
case 'paris': paris(); break;
case 'berlin': berlin(); break;
case 'vegas': vegas(); break;
case 'kathmandu': kathmandu(); break;
}

print "

<table class='table' width='65%' cellpadding='2'>
<tr>
<th>City</th><th>Level</th><th>Cost</th><th>Travel</th>
</tr>
<tr>
<td>Portadown</td><td>1</td><td>/$1,000</td><td>[url='airport.php?city=portadown']Go[/url]</td>
</tr>
<tr>
<td>London</td><td>5</td><td>/$3,000</td><td>[url='airport.php?city=london']Go[/url]</td>
</tr>
<tr>
<td>Washington</td><td>10</td><td>/$5,000</td><td>[url='airport.php?city=washington']Go[/url]</td>
</tr>
<tr>
<td>Paris</td><td>20</td><td>/$7,500</td><td>[url='airport.php?city=paris']Go[/url]</td>
</tr>
<tr>
<td>Berlin</td><td>30</td><td>/$10,000</td><td>[url='airport.php?city=berlin']Go[/url]</td>
</tr>
<tr>
<td>Las Vegas</td><td>40</td><td>/$12,500</td><td>[url='airport.php?city=vegas']Go[/url]</td>
</tr>
<tr>
<td>Kathmandu</td><td>50</td><td>/$15,000</td><td>[url='airport.php?city=vegas']Go[/url]</td>
</tr> ";


function portadown()
{
if ($ir['level'] > 0 and $ir['money'] >999)
{
$db->query("UPDATE users SET money=money-1000,location=1 WHERE userid=$userid");
print "You paid /$1,000 to travel to Portadown";
}
elseif ($ir['level'] < 1)
{
print "You are not high enoguh level to go here!";
}
elseif ($ir['money'] < 1000)
{
print "You don't have enough money to cover the ticket";
}
}

function london()
{
if ($ir['level'] > 4 and $r['money'] >2999)
{
$db->query("UPDATE users SET money=money-3000,location=2 WHERE userid=$userid");
print "You paid /$3,000 to travel to London";
}
elseif (($ir['level']) < 5)
{
print "You are not high enough level to go here!";
}
elseif ($r['money'] < 3000)
{
print "You don't have enough money to cover the ticket";
}
}

function washington()
{
if ($ir['level'] > 9 and $ir['money'] >4999)
{
$db->query("UPDATE users SET money=money-5000,location=3 WHERE userid=$userid");
print "You paid /$5,000 to travel to Washington";
}
elseif ($ir['level'] < 10)
{
print "You are not high enoguh level to go here!";
}
elseif ($ir['money'] < 5000)
{
print "You don't have enough money to cover the ticket";
}
}

function paris()
{
if ($ir['level'] > 19 and $ir['money'] >7499)
{
$db->query("UPDATE users SET money=money-7500,location=4 WHERE userid=$userid");
print "You paid /$7,500 to travel to Paris";
}
elseif ($ir['level'] < 20)
{
print "You are not high enoguh level to go here!";
}
elseif ($ir['money'] < 7500)
{
print "You don't have enough money to cover the ticket";
}
}

function berlin()
{
if ($ir['level'] > 29 and $ir['money'] >9999)
{
$db->query("UPDATE users SET money=money-10000,location=5 WHERE userid=$userid");
print "You paid /$10,000 to travel to Berlin";
}
elseif ($ir['level'] < 30)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 10000)
{
print "You don't have enough money to cover the ticket";
}
}

function vegas()
{
if ($ir['level'] > 39 and $ir['money'] >12499)
{
$db->query("UPDATE users SET money=money-12500,location=6 WHERE userid=$userid");
print "You paid /$12,500 to travel to Las Vegas";
}
elseif ($ir['level'] < 40)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 12500)
{
print "You don't have enough money to cover the ticket";
}
}

function kathmandu()
{
if ($ir['level'] > 49 and $ir['money'] >14999)
{
$db->query("UPDATE users SET money=money-15000,location=7 WHERE userid=$userid");
print "You paid /$12,500 to travel to Kathmandu 
This is a very cold place!";
}
elseif ($ir['level'] < 50)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 15000)
{
print "You don't have enough money to cover the ticket";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

Re: Need help with a custom airport thing - Keep it if you can fix!

 

<?php

include "globals.php";

switch($_GET['city'])
{
case 'portadown': portadown(); break;
case 'london': london(); break;
case 'washington': washington(); break;
case 'paris': paris(); break;
case 'berlin': berlin(); break;
case 'vegas': vegas(); break;
case 'kathmandu': kathmandu(); break;
}

print "

<table class='table' width='65%' cellpadding='2'>
<tr>
<th>City</th><th>Level</th><th>Cost</th><th>Travel</th>
</tr>
<tr>
<td>Portadown</td><td>1</td><td>/$1,000</td><td>[url='airport.php?city=portadown']Go[/url]</td>
</tr>
<tr>
<td>London</td><td>5</td><td>/$3,000</td><td>[url='airport.php?city=london']Go[/url]</td>
</tr>
<tr>
<td>Washington</td><td>10</td><td>/$5,000</td><td>[url='airport.php?city=washington']Go[/url]</td>
</tr>
<tr>
<td>Paris</td><td>20</td><td>/$7,500</td><td>[url='airport.php?city=paris']Go[/url]</td>
</tr>
<tr>
<td>Berlin</td><td>30</td><td>/$10,000</td><td>[url='airport.php?city=berlin']Go[/url]</td>
</tr>
<tr>
<td>Las Vegas</td><td>40</td><td>/$12,500</td><td>[url='airport.php?city=vegas']Go[/url]</td>
</tr>
<tr>
<td>Kathmandu</td><td>50</td><td>/$15,000</td><td>[url='airport.php?city=vegas']Go[/url]</td>
</tr> ";


function portadown()
{
if ($ir['level'] > 0 and $ir['money'] >999)
{
$db->query("UPDATE users SET money=money-1000,location=1 WHERE userid=$userid");
print "You paid /$1,000 to travel to Portadown";
}
elseif ($ir['level'] < 2)
{
print "You are not high enoguh level to go here!";
}
elseif ($ir['money'] < 1000)
{
print "You don't have enough money to cover the ticket";
}
}

function london()
{
if ($ir['level'] > 4 and $r['money'] >2999)
{
$db->query("UPDATE users SET money=money-3000,location=2 WHERE userid=$userid");
print "You paid /$3,000 to travel to London";
}
elseif (($ir['level']) < 6)
{
print "You are not high enough level to go here!";
}
elseif ($r['money'] < 3000)
{
print "You don't have enough money to cover the ticket";
}
}

function washington()
{
if ($ir['level'] > 9 and $ir['money'] >4999)
{
$db->query("UPDATE users SET money=money-5000,location=3 WHERE userid=$userid");
print "You paid /$5,000 to travel to Washington";
}
elseif ($ir['level'] < 11)
{
print "You are not high enoguh level to go here!";
}
elseif ($ir['money'] < 5000)
{
print "You don't have enough money to cover the ticket";
}
}

function paris()
{
if ($ir['level'] > 19 and $ir['money'] >7499)
{
$db->query("UPDATE users SET money=money-7500,location=4 WHERE userid=$userid");
print "You paid /$7,500 to travel to Paris";
}
elseif ($ir['level'] < 21)
{
print "You are not high enoguh level to go here!";
}
elseif ($ir['money'] < 7500)
{
print "You don't have enough money to cover the ticket";
}
}

function berlin()
{
if ($ir['level'] > 29 and $ir['money'] >9999)
{
$db->query("UPDATE users SET money=money-10000,location=5 WHERE userid=$userid");
print "You paid /$10,000 to travel to Berlin";
}
elseif ($ir['level'] < 31)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 10000)
{
print "You don't have enough money to cover the ticket";
}
}

function vegas()
{
if ($ir['level'] > 39 and $ir['money'] >12499)
{
$db->query("UPDATE users SET money=money-12500,location=6 WHERE userid=$userid");
print "You paid /$12,500 to travel to Las Vegas";
}
elseif ($ir['level'] < 41)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 12500)
{
print "You don't have enough money to cover the ticket";
}
}

function kathmandu()
{
if ($ir['level'] > 49 and $ir['money'] >14999)
{
$db->query("UPDATE users SET money=money-15000,location=7 WHERE userid=$userid");
print "You paid /$12,500 to travel to Kathmandu 
This is a very cold place!";
}
elseif ($ir['level'] < 51)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 15000)
{
print "You don't have enough money to cover the ticket";
}
}
$h->endpage();
?>

fixed.. or i think so.. not tested.

Link to comment
Share on other sites

Re: Need help with a custom airport thing - Keep it if you can fix!

i wonder what the point of the chagne is? why not just chagne the monorail.php?

But if your wanting this....Here ya go.

 

<?php

include "globals.php";

switch($_GET['city'])
{
case 'portadown': portadown(); break;
case 'london': london(); break;
case 'washington': washington(); break;
case 'paris': paris(); break;
case 'berlin': berlin(); break;
case 'vegas': vegas(); break;
case 'kathmandu': kathmandu(); break;
default: index(); break;
}

function index()//Problem you had no main page.
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the global
echo "
<table class='table' width='65%' cellpadding='2'>
	<tr>
		<th>City</th>
		<th>Level</th>
		<th>Cost</th>
		<th>Travel</th>
	</tr>
	<tr>
		<td>Portadown</td>
		<td>1</td><td>/$1,000</td>
		<td>[url='airport.php?city=portadown']Go[/url]</td>
	</tr>
	<tr>
		<td>London</td>
		<td>5</td>
		<td>/$3,000</td>
		<td>[url='airport.php?city=london']Go[/url]</td>
	</tr>
	<tr>
		<td>Washington</td>
		<td>10</td>
		<td>/$5,000</td>
		<td>[url='airport.php?city=washington']Go[/url]</td>
	</tr>
	<tr>
		<td>Paris</td>
		<td>20</td>
		<td>/$7,500</td>
		<td>[url='airport.php?city=paris']Go[/url]</td>
	</tr>
	<tr>
			<td>Berlin</td>
			<td>30</td>
			<td>/$10,000</td>
			<td>[url='airport.php?city=berlin']Go[/url]</td>
	</tr>
	<tr>
		<td>Las Vegas</td>
		<td>40</td>
		<td>/$12,500</td>
		<td>[url='airport.php?city=vegas']Go[/url]</td>
	</tr>
	<tr>
		<td>Kathmandu</td>
		<td>50</td>
		<td>/$15,000</td>
		<td>[url='airport.php?city=vegas']Go[/url]</td>
	</tr>
</table>";
}

function portadown()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($ir['money'] < 1000)
{
	print "You don't have enough money to cover the ticket";
}	
else if($ir['level'] < 1)
{
	print "You are not high enoguh level to go here!";
}
else($ir['level'] > 0 and $ir['money'] >999)
{
	$db->query("UPDATE users SET money=money-1000,location=1 WHERE userid=$userid");
	print "You paid /$1,000 to travel to Portadown";
}
}

function london()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($r['money'] < 3000)
{
	print "You don't have enough money to cover the ticket";
}	

if($ir['level'] > 4 and $r['money'] >2999)
{
	$db->query("UPDATE users SET money=money-3000,location=2 WHERE userid=$userid");
	print "You paid /$3,000 to travel to London";
}
else if($ir['level'] < 5)
{
	print "You are not high enough level to go here!";
}
else($ir['level'] > 4 and $ir['money'] >2999)
{
	$db->query("UPDATE users SET money=money-3000,location=2 WHERE userid=$userid");
	print "You paid /$3,000 to travel to London";
}
}

function washington()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($ir['money'] < 5000)
{
	print "You don't have enough money to cover the ticket";
}	
else if($ir['level'] < 10)
{
	print "You are not high enoguh level to go here!";
}
else($ir['level'] > 9 and $ir['money'] >4999)
{
	$db->query("UPDATE users SET money=money-5000,location=3 WHERE userid=$userid");
	print "You paid /$5,000 to travel to Washington";
}
}

function paris()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($ir['money'] < 7500)
{
	print "You don't have enough money to cover the ticket";
}
else if($ir['level'] < 20)
{
	print "You are not high enoguh level to go here!";
}		
else($ir['level'] > 19 and $ir['money'] >7499)
{
	$db->query("UPDATE users SET money=money-7500,location=4 WHERE userid=$userid");
	print "You paid /$7,500 to travel to Paris";
}
}

function berlin()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($ir['money'] < 10000)
{
	print "You don't have enough money to cover the ticket";
}
else if($ir['level'] < 30)
{
	print "You are not high enough level to go here!";
}
else($ir['level'] > 29 and $ir['money'] >9999)
{	
	$db->query("UPDATE users SET money=money-10000,location=5 WHERE userid=$userid");
	print "You paid /$10,000 to travel to Berlin";
}
}

function vegas()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($ir['money'] < 12500)
{
	print "You don't have enough money to cover the ticket";
}
else if($ir['level'] < 40)
{
	print "You are not high enough level to go here!";
}
else($ir['level'] > 39 and $ir['money'] >12499)
{
	$db->query("UPDATE users SET money=money-12500,location=6 WHERE userid=$userid");
	print "You paid /$12,500 to travel to Las Vegas";
}
}

function kathmandu()
{
global $ir, $userid, $h, $db; //This was your problem. You didn't give the globals
if($ir['money'] < 15000)
{
	print "You don't have enough money to cover the ticket";
}
else if($ir['level'] < 50)
{
	print "You are not high enough level to go here!";
}
else($ir['level'] > 49 and $ir['money'] >14999)
{
	$db->query("UPDATE users SET money=money-15000,location=7 WHERE userid=$userid");
	print "You paid /$12,500 to travel to Kathmandu 
This is a very cold place!";
}
}

$h->endpage();
?>

 

could problems in there...You didn't set a index.. (Default for the page).

And you have to use global on each function thats why it said you had not enough money.

Also you migh notice i changed the order of your else. and ifs..and stuff..Also make blocks first..

Like example

if you have enough money block

else if you are high enough level block

else if your brave is high enough block

else we are good do it.

Also last one in line should be else not else if.

Link to comment
Share on other sites

Re: Need help with a custom airport thing - Keep it if you can fix!

i did change the something on the first script i posted and it did fixed some stuffs.

this second script fixes the error you got.(tested)

 

<?php
include "globals.php";
switch($_GET['city'])
{
case 'portadown': portadown(); break;
case 'london': london(); break;
case 'washington': washington(); break;
case 'paris': paris(); break;
case 'berlin': berlin(); break;
case 'vegas': vegas(); break;
case 'kathmandu': kathmandu(); break;
}

print "<table class='table' width='65%' cellpadding='2'>
<tr>
<th>City</th><th>Level</th><th>Cost</th><th>Travel</th>
</tr>
<tr>
<td>Portadown</td><td>1</td><td>\$1,000</td><td>[url='airport.php?city=portadown']Go[/url]</td>
</tr>
<tr>
<td>London</td><td>5</td><td>\$3,000</td><td>[url='airport.php?city=london']Go[/url]</td>
</tr>
<tr>
<td>Washington</td><td>10</td><td>\$5,000</td><td>[url='airport.php?city=washington']Go[/url]</td>
</tr>
<tr>
<td>Paris</td><td>20</td><td>\$7,500</td><td>[url='airport.php?city=paris']Go[/url]</td>
</tr>
<tr>
<td>Berlin</td><td>30</td><td>\$10,000</td><td>[url='airport.php?city=berlin']Go[/url]</td>
</tr>
<tr>
<td>Las Vegas</td><td>40</td><td>\$12,500</td><td>[url='airport.php?city=vegas']Go[/url]</td>
</tr>
<tr>
<td>Kathmandu</td><td>50</td><td>\$15,000</td><td>[url='airport.php?city=vegas']Go[/url]</td>
</tr> ";


function portadown()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 0 and $ir['money'] >999)
{
$db->query("UPDATE users SET money=money-1000,location=1 WHERE userid=$userid");
print "You paid \$1,000 to travel to Portadown";
}
else if ($ir['level'] < 2)
{
print "You are not high enough level to go here!";
}
else if ($ir['money'] < 1)
{
print "You don't have enough money to cover the ticket";
}
}

function london()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 4 and $r['money'] >2999)
{
$db->query("UPDATE users SET money=money-3000,location=2 WHERE userid=$userid");
print "You paid \$3,000 to travel to London";
}
elseif (($ir['level']) < 6)
{
print "You are not high enough level to go here!";
}
elseif ($r['money'] < 3000)
{
print "You don't have enough money to cover the ticket";
}
}

function washington()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 9 and $ir['money'] >4999)
{
$db->query("UPDATE users SET money=money-5000,location=3 WHERE userid=$userid");
print "You paid \$5,000 to travel to Washington";
}
elseif ($ir['level'] < 11)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 5000)
{
print "You don't have enough money to cover the ticket";
}
}

function paris()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 19 and $ir['money'] >7499)
{
$db->query("UPDATE users SET money=money-7500,location=4 WHERE userid=$userid");
print "You paid \$7,500 to travel to Paris";
}
elseif ($ir['level'] < 21)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 7500)
{
print "You don't have enough money to cover the ticket";
}
}

function berlin()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 29 and $ir['money'] >9999)
{
$db->query("UPDATE users SET money=money-10000,location=5 WHERE userid=$userid");
print "You paid \$10,000 to travel to Berlin";
}
elseif ($ir['level'] < 31)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 10000)
{
print "You don't have enough money to cover the ticket";
}
}

function vegas()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 39 and $ir['money'] >12499)
{
$db->query("UPDATE users SET money=money-12500,location=6 WHERE userid=$userid");
print "You paid \$12,500 to travel to Las Vegas";
}
elseif ($ir['level'] < 41)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 12500)
{
print "You don't have enough money to cover the ticket";
}
}

function kathmandu()
{
global $db,$ir,$c,$userid,$h;
if ($ir['level'] > 49 and $ir['money'] >14999)
{
$db->query("UPDATE users SET money=money-15000,location=7 WHERE userid=$userid");
print "You paid \$12,500 to travel to Kathmandu 
This is a very cold place!";
}
elseif ($ir['level'] < 51)
{
print "You are not high enough level to go here!";
}
elseif ($ir['money'] < 15000)
{
print "You don't have enough money to cover the ticket";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...