markvaughn2006 Posted September 23, 2009 Share Posted September 23, 2009 I'm making a php game, ok..user gets attacked, I got it to set his "location" to "hospital" and I'm fine with the attacked person not knowing he has been attacked until he leaves the area that he was attacked in, I can't figure out how to restrict that persons actions while in the hospital when they do leave though... Basically here is an example, when you go to a location - Tavern, the php code sets your location to Tavern, but any suggestion on how to (when the attacked person goes to another location) check if location = "hospital" and then either redirect them to the hospital.php or at least echo -"You got your ass beat" and restrict their actions and movements until they are healed?? I appreciate all you guys help, not asking for actual code just a point in the right direction. Thanks!! Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/ Share on other sites More sharing options...
herghost Posted September 23, 2009 Share Posted September 23, 2009 does the user have some kind of health? If so you could use and if else. Ie if userhealth == 0 then goto hospital.php else continue. Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/#findComment-923722 Share on other sites More sharing options...
mikesta707 Posted September 23, 2009 Share Posted September 23, 2009 if ($location == "Hospital"){ echo "You got owned"; } ? Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/#findComment-923724 Share on other sites More sharing options...
markvaughn2006 Posted September 23, 2009 Author Share Posted September 23, 2009 i basically tried exactly that Mike, but i guess i really need to the reload the page and send it hospital.php, is there a way to do that without that crazy ajax stuff?? thanks for helping Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/#findComment-923726 Share on other sites More sharing options...
herghost Posted September 23, 2009 Share Posted September 23, 2009 if ($location == "Hospital") { echo "You got owned"; header('Location: Hospital.php'); } Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/#findComment-923729 Share on other sites More sharing options...
markvaughn2006 Posted September 23, 2009 Author Share Posted September 23, 2009 God I hope that works!...i'll let you know the result Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/#findComment-923755 Share on other sites More sharing options...
markvaughn2006 Posted September 24, 2009 Author Share Posted September 24, 2009 didn't work...can you help me with that line of logic though.. the header('Location: Hospital.php'); line. I would love for it to be that easy, it totally ignored that line, is there another way of acheiving this?? thanks! Link to comment https://forums.phpfreaks.com/topic/175265-please-help-cant-figure-this-out/#findComment-923864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.