Gold/Copper

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
Huezzer
Posts: 72
Joined: Mon Jan 31, 2011 7:47 pm

Gold/Copper

Post by Huezzer »

Hey, I've got a little problem with my currencies. :), When I for example complete a quest it gives me gold. But I want it to be able to get both gold and copper from quests and creatures. not just gold.

if anyone know a code, please tell me

Quests.php a part of it, that one about gold. I've marked it(gold)

Code: Select all

else
  {
  $updatecre="Update players SET `$type`=`$type`-'$selectquest3[reqamount]' WHERE name='$playerinfo3[name]'";
	    mysql_query($updatecre) or die("Could not update player");
		echo $selectquest3['reqamount'] . " " . $type . " removed from inventory<br><br>";
		echo $selectquest3['finishquest'];

		$updatearmor="DELETE FROM currentquests where pid='$playerinfo3[name]' AND location = '$qid'  AND name = '$qname' limit 1";	   
	  mysql_query( $updatearmor) or die("Could not delete quest");
  if(isset($_POST['newquest']))
{$SQL = "INSERT into playerquests(pid,location,name,level) VALUES ('$playerinfo3[name]','$qid','$qname','2')"; mysql_query($SQL) or die("could not add to quests");}
else
{ $updatecre="Update playerquests SET level=level+1 WHERE pid='$playerinfo3[name]' AND location='$qid'  AND name='$qname'";
	    mysql_query($updatecre) or die("Could not update old quests");
		}
	$updatecre="Update players SET gold=gold+'$selectquest3[copper]',exper=exper+'$selectquest3[exper]' WHERE name='$playerinfo3[name]'";
	    mysql_query($updatecre) or die("Could not update quests")
//**HERE**//	echo "<br><br>Recieved " . $selectquest3['exper'] . " experience and " . $selectquest3['copper'] . " gold.";
	//////////////////if given item is a item/////////////////	
		if($selectquest3['item'] != 'none')
{
$iteminfo="SELECT * from items where name='$selectquest3[item]'";
$iteminfo2=mysql_query($iteminfo) or die("Could not get user items");
$iteminfo3=mysql_fetch_array($iteminfo2);
$SQL = "INSERT into inventory(id,name,type,stats,statadd,price) VALUES ('$playerinfo3[id]','$iteminfo3[name]','$iteminfo3[type]','$iteminfo3[stats]','$iteminfo3[statadd]','$iteminfo3[price]')"; mysql_query($SQL) or die("could not add to inventory");
echo $selectquest3['item'] . " added to your backpack.<br>";

}
  
Thank you!
Gustava
Posts: 66
Joined: Tue Dec 29, 2009 5:49 am

Re: Gold/Copper

Post by Gustava »

Unless I read it wrong you are adding copper to the existing gold for the player?

Code: Select all

   $updatecre="Update players SET gold=gold+'$selectquest3[copper]',exper=exper+'$selectquest3[exper]' WHERE name='$playerinfo3[name]'";
Instead try this?

Code: Select all

   $updatecre="Update players SET gold=gold+'$selectquest3[gold]', copper=copper+'$selectquest3[copper]', exper=exper+'$selectquest3[exper]' WHERE name='$playerinfo3[name]'";
Took a stab at what copper was called, heh.
Post Reply

Return to “Advanced Help and Support”