Allow users access to 1 specific page when they are dead
Posted: Sun Jun 22, 2008 8:33 pm
In my ezRPG game, I have successfully been able to stop players from doing anything after they lose a battle, by using this code
Now what I need to do is, allow them to access their inventory page, so they can use their meds, to heal quicker.
On one forum, this was mentioned
but this didn't work.
So I searched google, and was able to come up with this.
but that still didn't work.
Anyone have any suggestions on how to allow users, to access only the inventory.php page when they are in the hospital?
Thanks
Code: Select all
<?php
$playerdead = $db->execute("SELECT p1.username as killedby, Time_Left FROM medical_ward m
INNER JOIN players p1 ON m.Killed_By_ID = p1.id
where playerdead_ID = $player->id");
$playerdead1= $playerdead->fetchrow();
if($playerdead1 [Time_Left] > 0)
{
echo "You were put in the hospital by " .$playerdead1[killedby] ."<p>";
echo "You have \n" . $playerdead1[Time_Left] . "\n Minutes remaining";
exit();
}
?>
On one forum, this was mentioned
Code: Select all
if($playerdead1 [Time_Left] > 0 && $PHP_SELF != 'inventory.php')
{
So I searched google, and was able to come up with this.
Code: Select all
if($playerdead1 [Time_Left] > 0 && $_SERVER['PHP_SELF'] != 'inventory.php')
Anyone have any suggestions on how to allow users, to access only the inventory.php page when they are in the hospital?
Thanks