Seker Posted June 19, 2012 Share Posted June 19, 2012 Haven't seen many new free mods around, lately, so I thought I would share this with everyone. It's a little twist on Streets to keep your players active while sitting in the hospital. Players get 50 steps per day, only to be used while in the hospital. While exploring the halls, they have a chance at refilling their energy, getting out of the hospital, nothing happening at all, or even increasing their hospital time. Just figured this is one more little feature to keep players busy. Hope you can find some use for it. SQL: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. hospexplore.php: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Add to cron_day: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Add somewhere in your hospital or wherever you want it: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Screenshot: [ATTACH=CONFIG]499[/ATTACH] 1 Quote Link to comment Share on other sites More sharing options...
Seker Posted June 19, 2012 Author Share Posted June 19, 2012 (edited) And, for those who will ask, here's V2: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Add to cron_day: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. SQL is the same. Edited June 21, 2012 by Seker 1 Quote Link to comment Share on other sites More sharing options...
sniko Posted June 19, 2012 Share Posted June 19, 2012 You may want to make that query more efficient on resources; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. to You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Otherwise, good modification! It'll be cool if the system relied on something, other than a random number, for example, a user stat :? Quote Link to comment Share on other sites More sharing options...
Lithium Posted June 19, 2012 Share Posted June 19, 2012 You may want to make that query more efficient on resources; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. to You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Actually... resources wise, the first query is more efficient! one step to update all users second one... one step finds users where value applies, second step updates! Quote Link to comment Share on other sites More sharing options...
Seker Posted June 19, 2012 Author Share Posted June 19, 2012 You may want to make that query more efficient on resources; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. to You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Otherwise, good modification! It'll be cool if the system relied on something, other than a random number, for example, a user stat :? I just realized I mis-typed, anyway. Should be: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. The stat-base idea is interesting. Perhaps a formula similar to the way the crime success rate is calculated. I'll have to look into that. Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted June 20, 2012 Share Posted June 20, 2012 Some strange things in there but freebies always nice to see. Well done Seker. Quote Link to comment Share on other sites More sharing options...
The Coder Posted June 20, 2012 Share Posted June 20, 2012 You guys are amazing at coding! Nice work, I'll surely test this out, thanks! :) Quote Link to comment Share on other sites More sharing options...
Seker Posted June 20, 2012 Author Share Posted June 20, 2012 Some strange things in there but freebies always nice to see. Well done Seker. Strange? Please elaborate. I always want to improve what I'm doing, so if there's something unnecessary, or just flat out wrong, I'd love to know about it. :) Quote Link to comment Share on other sites More sharing options...
lynm77 Posted June 20, 2012 Share Posted June 20, 2012 Seker Tried this out but Seem to be getting the same result ever time The doctor ordered bedrest! Your hospital time has increased! Think there may be an problem Quote Link to comment Share on other sites More sharing options...
mixmaster Posted June 20, 2012 Share Posted June 20, 2012 (edited) Seker Tried this out but Seem to be getting the same result ever time The doctor ordered bedrest! Your hospital time has increased! Think there may be an problem replace You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. with if ($result == 1) { $db->query("UPDATE users SET hospital=hospital+5 WHERE userid=$userid"); echo " The doctor ordered bedrest! Your hospital time has increased! <a href='hospexplore.php?action=explore'>[Continue Exploring]</a> <a href='hospital.php'>[back]</a>"; exit($h->endpage()); } else if ($result == 2) { $db->query("UPDATE users SET energy=$maxenergy WHERE userid=$userid"); echo " You stopped at the vending machine and got a coffee. You feel re-energized! <a href='hospexplore.php?action=explore'>[Continue Exploring]</a> <a href='hospital.php'>[back]</a>"; exit($h->endpage()); } else if ($result == 3) { $db->query("UPDATE users SET hospital=0 WHERE userid=$userid"); echo " You stumbled across the back exit! Time to get out of here! <a href='index.php'>[Home]</a>"; exit($h->endpage()); } else { echo " This hospital is huge! You haven't found anything, yet! <a href='hospexplore.php?action=explore'>[Continue Exploring]</a> <a href='hospital.php'>[back]</a>"; exit($h->endpage()); } } $h->endpage(); You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and $hsteps = $ir['hsteps']; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. with $hsteps = $ir['hsteps']; $maxenergy = $ir['maxenergy']; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and $rand = rand(1,5); You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. with $rand = rand(1,3); You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Edited June 20, 2012 by mixmaster Quote Link to comment Share on other sites More sharing options...
The Coder Posted June 20, 2012 Share Posted June 20, 2012 Hey Seker, I keep getting this error:- Parse error: syntax error, unexpected '"' in /home/infamo67/public_html/hospexplore.php on line 20 I'm not very sure whats wrong with line 20. :S Quote Link to comment Share on other sites More sharing options...
lynm77 Posted June 20, 2012 Share Posted June 20, 2012 Just one problem now. It allowing step go into Negative You currently have -2 more chances to explore! Don't waste them! Cheers Quote Link to comment Share on other sites More sharing options...
Seker Posted June 21, 2012 Author Share Posted June 21, 2012 Okay, I think I'm going to redo this. I typed this up in about ten-fifteen minutes in Notepad++. Looked okay and I assumed it would work when it didn't throw any errors on the test server. My apologies, guys. I'll get it all fixed. Quote Link to comment Share on other sites More sharing options...
mixmaster Posted June 21, 2012 Share Posted June 21, 2012 Just one problem now. It allowing step go into Negative You currently have -2 more chances to explore! Don't waste them! Cheers replace You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. with You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
lynm77 Posted June 21, 2012 Share Posted June 21, 2012 No luck with this change. It has stopped going to negative. But allows you to keep searching even if you have no steps left Cheers Quote Link to comment Share on other sites More sharing options...
Seker Posted June 21, 2012 Author Share Posted June 21, 2012 No luck with this change. It has stopped going to negative. But allows you to keep searching even if you have no steps left Cheers Try changing this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. To this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Don't know why I did that backwards. Quote Link to comment Share on other sites More sharing options...
lynm77 Posted June 21, 2012 Share Posted June 21, 2012 Hello Seker No not working still going in to negative. Cheers Quote Link to comment Share on other sites More sharing options...
mixmaster Posted June 21, 2012 Share Posted June 21, 2012 (edited) ``````````````````````````````` No luck with this change. It has stopped going to negative. But allows you to keep searching even if you have no steps left Cheers this will work now You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Edited June 21, 2012 by mixmaster Quote Link to comment Share on other sites More sharing options...
Seker Posted June 21, 2012 Author Share Posted June 21, 2012 ``````````````````````````````` this will work now You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Appreciate you getting it to work. Hadn't had time to re-do it, yet. Will update the original post and make sure there's a "Fixed By" credit in there. :) Quote Link to comment Share on other sites More sharing options...
lynm77 Posted June 21, 2012 Share Posted June 21, 2012 No still getting an error QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE userid=1' at line 1 Query was UPDATE users SET energy= WHERE userid=1 Cheers Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted June 21, 2012 Share Posted June 21, 2012 $maxenergy is not global therefore cannot be called as it is in the query. function do_explore() { global $ir, $h, $c, $userid, $db; Should be function do_explore() { global $ir, $h, $c, $userid, $db, $maxenergy; or you could just change the query to use $ir['maxenergy'] instead and delete both lines 7 and 8. Line 7 isnt referred to at all as far as i can tell which it could have been by also adding to the globals $hsteps. Quote Link to comment Share on other sites More sharing options...
mixmaster Posted June 21, 2012 Share Posted June 21, 2012 No still getting an error QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE userid=1' at line 1 Query was UPDATE users SET energy= WHERE userid=1 Cheers i have a meeting soon , so as soon as i get back , i will re-do it all for you Quote Link to comment Share on other sites More sharing options...
lynm77 Posted June 21, 2012 Share Posted June 21, 2012 Thanks to all for help All is working now Cheers Quote Link to comment Share on other sites More sharing options...
mixmaster Posted June 21, 2012 Share Posted June 21, 2012 $maxenergy is not global therefore cannot be called as it is in the query. function do_explore() { global $ir, $h, $c, $userid, $db; Should be function do_explore() { global $ir, $h, $c, $userid, $db, $maxenergy; or you could just change the query to use $ir['maxenergy'] instead and delete both lines 7 and 8. Line 7 isnt referred to at all as far as i can tell which it could have been by also adding to the globals $hsteps. ah yes , i forgot about that lol , a bit too tired at that time in the morning lol Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 17, 2016 Share Posted March 17, 2016 Sounds really cool, except it doesn't seem to be giving steps to use. I thought it might be the cron/wait but ran the cron_day and still nothing. 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.