Jump to content
xisto Community

Feelay

Members
  • Content Count

    275
  • Joined

  • Last visited

Everything posted by Feelay

  1. Resource id #16 $updatedR1202505413 $updated0 $differenceResource id #17 $healthR1 $health0 $addHealth1202505413 $updated
  2. hmm.. I ain't the best with for loops. But ty for the code Can you please explain it a bit, so i know what values i should change, if I ever need to change something =?
  3. Hey! I know I am asking lots of questions theese days, sorry I was wondering: Is there anyway to make the following code shorter =? #If user is level 1 if($user['level']=1){ if($enemy['level']=1{ $winner=mt_rand(50,100);} elseif($enemy['level']=2){ $winner=mt_rand(45,100);} elseif($enemy['level']=3){ $winner=mt_rand(40,100);} elseif($enemy['level']=4){ $winner=mt_rand(35,100);} elseif($enemy['level']=5){ $winner=mt_rand(30,100);} elseif($enemy['level']=6){ $winner=mt_rand(25,100);} elseif($enemy['level']=7){ $winner=mt_rand(20,100);} elseif($enemy['level']=8){ $winner=mt_rand(15,100);} elseif($enemy['level']=9){ $winner=mt_rand(10,100);} elseif($enemy['level']=10){ $winner=mt_rand(5,100);}} Because I am going to make this for every single level =/ atm i only have 10 levels.. but what wil happen when I have 100 levels =? Thanks for any replie //Feelay
  4. this code is making me mad :S Still not working :S
  5. it's stil not working.I did as you said :S echoed all the variables.. this is the result :SResource id #1712024997771202499760Resource id #1860124988030062494001202499777
  6. what should it look like then =? this is how it looks atm =/ <?phpsession_start();include "database.php";include "hptime.php";include "level.php";$nuser=mysql_real_escape_string($_SESSION['user']);$auser=mysql_real_escape_string($_SESSION['admin']);if($nuser){$userfinal=$nuser;}elseif($auser){$userfinal=$auser;}#################################################################// TID$updated = mysql_query("SELECT hptime FROM characters WHERE user='userfinal'"); //hämta fÜrra tiden frün databasen$currentTime =time(); //tiden just nu$difference = $currentTime - $updated;// HP$health = mysql_query("SELECT temphealth FROM characters WHERE user='$userfinal'");//hp, etc. kan du nog fixa frün annat värde som du hämtat.// HEAL$addHealth = floor($difference / 2); // we need to know how many hours have passed - we get an round value (though it is a "float" number) by using floor()$addHealth = (int) $addHealth * 5; // this is how much health will be added, if you add 5HP per hour - I'm not sure whether (int) is necessary, but better safe than sory$health += $addHealth;if ($health > $user['maxhp']) { $health = $user['maxhp']; } // we don't want the health to go over max hp!$updated = time(); // we also need to update the alteration time.mysql_query("UPDATE characters SET temphealth='$health' AND hptime='$updated'"); //Uppdatera HP och TIME?>
  7. ok.. I did as you said. now it shows 1 hp all the time =/
  8. kill me if you want.. but I still don't understand xDYou mean that the "$Health" is the mysql_query for the current health and that the "$updated" is for the "last time the health was updated" colum = Both is mysql_queries =?
  9. But how do I do that =/ Thats the thing I don't know =(
  10. It helped a bit, Thanks. But, how do I do it without the cron jobs =?
  11. Hi.I am trying to figure out how to make a value in the database raise every minute.Lets say, I want the HP to raise every minute.The max HP is 100. I want it to raise 5 HP/ Hour. And the player don't have to be online. Anyone who know how I can do it =?Thanks for any help.//Feelay
  12. Hey! Can anyone try to help me find what I've made wrong =? I keep getting this error (Fatal error: Unsupported operand types in /home/feelay/public_html/attackck.php on line 49) But I can't find what I've made wrong =/ Here is the code: <?phpsession_start();include "database.php";############################################################ function attack(){ #Line 10 #Ge $dbQueryHealth ett värde $atkuser= mysql_real_escape_string($_POST['atkuser']);$querythe =("SELECT temphealth FROM characters WHERE user='$atkuser'")or die(mysql_error()); #Sätt $currentHealth med värdet frün databas-resursen $dbQuery if(mysql_num_rows(mysql_query($querythe)) == 1) { $currentHealthEnemy = mysql_fetch_assoc(mysql_query($querythe)); }else{ die("User Don't Excist. Please Go Back And Try Again");}#Line 20 $nuser=mysql_real_escape_string($_SESSION['user']);$auser=mysql_real_escape_string($_SESSION['admin']);if($nuser){$userfinal=$nuser;}elseif($auser){$userfinal=$auser;#Line 30} ####################################################$querythy ="SELECT temphealth FROM characters WHERE user='$userfinal'"or die(mysql_error()); #Sätt $currentHealth med värdet frün databas-resursen $dbQuery $currentHealthYou = mysql_result(mysql_query($querythy),0)or die(mysql_error()); #Line 40 $minHealth = 0; $maxHealth = 100; $expAward = mt_rand (1, 300); $healthAward = mt_rand (1, 30); $winner= mt_rand (0, 1);#Line 50 if($winner) { if(($currentHealthEnemy - $healthAward) > $minHealth) { $currentHealthEnemy -= $healthAward; #$currentExp + expAward; echo "You won! The enemy now have {$currentHealthEnemy} HP."; /*Line 60 */ } else { #Line 70 echo "You won! You Killed The Enemy"; $currentHealthEnemy = $maxHealth; #$currentExp + expAward; } } else { if(($currentHealthYou - $healthAward) <= 0) { echo "You Lost. The Enemy killed you."; $currentHealthYou = 100; } else { #Line 80 $currentHealthYou -= $healthAward; echo "You lost! You've lost {$healthAward} HP. You now have {$currentHealthYou} HP."; } }$nuser=mysql_real_escape_string($_SESSION['user']);$auser=mysql_real_escape_string($_SESSION['admin']);if($nuser){#Line 90$userfinal=$nuser;}elseif($auser){$userfinal=$auser;} $SeUs = $userfinal;$PoUS = mysql_real_escape_string($_POST['atkuser']);$result = mysql_query("UPDATE characters SET temphealth='$currentHealthYou' WHERE user='$SeUs'") or die(mysql_error());#Line 100$result = mysql_query("UPDATE characters SET temphealth='$currentHealthEnemy' WHERE user='$PoUS'") or die(mysql_error()); #mysql_query ("UPDATE characters SET exp = \"{$currentExp}\" WHERE user =".$_SESSION['user'].""); } echo attack();#Line 110mysql_close();?><form action="index.php" method="post"><input type="submit" name="home" value="Back to home"> Thanks for your help //Feelay
  13. I did that Thanks It is working now.. but as always, I am having a new problem The value in the database is not updating :S here the code for the update, should'nt it work =? $SeUs = $_SESSION['user'];$PoUS = $_POST['atkuser'];mysql_query ("UPDATE characters SET temphealth =\"{$currentHealthYou}\" WHERE user =\"{$SeUs}\"");mysql_query ("UPDATE characters SET temphealth = \"{$currentHealthEnemy}\" WHERE user =\"{$PoUs}\"");
  14. yes. Put my code: <?$con = mysql_connect('localhost','MySQL_Username','MySQL_Password');if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db('MySQL_DbName',$con);?> in config.php Instead of this mysql_pconnect("localhost","eggie_Eggie","jajetic");mysql_select_db("eggie_Eggie");
  15. eggie.. Try this one. it should work. (remeber to change the passwor and stuff). <?$con = mysql_connect('localhost','MySQL_Username','MySQL_Password');if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db('MySQL_DbName',$con);?>
  16. Yes I have. the "All" checkbox is checked.But still I can't select the database =/
  17. Hey! I've made a register script. It works on my home pc, but when I upload it to Xisto, it don't work =/ This is the error meesage I am getting: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/feelay/public_html/regcheck.php on line 35 You Could Not Register Because Of An Unexpected Error. Error: No database selected I know the error is from the database.. But I don't know exactly how the Xisto database works.. My username is feelay_myname i think, and the databasename should be feelay_thedatabasename. But still it ain't working.
  18. Hey. I am making a "Version 2.0" For my attack script, but I can't make it work. This is the error I am gettin: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in And here is the code: $dbQueryHealth = mysql_query("SELECT temphealth FROM characters WHERE user =". $_POST['atkuser'].""); $currentHealth = mysql_result($dbQueryHealth, 0); $dbQueryExp = mysql_query("SELECT exp FROM characters WHERE user = ".$_POST['atkuser'].""); $currentExp = mysql_result($dbQueryExp, 0); I have checked the PHP Manual, but I did not find anything there :S Thanks For All you help //Feelay
  19. I think humans should spend all theese money on trying to SAVE Earth from its doom.. We don't need to find the Aliens in space. They'll find us. The Earth is Diyng thanks to us.. We have lived here for 2 million years out of 15 billion I think(something like that).. And we started with the industry and stuff 200 years ago.. And in 200 years, out of 2 million we ruin all the ****. Should'nt we try to repair it before we explore stuff =?
  20. I don't exactly know what flickr is =/But maybe you are right =/ I ain't the best one to talk about theese stuff.. But if they bought all the internet services and stuff, or atleast some of them, wouldn't it be better. then we know who we can sue when they do something wrong
  21. WoW.. 44.6 Billion is alot ;)I think it would be cool if microsoft bought Yahoo!. Because I don't use Yahoo! normally.. I don't know why, but I don't like it so much. But if microsoft buy it, maybe i'll start to use it
  22. Hey! I've made a register script.. Some time ago it worked. And I ain't sure if I changed something since then.. The error I am getting is this: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/feelay/public_html/regcheck.php on line 31 Here is the code on theese lines: $sqlCheckForDuplicate = "SELECT username FROM user WHERE username = '". $username ."'"; if( mysql_num_rows( mysql_query( $sqlCheckForDuplicate ) ) == 0 ) { $sqlRegUser = "INSERT INTO user( username, password ) VALUES( '". $username ."', '". $password ."' )"; if( !mysql_query( $sqlRegUser ) ) { $feedback[] = 'You Could Not Register Because Of An Unexpected Error.'; } Any Idea What I've made wrong. And maybe anyone can tell me when mysql_num_rows errors occure. Thank You For You're Help //Feelay
  23. You must put the "class_db_mysql.php" file in a directory called class.That should make it.
×
×
  • 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.