Jump to content
MakeWebGames

Hospital & Jail Timestamp.


radio_active
 Share

Recommended Posts

Hello

Basically i dont think the cron for hospital is very "effective" and i would like to instead use a Timestamp. This way When a user goes to hospital, the time stamp starts counting there individual time down.

Is this possible or would it mean they would have to be in hospital or jail for the same amount of time each time they go into them as the timestamp can only go down from set times?

If its possible i would like to use this but i need a bit of help.

Thankyou

Link to comment
Share on other sites

Re: Hospital & Jail Timestamp.

You will need a feild in the db and when they go to jail or hospital it puts the timestamp in. First you need to work out the timestamp..

$howlong = 300; // can be any number

$timestamp = time() + $howlong; // this will be a timestamp 5 mins from now

You will want it in the header and also in the viewuser, jailbust, attack ect.

if(time() > $timestamp) {

echo 'NOT IN HOSP OR JAIL';

$h->endpage();

die();

}

That example is very basic but it is something like that.

Link to comment
Share on other sites

Re: Hospital & Jail Timestamp.

Thankyou for your input.

Well if you have

$howlong = 300; // can be any number

set as a certain number that will mean they will be heading to hospital for pretty much the same time every they go to hospital whether it be for being attacked?

Lets say i use the field "hospitaltime" in the users table.

When they are attacked etc they hospitaltime is updated like it is in any instance with a cron. But instead of decreasing through a cron, when the time is greater then 0minutes the timestamp begins.

Link to comment
Share on other sites

Re: Hospital & Jail Timestamp.

a cron will update the database, this will check if the time is correct. say if the time stamp was 100000 and you added 300 onto it (which is 5 mins) when it goes to check it will check against the current time stamp.

With the $howlong you would have a way to set how long, so like a field in the crime table.

Link to comment
Share on other sites

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