Jump to content
MakeWebGames

Hospital Explore


Seker
 Share

Recommended Posts

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]

hospexplore.png.f763a7a58157695be2ce399f050b143a.png

  • Like 1
Link to comment
Share on other sites

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 by Seker
  • Like 1
Link to comment
Share on other sites

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 :?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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 by mixmaster
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

```````````````````````````````

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 by mixmaster
Link to comment
Share on other sites

```````````````````````````````

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. :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

$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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

$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

Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...