-
Posts
863 -
Joined
-
Last visited
-
Days Won
4
Content Type
Profiles
Forums
Events
Everything posted by Razor42
-
Hi guys, Something small I have juts finished for a personal project, it's just a simple edit to the travel system which allows you to add time to travel. First lets add the SQL's: ALTER TABLE `cities` ADD `time` INT(11) default '0'; ALTER TABLE `users` ADD `traveltime` INT(11) default '0'; Then open up staff_cities.php add change to: <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //This contains city stuffs switch($_GET['action']) { case "addcity": addcity(); break; case "editcity": editcity(); break; case "delcity": delcity(); break; default: print "Error: This script requires an action."; break; } function addcity() { global $db, $ir, $c, $h, $userid; $minlevel= (array_key_exists('minlevel', $_POST) && ctype_digit($_POST['minlevel'])) ? $_POST['minlevel'] : null; $time = (array_key_exists('time', $_POST) && ctype_digit($_POST['time'])) ? $_POST['time'] : null; $name= mysql_real_escape_string($_POST['name']); $desc= mysql_real_escape_string($_POST['desc']); if($minlevel and $desc and $name) { $q=$db->query("SELECT * FROM cities WHERE cityname='{$name}'"); if($db->num_rows($q)) { print "Sorry, you cannot have two cities with the same name."; $h->endpage(); exit; } $db->query("INSERT INTO cities VALUES(NULL, '$name', '$desc', '$minlevel', '$time')"); print "City {$name} added to the game."; stafflog_add("Created City $name"); } else { print "<h3>Add City</h3><hr /> <form action='staff_cities.php?action=addcity' method='post'> Name: <input type='text' name='name' /><br /> Description: <input type='text' name='desc' /><br /> Minimum Level: <input type='text' name='minlevel' /><br /> Time: <input type='text' name='time' /><br /> <input type='submit' value='Add City' /></form>"; } } function editcity() { global $db, $ir, $c, $h, $userid; switch($_POST['step']) { case "2": $minlevel= (array_key_exists('minlevel', $_POST) && ctype_digit($_POST['minlevel'])) ? $_POST['minlevel'] : null; $time = (array_key_exists('time', $_POST) && ctype_digit($_POST['time'])) ? $_POST['time'] : null; $name= mysql_real_escape_string($_POST['name']); $desc= mysql_real_escape_string($_POST['desc']); $q=$db->query("SELECT * FROM cities WHERE cityname='{$name}' AND cityid!={$_POST['id']}"); if($db->num_rows($q)) { print "Sorry, you cannot have two cities with the same name."; $h->endpage(); exit; } $q=$db->query("SELECT * FROM cities WHERE cityid={$_POST['id']}"); $old=$db->fetch_row($q); $db->query("UPDATE cities SET cityminlevel=$minlevel, citydesc='$desc', cityname='$name', time='$time' WHERE cityid={$_POST['id']}"); print "City $name was edited successfully."; stafflog_add("Edited city $name"); break; case "1": $q=$db->query("SELECT * FROM cities WHERE cityid={$_POST['city']}"); $old=$db->fetch_row($q); print "<h3>Editing a City</h3><hr /> <form action='staff_cities.php?action=editcity' method='post'> <input type='hidden' name='step' value='2' /> <input type='hidden' name='id' value='{$_POST['city']}' /> Name: <input type='text' name='name' value='{$old['cityname']}' /><br /> Description: <input type='text' name='desc' value='{$old['citydesc']}' /><br /> Minimum Level: <input type='text' name='minlevel' value='{$old['cityminlevel']}' /><br /> Time: <input type='text' name='time' value='{$old['time']}' /><br /> <input type='submit' value='Edit City' /></form>"; break; default: print "<h3>Editing a City</h3><hr /> <form action='staff_cities.php?action=editcity' method='post'> <input type='hidden' name='step' value='1' /> City: ".location_dropdown($c, "city")."<br /> <input type='submit' value='Edit City' /></form>"; break; } } function delcity() { global $db,$ir,$c,$h,$userid; if($_POST['city']) { $q=$db->query("SELECT * FROM cities WHERE cityid={$_POST['city']}"); $old=$db->fetch_row($q); if($old['cityid']==1) { die("This city cannot be deleted."); } $db->query("UPDATE users SET location=1 WHERE location={$old['cityid']}"); $db->query("UPDATE shops SET shopLOCATION=1 WHERE shopLOCATION={$old['cityid']}"); $db->query("DELETE FROM cities WHERE cityid={$old['cityid']}"); print "City {$old['cityname']} deleted."; stafflog_add("Deleted city {$old['cityname']}"); } else { print "<h3>Delete City</h3><hr /> Deleting a city is permanent - be sure. Any users and shops that are currently in the city you delete will be moved to the default city (ID 1).<form action='staff_cities.php?action=delcity' method='post'> City: ".location_dropdown($c, "city")."<br /> <input type='submit' value='Delete City' /></form>"; } } function report_clear() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] > 3) { die("403"); } $_GET['ID'] = abs((int) $_GET['ID']); stafflog_add("Cleared player report ID {$_GET['ID']}"); $db->query("DELETE FROM preports WHERE prID={$_GET['ID']}"); print "Report cleared and deleted!<br /> <a href='staff_users.php?action=reportsview'>> Back</a>"; } $h->endpage(); ?> After that we need to find monorail.php and change it's name the travel.php and then replace it with: <?php include_once 'globals.php'; $_GET['to'] = (array_key_exists('to', $_GET) && ctype_digit($_GET['to'])) ? $_GET['to'] : null; if(!$_GET['to']) { print "Welcome to the travel centre. It costs \$5000 for a ticket.<br /> Where would you like to travel today?<br />"; $q=$db->query("SELECT * FROM cities WHERE cityid != {$ir['location']} AND cityminlevel <= {$ir['level']}"); print "<table width=75% class='table'> <th colspan='5'>Cities</th> <tr> <th>Name</th> <th>Description</th> <th>Min Level</th> <th>Travel Time</th> <th> </th></tr>"; while($r=$db->fetch_row($q)) { print " <tr> <td>{$r['cityname']}</td> <td>{$r['citydesc']}</td> <td>{$r['cityminlevel']}</td> <td>{$r['time']}</td> <td><a href='travel.php?to={$r['cityid']}'>Go</a></td> </tr>"; } print "</table>"; } else { if($ir['money'] < 5000) { print "You don't have enough money."; } else if( ((int) $_GET['to']) != $_GET['to']) { print "Invalid city "; } else { $q=$db->query("SELECT * FROM cities WHERE cityid = {$_GET['to']} AND cityminlevel <= {$ir['level']}"); $r=$db->fetch_row($q); 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-5000,location={$_GET['to']} WHERE userid=$userid"); $db->query("UPDATE users SET traveltime=traveltime+{$r['time']} WHERE userid=$userid"); $r=$db->fetch_row($q); print "You have paid \$5000 to travel to {$r['cityname']}! It will take you {$r['time']}!"; } } } $h->endpage(); ?> Then after this we need to open up global_funcs.php and add this function in: function check_travel() { global $db; global $ir,$userid; if($ir['traveltime'] > 0) { print "You have to wait {$ir['traveltime']} before you can access this page as you are travelling!"; exit; } } Open up cron_minute.php and add: $db->query("UPDATE `users` SET traveltime=traveltime - 1 WHERE `traveltime` > 0"); Now you will need to go through all your files and the files which you want to be "unaccessable" while players are travelling just simple enter check_travel(); underneath the line at the top which says include 'globals.php'! Also make sure you change the link in explore.php from monorial.php to travel.php!! I have tested and does work but if you find any issues let me know and I will fix right away!! Enjoy.
-
Yeah I know what you mean It does need something adding. Might try code it up and see what it comes out like!
-
I need some work, where shall I contact you?
-
Screenshot is posted. Will show live preview to serious buyers.
-
Seems like your all taking the piss :) Not looking for buds below $20
-
A link to your blog in your signature would be cool Kyle.
-
I'm going to be moving host at te end of this month
-
Sounds cool!
-
It's not finished how can it be for sale?
-
Which of you guys still develop "paid" mods for McCodes?
Razor42 replied to Zephyr's topic in Paid Modifications
I still create mods upon request but I don't really release then anymore as when I have done they've gained very little sales. Although I did make a big new housing system which I planned to sell I have decided to keep it for my upcoming project and not sell it. -
Thanks for the advice guys, will check these out tomorrow and see what happens.
-
Hi guys, Having a little issue with my crons, they don’t seem to be running at all and I don’t have a clue why. Any ideas? [ATTACH=CONFIG]1202[/ATTACH]
-
http://makewebgames.io/showthread.php/43760-Gangster-Layout-For-Sale That's still for sale! PSD and fully coded! Link won't work but Dave has posted an image of it on there.
-
Hi guys, Haven’t posted much around here in a while and have been quite bored the past few days so started messing around on Photoshop and came up with this layout. What do you guys think? [ATTACH=CONFIG]1199[/ATTACH]
-
Curt won and had bought! Bidding closed!
-
Thanks! Bidding ends today at 15:00!
-
Never agreed to sell to you, you said you wanted but no official offers have been placed.
-
Peter designed and coded the layout
-
Hi guys, I am selling this company/business/portfolio page layout that I have had for ages now and I am yet to make use of!! I will be taking bids and bidding will end on the 13/11/2013 (2 days) this includes the images, PSD and fully coded into HTML/CSS! Highest bidder will get the layout simple as! Layout can be seen at: http://razorstesting.x10.mx/CG/ Min Bid: $30 Layout was created by Peter
-
I like it, any offers been placed yet?
-
I too recommend mail chimp! It has great tools and is excellent for setting up newsletters! It's also free if you have under a certain amount of subscribers which is great!
-
So basically something like the arson system which was made for the old housing system?
-
Planning office is now fully finished!! Things Left to do: -Managing your buildings. -Renting of your buildings. -Selling your building to bank. -Upgrading your buildings. (May or May not do!) -Addition to staff files for creating upgrades. (May or may not do! -Buildings sales market. Any one got any extra suggestions/ideas?
-