Chuckster Posted July 25, 2010 Posted July 25, 2010 Whats the easiest way to go around making donator only citys??? Quote
Danny696 Posted July 25, 2010 Posted July 25, 2010 Add a column in the city table. Then when there traveling check it :) Quote
Chuckster Posted July 26, 2010 Author Posted July 26, 2010 ok. Put it in steps of exactly what to do please :) Quote
corruptcity || skalman Posted July 26, 2010 Posted July 26, 2010 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 Quote
Danny696 Posted July 26, 2010 Posted July 26, 2010 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>"; Quote
Haunted Dawg Posted July 26, 2010 Posted July 26, 2010 Now now danny, why not post them the city edit also while you at it? :P Quote
Danny696 Posted July 26, 2010 Posted July 26, 2010 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> Quote
Chuckster Posted July 26, 2010 Author Posted July 26, 2010 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 ;) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.