zintis8789 Posted August 31, 2009 Report Share Posted August 31, 2009 Veidoju Online speli un man vaig laika atskaites skriptu!! Varetu izskatities Šādi: if($energijs <1){ //*laika atskaites skripts ka atjauno energiju katras 3 minutes ! }else{ echo "$energija"; } Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted August 31, 2009 Report Share Posted August 31, 2009 Palasi šo tēmu: http://php.lv/f/topic/11467-browser-based-spele/ Quote Link to comment Share on other sites More sharing options...
zintis8789 Posted August 31, 2009 Author Report Share Posted August 31, 2009 Es palasiju bet tur nav paradits konkrēts piemērs :( Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted August 31, 2009 Report Share Posted August 31, 2009 Tajā tēmā tika apskatītas divas metodes: 1) vienkāršākā - uz servera reizi X minūtēs tiek iedarbināts skripts, kas rupji runājot izpilda darbību: UPDATE character_table SET character_health = MIN(100, character_health + 1) WHERE character_health < 100 2) Sarežģītākā: Nevis visu laiku pa tukšo izpildam UPDATE, bet gan tikai, kad notiek kaut kāda darbība izpildam: UPDATE character_table SET character_health = MIN(100, character_health + DATE_DIFF(last_time_something_happened,now(),MINUTES)), last_time_something_happened = NOW() WHERE character_id = X Quote Link to comment Share on other sites More sharing options...
zintis8789 Posted August 31, 2009 Author Report Share Posted August 31, 2009 Ok paldies !! 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.