Jump to content
MakeWebGames

Recommended Posts

Posted

go into phpmyadmin in the cities table add donator or somthink like that to it then once you travel there you have an this bit of code this would go near the bit where you select the city where cityid = $_GET['ID']

and after the fetch_row so lets say for this that its $r=$db->fetch_row($whatever); as i dont have a copy of mccodes on this OS im on atm i cant double check

if($r['donator'] == 1)

{

if($ir['donatordays > 0)

{

$db->query("UPDATE users SET location = $_GET['ID']

}

else

{

echo"Sorry only donators can go visit that city

Back";

$h->endpage();

exit;

}

now ino ive not finished it and its only a rough idea of how todo it i would test it/ make a working version if i was on my other OS that has my xampp running on it

Posted

Try This:

Run this in PHPMyAdmin

[mysql]ALTER TABLE `cities` ADD `donator` INT(1) NOT NULL DEFAULT 0;[/mysql]

Open monorail.php

Find:

else
{
$q=$db->query("SELECT * FROM cities WHERE cityid = {$_GET['to']} AND cityminlevel <= {$ir['level']}");
if(!$db->num_rows($q))
{
print "Error, this city either does not exist or you cannot go there.";
}
else
{
$db->query("UPDATE users SET money=money-1000,location={$_GET['to']} WHERE userid=$userid");
$r=$db->fetch_row($q);
print "Congratulations, you paid \$1000 and travelled to {$r['cityname']} on the monorail!";
}
}

Replace with:

else
{
$q=$db->query("SELECT * FROM cities WHERE cityid = {$_GET['to']} AND cityminlevel <= {$ir['level']}");
if(!$db->num_rows($q))
{
print "Error, this city either does not exist or you cannot go there.";
}
else
{
$r=$db->fetch_row($q);
if($r['donator'] == 1 && $ir['donatordays'] == 0) {
echo'Sorry, but this is a donator only city and your not a donator.';
exit();
}
$db->query("UPDATE users SET money=money-1000,location={$_GET['to']} WHERE userid=$userid");
print "Congratulations, you paid \$1000 and travelled to {$r['cityname']} on the monorail!";
}
}

Find:

print "<table width=75% cellspacing=1 class='table'><tr style='background:gray'><th>Name</th><th>Description</th><th>Min Level</th><th></th></tr>";

Replace with:

print "<table width=75% cellspacing=1 class='table'>
<tr style='background:gray'>
<th>Name</th>
<th>Description</th>
<th>Min Level</th>
<th>Donator Only</th>
<th></th>
</tr>";

Find:

print "<tr><td>{$r['cityname']}</td><td>{$r['citydesc']}</td><td>{$r['cityminlevel']}</td><td>[url='monorail.php?to={$r[']Go[/url]</td></tr>";

Replace with:

print "<tr>
<td>{$r['cityname']}</td>
<td>{$r['citydesc']}</td>
<td>{$r['cityminlevel']}</td>";
echo ($ir['donatordays'] > 0 && $r['donator'] == 1) ? '<span style="color: green;">Donator\'s only.</span>' : '<span style="color: red;">Donator\'s only.</span>';
print"<td>[url='monorail.php?to={$r[']Go[/url]</td></tr>";
Posted

In staff_cities:

Find: (two places)

$desc=$_POST['desc'];

Add after:

$donator = abs(@intval($_POST['desc']));

Find:

$db->query("INSERT INTO cities VALUES(NULL, '$name', '$desc', '$minlevel')");

Replace with:

$db->query("INSERT INTO cities VALUES(NULL, '$name', '$desc', '$minlevel',$donator)");

Find:

Minimum Level: <input type='text' name='minlevel' />

Add after:

Donator only: <select name='donator'>
<option value='1'>Yes</option>
<option value='0'>No</option>
</select>

Find:

$db->query("UPDATE cities SET cityminlevel=$minlevel, citydesc='$desc', cityname='$name' WHERE cityid={$_POST['id']}");

Replace with:

$db->query("UPDATE cities SET cityminlevel=$minlevel, citydesc='$desc', cityname='$name', `donator`=$donator WHERE cityid={$_POST['id']}");

Find:

Minimum Level: <input type='text' name='minlevel' value='{$old['cityminlevel']}' />

 

Donator only: <select name='donator'>
<option value='1'>Yes</option>
<option value='0'>No</option>
</select>
Posted

Thanks alot danny. But just so you know, It doesnt work if you make them donator only citys from staff panel XD Only works if you do it through phpmyadmin XD

Anyway, i would rather do it that way anyway ;)

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.

×
×
  • Create New...