Agon Posted June 20, 2010 Share Posted June 20, 2010 I got this idea from another old game I worked on. Users could travel, but they had to wait for the train, plane, bus to arrive. So the idea is. If you travel using the monorail.php, you have a travel timer that makes you wait X amount of minutes before you can travel again. For example, you travel to another city and it makes it so you have to wait ten minutes before you can travel again. Why? Here's the fun part... Two players have a rivalry and attack each other all the time. This encourages a game of cat and mouse, where the weaker player is hopping from city to city to avoid attack, and the attacking player has to try to time it just right to get into that location at the same time. The idea popped into my mind, so I figured I'd post it over here to keep reference on it. Thanks! Quote Link to comment Share on other sites More sharing options...
Faz` Posted June 20, 2010 Share Posted June 20, 2010 I might attempt this later, but I think this is what your trying to say. Run this query in your database: [mysql]ALTER TABLE `users` ADD `traveltime` INT(11) NOT NULL[/mysql] Then add a query in monorail.php, (where the location changing query is, don't have the file open so I can't say) that updates the `traveltime` row when they travel to another place. : $updateTravelTime = "UPDATE `users` SET `traveltime` = `traveltime`+ 10 WHERE `userid` = $userid"; mysql_query($updateTravelTime); Then add this in the appropriate place: $selectTravelTime = "SELECT `traveltime` FROM `users` WHERE `userid` = $userid"; $do_selectTravelTime = mysql_query($selectTravelTime); $traveltime = mysql_fetch_assoc($do_selectTravelTime); Now underneath all that, the IF statement: if($ir['traveltime'] > 0) { echo 'Sorry, you have to wait $traveltime minutes before you can travel again!'; $h->endpage(); exit; } Now, in cron_minute.php add: $minusTravelTime = "UPDATE `users` SET `traveltime` = `traveltime` - 1 WHERE `userid` = $userid"; mysql_query($minusTravelTime); This is untested, I simply wrote it in this reply box. I didn't have the file open so I dunno if it will work. Let me know if you decide to try it, I'll be glad to help if it doesn't. Quote Link to comment Share on other sites More sharing options...
Agon Posted June 21, 2010 Author Share Posted June 21, 2010 I'll try it out today. Quote Link to comment Share on other sites More sharing options...
Agon Posted June 21, 2010 Author Share Posted June 21, 2010 testing on V2 monorail.php $selectTravelTime = "SELECT `traveltime` FROM `users` WHERE `userid` = $userid"; $do_selectTravelTime=$db->query($selectTravelTime); $traveltime=$db->fetch_row($do_selectTravelTime); if($ir['traveltime'] > 0) { echo 'Sorry, you have to wait $traveltime minutes before you can travel again!'; $h->endpage(); exit; } $updateTravelTime = "UPDATE `users` SET `traveltime` = `traveltime`+ 10 WHERE `userid` = $userid"; $db->query($updateTravelTime); cron_minute.php $db->query("UPDATE users SET traveltime=traveltime-1 WHERE traveltime>0"); Got it working on V2 with this, except one thing. It prints "Sorry, you have to wait $traveltime minutes before you can travel again!" instead of displaying the minutes. Not sure why. Quote Link to comment Share on other sites More sharing options...
Dayo Posted June 21, 2010 Share Posted June 21, 2010 try echo 'Sorry, you have to wait '.$ir['traveltime'].' minutes before you can travel again!'; Quote Link to comment Share on other sites More sharing options...
Agon Posted June 21, 2010 Author Share Posted June 21, 2010 Sweet. Works great on V2. Thanks to Faz and Dayo. Quote Link to comment Share on other sites More sharing options...
Dayo Posted June 21, 2010 Share Posted June 21, 2010 lol all i did was add '.$ir['traveltimer'].' also you dont need this $selectTravelTime = "SELECT `traveltime` FROM `users` WHERE `userid` = $userid"; $do_selectTravelTime=$db->query($selectTravelTime); $traveltime=$db->fetch_row($do_selectTravelTime); as it is preselected in $ir Quote Link to comment Share on other sites More sharing options...
Faz` Posted June 22, 2010 Share Posted June 22, 2010 My bad. Haven't really worked with Mccodes in a while. Slowly getting back into programming, getting better slowly but surely :) Quote Link to comment Share on other sites More sharing options...
Dayo Posted June 22, 2010 Share Posted June 22, 2010 we all have those days, i just spent 1/2 an hour figuring out why a number was only going to 2bilion something .... dur int() :P[/rant] Quote Link to comment Share on other sites More sharing options...
Faz` Posted June 23, 2010 Share Posted June 23, 2010 Lol, those days eh? Quote Link to comment Share on other sites More sharing options...
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.