radio_active Posted November 19, 2008 Posted November 19, 2008 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 Quote
POG1 Posted November 19, 2008 Posted November 19, 2008 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. Quote
POG1 Posted November 19, 2008 Posted November 19, 2008 Re: Hospital & Jail Timestamp. You could use strtotime() to add to the timestamp, here is a link to the php manual for it.. http://uk2.php.net/manual/en/function.strtotime.php Quote
radio_active Posted November 19, 2008 Author Posted November 19, 2008 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. Quote
POG1 Posted November 19, 2008 Posted November 19, 2008 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. Quote
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.