Jump to content
xisto Community

Feelay

Members
  • Content Count

    275
  • Joined

  • Last visited

Everything posted by Feelay

  1. Don't think that worked xD I have 601600163 / 280 HP xD
  2. Nevermind.. It is working now.. But what was that? (when it tryed to enter phpMyAdmin i got this error: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured) )
  3. vujsa. the value is still not updating ? the $full_hours_passed sometimes reaches 0, and then the $hp_increase and the $new_update_time reaches nothing (not even 0). look: 1203101853 current_time1203101821 last_update_time32 time_difference 0.533333333333 hours_passed0 full_hours_passed32 remaining_secondsnew_update_timehp_increase60 frequency10 increment And this: 1203105671 current_time1203105541 last_update_time130 time_difference 2.16666666667 hours_passed2 full_hours_passed10 remaining_seconds1203105661 new_update_time20 hp_increase60 frequency10 increment but this is a lot later.. 2 full_hours_passed = 20 hp_increase.
  4. can you help me find a code that will show the localtime on the users pc. can't find any =/ Thanks //Feelay (EDIT: I just realized that i have double posted. didn't see that earlier. I am veryvery sorry for that.)
  5. ok.. I know what the error is (the $hp_increase and the $new_update_time have no vaules, but keep reading, Ă want to try to solve it by myself:P). Finally I kinda know how to debug stuff but i still need i little little help.. I need to mess a bit with the "time". Can you please just explain to me, how you created this part(explain it more than what the comments do): $current_time = time(); // get the current server time in second$last_update_time = mysql_result(mysql_query("SELECT `value` FROM `configuration` WHERE `name` = 'last_update'"), 0); // This could be anywhere even in a separate text file!$time_difference = $current_time - $last_update_time;$hours_passed = $time_difference / $frequency; // convert sec to min then to hours --> 3600 second / 60 = 60 minutes / 60 = 1 hour$full_hours_passed = floor($hours_passed); // round the number of decimal hours down to the nearest whole hour$remaining_seconds = $time_difference % $frequency; // number of sec left when time difference is divided by 3600 sec --> 7 % 3 = 1 and 6 % 3 = 0if($full_hours_passed > 0){ $new_update_time = $current_time + $remaining_seconds; $hp_increase = $full_hours_passed * $increment; because I want to know how I can mess with the time. I want to know how I can change it to update every minute (just for testing, don't be afraid ) and how I can change it to update every hour, or everyday and so on.. I want to know how the system works.. When I try to chnage the $frequency = 60 * $multiplier; sometimes the hp_increase and new update time becomes 0. sometimes the full_hours_passed becomes many hours.. I know what the errors is, but I don't know how to solve them. The only thing I need to know is what I said earlier. Can you please tell me how to make it update every minute, hour, day or something. Thanks //Feelay Edit: This is how all the Variables looks like: 1203074895 current_time1203073225 last_update_time1670 time_difference 2.31944444444 hours_passed2 full_hours_passed230 remaining_seconds1203075125 new_update_time40 hp_increase0.2 multiplier720 frequency20 increment And theese: -148 time_difference -0.205555555556 hours_passed-1 full_hours_passed-148 remaining_secondschange all the time. but instead of starting over when they reach 0, they go to the - value, and then, when they reach some value on the "-" they start to become higher (-1, -2, -3, -2, -1, 0, +1, etc.).. maybe I do need a little help here, after all. EDIT2: Ok.. I just found a little small error.. Depending on what value theese things has: 90 time_difference 0.125 hours_passed0 full_hours_passed90 remaining_seconds The value for the $hp_increase and the value for the $new_update_time chnages between (nothing at all, not even 0) and 40 or something (the $new_update_time is much higher ofc...) Now I am really confused.. I don't think I can solve this by myself anymore =/
  6. Well.. atm, it is 18:25 here, but the forums time is 18:35 xDBut I understand what you mean
  7. I know But, I have "last login" on my website, and I am going to add a clock. And why would a user in The USA know how much the clock is here in sweden ?
  8. oh? what code can I use to do that (php please:P)? because my site is showing the time like "06:02:19" when it is "15:21"
  9. Hey!I was wondering..Is it possible to chnage the server time for my website? Or is it the same time for all servers?Thanks //Feelay
  10. I'm on my way to give up this script =SIt is still not working.. If you guys can't find a solution for this(because i can't =/) Do you think I should forget this hp regen thing, and use potions instead?@Vujsa: You are right.. I'll do that in the future.
  11. me = confused Come on guys I've never used loops before Can't you explain to me, like when you explain to a 3 years old baby or something
  12. =/ now all the quotes is working fine.. but the value is still not updating =/ here is the code: <?php$multiplier = 1 / 5;$frequency = 3600 * $multiplier;$increment = 5 * $multiplier;$current_time = time(); // get the current server time in second$last_update_time = mysql_result(mysql_query("SELECT hptime FROM characters"), 0); // This could be anywhere even in a separate text file!$time_difference = $current_time - $last_update_time;$hours_passed = $time_difference / $frequency; // convert sec to min then to hours --> 3600 second / 60 = 60 minutes / 60 = 1 hour$full_hours_passed = floor($hours_passed); // round the number of decimal hours down to the nearest whole hour$remaining_seconds = $time_difference % $frequency; // number of sec left when time difference is divided by 3600 sec --> 7 % 3 = 1 and 6 % 3 = 0if($full_hours_passed > 0){ $new_update_time = $current_time + $remaining_seconds; $hp_increase = $full_hours_passed * $increment;mysql_query("UPDATE `characters` SET `temphealth` = CASE WHEN `temphealth` + $hp_increase <= `maxhp` THEN `temphealth` + $hp_increase ELSE `maxhp` END WHERE `temphealth` > `maxhp`");mysql_query("UPDATE characters SET hptime = $new_update_time");}?> I am not sure whats wrong, but i think it has something with the time to do.. sorry for asking so much vujsa but i don't know how this time() thing works yet..
  13. this is what php my admin says (exactly the same thing?) SQL query: UPDATE characters SET temphealth = CASE WHEN temphealth + $hp_increase <= maxhp THEN temphealth + $hp_increase ELSE maxhp WHERE temphealth < maxhp MySQL said: #1064 - 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 temphealth < maxhp' at line 1 if I am doing it the wrong way, please tell me.
  14. the Select query worked. I have no idea if the time query worked, because the code died here: 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 temphealth < maxhp' at line 1 this is the query: UPDATE characters SET temphealth = CASE WHEN temphealth + $hp_increase <= maxhp THEN temphealth + $hp_increase ELSE maxhp WHERE temphealth < maxhp all the colums are right.. I have no idea whats wrong here..
  15. When you gave me the code, I changed the queries. I changed hp to temphealth. And i changed user to characters.the 'hptime' is the colum storing the last update. you arew right, temphealth should be int, but that don't matter. the value is still not changing =/
  16. hmm.. I know one software.. I've never tried it myself, but my friend says that it is very good, and cheap It is called magix (http://www.magix.com/int/ or something).. try it out or you can always learn html, xhtml, dhtml with theese three, you can do stuff better than what a software can do it
  17. no idea.. i didn't check.. but when I looked this morning, there was like hundreds of them and that kinda disturbed me a bit. but lets forget that.
  18. Glad it worked.. If you ever need help again, you know where to find me :PNow, can you do me a favour, please Don't write the same post in 100 topics. just make your own, and wait for a replie Thank you.
  19. acctually the real admin account can't be gone.. look. do as I say..If you have welcome screen when starting windows, log out (and i mean log out, not chnage user!!), then press ctrl+alt+delete 2 times! very important.. don't do it very fast, and not very slow.. just press them like when you press 2 spaces or something.. then a window will pop-up.. just write "administrator" as the name, and try to login (not sure that u need password).. just try that.. then try to enter the "my documents" for the user you want.. ok? just do as I wrote.. if it did not work, login as a guest again, and write that here.Edit:!!! If you have english version of windows it is Administrator. If you have another language, and administrator don't work, try to write it in the language that your windows use!!
  20. try to show the "hidden files".. I hope you know how to do that ;)Enter "my computer".on the top, press "tools".then press (not sure what it is in english, but it should be something like:"Folder Settings").then press on the second tab.then press on "Show hidden files".(when i try to see administrators documents, i can.. maybe you can't because you are logged in as a guest. My files isn't hidden.)
  21. hmm.. when you say administrator account, do you mean the account that you created when you installed windows, or the account that Windows created (The real administrator account)? If you mean the one that you created, you can try to login with the real administrator account (if you have welcome screen, try to press ctrl+alt+delete 2 times).. because if I am right, the real adminisrator account has acces to all files on the computer.. else. if you mean that the real administrator account is gone, I'm afraid that you have to re-install windows (not 100% though).. But there is some programs that can restore gone files (thats how the police can catch illegal downloaders that have erased their files ). you can find free softwares on google.. But if the first thing i said didn't work, tell me, and i'll figure out something else. OT:Sorry for OT, but can any mod/admin please move this file to its correct forum.. I don't like it beeing here, dunno why:P
  22. Feelay

    Login Script

    I've made a login-script tutorial in the tutorials section check it out. Very simple. it works for php 5. But it don't use 5 md5 hashs xD.. why so many =?
  23. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";-- -- Database: `dbname`-- -- ---------------------------------------------------------- -- Table structure for table `characters`-- CREATE TABLE `characters` ( `user` varchar(32) NOT NULL, `temphealth` varchar(225) NOT NULL default '100', `attack` int(11) NOT NULL, `exp` int(225) NOT NULL default '0', `level` int(11) NOT NULL default '1', `lastlogin` varchar(50) NOT NULL, `maxhp` int(11) NOT NULL, `expaw` int(11) NOT NULL, `hptime` int(11) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1; Or maybe I've done something wrong.. I dunno, but here it is.
  24. hmm =/ Vujsa. Nothing happened =S I've bee waiting for 12 minutes, but nothing changed.
  25. I hope it does :S I have to wait 1 hour. is there any way to make the time shorter (every 1 min or something). when i tryed, the hp value showed 1 all the time, so I changed it back.btw, i changed the 100 in the mysql_query to maxhp, because i have a table named that, and now all users have 280 hp =/ how can i solve that =/ =?the users maxhp depends on the users level, but all users have the same hp as the highest level..
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.