shrek1609 Posted July 28, 2009 Share Posted July 28, 2009 This kind of works it makes the hospital time countdown in seconds and minutes with a piece of java... (original java script found off google can't leave credit as can't find source again) only problem is as it calls the minutes left from the database if you refresh it will round back up to last minute... ie if you have 5 minutes 30 seconds left and refresh it will go back up to 6 till minute cron changes it to 5 minutes... (can't see a way round this except for using unix time stamps for time in hossy) anyway have a go and post what you think ok for the code... open hospital.php find You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. replace with... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 28, 2009 Author Share Posted July 28, 2009 Re: Hospital Java Countdown Just to add i know people have wanted a java countdown and although this isn't perfect if anyone wants to work on it and make it better please do :-) Quote Link to comment Share on other sites More sharing options...
Guest Sniko` Posted July 28, 2009 Share Posted July 28, 2009 Re: Hospital Java Countdown Just to add i know people have wanted a java countdown and although this isn't perfect if anyone wants to work on it and make it better please do :-) Nice Mod +1 Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 28, 2009 Author Share Posted July 28, 2009 Re: Hospital Java Countdown *** Forgot to say with this method if you refresh time left doesn't jump back up *** ok folks this is more accurate and as its impossible to make it 100% accurate without using 1 second crons, if its slightly out it will display "releasing" in the hospital list... first off run this sql You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. everywhere you send someone to hospital ie attackwon attacklost attackbeat etc insert into the hospital queries the following... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. (1200 is 20 minutes so however many minutes you want times it by 60) an example of altered query You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. you will need to change these queries whereever the hospital field is updated in the database, which i guess is different for you all... now open hospital.php find You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. replace with... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
Guest Sniko` Posted July 28, 2009 Share Posted July 28, 2009 Re: Hospital Java Countdown Nice One ill +1 you up within the Hour Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 28, 2009 Author Share Posted July 28, 2009 Re: Hospital Java Countdown oops sorry you need to add this You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. into hospital.php doesn't matter where so long as its in the while loop Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 28, 2009 Author Share Posted July 28, 2009 Re: Hospital Java Countdown new update... open hospital.php add You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. under You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. find You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. replace with You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. open header.php find You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. replace with You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 28, 2009 Author Share Posted July 28, 2009 Re: Hospital Java Countdown there was a bug with the header code just updated in post above... Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 29, 2009 Share Posted July 29, 2009 Re: Hospital Java Countdown Excellent Addition Shrek :) Deffo gonna +1 ya. Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 29, 2009 Author Share Posted July 29, 2009 Re: Hospital Java Countdown When i said it was impossible to make it 100% accurate i was wrong... its actuall possible to use this unix_timestamp to make hospital time 100% accurate... eg... some one attacks someone 5 seconds before the minute cron runs they will only only end up with 19 minutes and 5 seconds in hossy instead of 20 minutes if you change the attack.php (where it checks if you are in hossy or not to these) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. [/code] then the members will be in hospital for exactly 1,200 seconds (20 minutes) you will need to change places like main menu as well so anywhere the code says You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. change to You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and there you have a 100% accurate java countdown times... and remember you can just follow the exact same process for jail times Quote Link to comment Share on other sites More sharing options...
POG1 Posted July 29, 2009 Share Posted July 29, 2009 Re: Hospital Java Countdown You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Thats the best method, also the title says 'java'. Java is a totally different language to JavaScript. :) *edit: it seems i cannot spel hospital Quote Link to comment Share on other sites More sharing options...
gideon prewett Posted July 29, 2009 Share Posted July 29, 2009 Re: Hospital Java Countdown or spell :-D lol Quote Link to comment Share on other sites More sharing options...
POG1 Posted July 29, 2009 Share Posted July 29, 2009 Re: Hospital Java Countdown or spell :-D lol I spelled it incorrectly on purpose lol Quote Link to comment Share on other sites More sharing options...
Faz` Posted July 29, 2009 Share Posted July 29, 2009 Re: Hospital Java Countdown Spelt :P Quote Link to comment Share on other sites More sharing options...
gideon prewett Posted July 29, 2009 Share Posted July 29, 2009 Re: Hospital Java Countdown ha ha ha ha ha ha ive started somthing now :evil: Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 29, 2009 Author Share Posted July 29, 2009 Re: Hospital Java Countdown This just started out as a cosmetic change (nice countdown numbers) i've now realised that this is quite a massive addition to a game... i am currently in the process of changing everything to the javascript countdown... Which will result in there being no need for the 1 minute cron anymore... now if people are interested i will create a new thread with details on how to change everything in the game to this... so you can ditch your 1 minute cron... Quote Link to comment Share on other sites More sharing options...
illegalife Posted July 30, 2009 Share Posted July 30, 2009 Re: Hospital Java Countdown This just started out as a cosmetic change (nice countdown numbers) i've now realised that this is quite a massive addition to a game... i am currently in the process of changing everything to the javascript countdown... Which will result in there being no need for the 1 minute cron anymore... now if people are interested i will create a new thread with details on how to change everything in the game to this... so you can ditch your 1 minute cron... definitely interested :] Quote Link to comment Share on other sites More sharing options...
POG1 Posted July 30, 2009 Share Posted July 30, 2009 Re: Hospital Java Countdown @shreck. It isn't a huge addition it just takes a lot of editing. It would be best to create a text file and write a tutorial showing the steps needed to go thorugh. Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 30, 2009 Author Share Posted July 30, 2009 Re: Hospital Java Countdown @shreck. It isn't a huge addition it just takes a lot of editing. It would be best to create a text file and write a tutorial showing the steps needed to go thorugh. i disagree, personally i think its a big addition to a game, although not so much as to what the members can see but to how the game runs... for starters you can get rid of the 1 minute crons, this will be handy people on webhosts... second it now makes the hospital time 100% accurate whereas before if they attacked someone 5 seconds before cron ran, hospital time would drop 1 minute... in effect them gaining 55 seconds where they should have been in hospital... third there is now no more refreshing of pages to see how long you have left in hospital (again kinder on the server) fourth it looks alot nicer... so sorry but i think it is a pretty big change to a game... i don't think i will be doing the tutorial for it as only one person has expressed interest and it is quite a tricky one to install (tricky in the fact there are so many edits needed) and everything you need to get this working on your site is already in this post... barring the need to change any items that reduce hospital time Quote Link to comment Share on other sites More sharing options...
POG1 Posted July 30, 2009 Share Posted July 30, 2009 Re: Hospital Java Countdown It would change gameplay a lot but it wouldn't be a tricky task to acheive is what i ment. The issue with the items to reduce hospital times is easy, simply edit the item use file. Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 30, 2009 Author Share Posted July 30, 2009 Re: Hospital Java Countdown It would change gameplay a lot but it wouldn't be a tricky task to acheive is what i ment. The issue with the items to reduce hospital times is easy, simply edit the item use file. exactly what i've done... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. the hospital countdown is now working 100% on my game, there were a few bugs as i forgot a few places that sent members to hospital... Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted July 30, 2009 Author Share Posted July 30, 2009 Re: Hospital Java Countdown It would change gameplay a lot but it wouldn't be a tricky task to acheive is what i ment. The issue with the items to reduce hospital times is easy, simply edit the item use file. i agree its not tricky for someone who has some knowledge of coding, but for noobs who don't really understand what each bit of code does its not so easy... hardest bit was actually modifying the javascript to actuall countdown using unix_timestamps as most countdown scripts countdown to a specific date in the future Quote Link to comment Share on other sites More sharing options...
POG1 Posted July 30, 2009 Share Posted July 30, 2009 Re: Hospital Java Countdown Ok cool, can i see an exmple please? :) Quote Link to comment Share on other sites More sharing options...
gideon prewett Posted July 30, 2009 Share Posted July 30, 2009 Re: Hospital Java Countdown i think a guide to make the game time run live would be a great addition to CE Quote Link to comment Share on other sites More sharing options...
BoGFx Posted July 30, 2009 Share Posted July 30, 2009 Re: Hospital Java Countdown exactly what i've done... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Wouldn't this let them use it more than once? Quote Link to comment Share on other sites More sharing options...
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.