Jump to content
MakeWebGames

Recommended Posts

Posted

i have made a little mod wich lets you craft items out of other items e.g water and coke makes rolla cola but i want it to only let you be able to make the rolla cola when youve done a course lets say the course of 'Make rolla cola' would it be like??

 

if($_GET['make'] == 2)
{{
$stuff = $db->query("SELECT inv_id FROM `inventory` WHERE `inv_itemid` = 8021 AND `inv_itemid` = 8022  AND `inv_userid` = ".$ir['userid']);
	$db->query("SELECT courseid FROM `coursesdone` WHERE `courseid` = 3 AND  'userid` = ".$ir['userid']);
if(mysql_num_rows($stuff))   {
  item_add($ir['userid'], 8044, 1);
  item_remove($ir['userid'], 8021, 1);
  item_remove($ir['userid'], 8022, 1);
  echo "Congratulations, you crafted Rolla Cola.
        [url='theflat.php']Back to the Flat[/url]
";
}}
else   {
  echo "You do not have the sufficient ingredients yet <u>OR</u> you havent done the course .
        [url='theflat.php']Back to the Flat[/url]
";
}}
Posted

Re: Only Let You Do Something When You Have Done A Course

Looks like you havn't included all 4 fields

inv_id

inv_itemid

inv_userid

inv_qty

You'll have to include all 4 or the script wont know where each one goes into

Posted

Re: Only Let You Do Something When You Have Done A Course

 

if($_GET['make'] == 2)
{
$check = sprintf("SELECT inv_id FROM inventory WHERE inv_itemid = 8021 AND inv_itemid = 8022 AND inv_userid = %u",abs(@intval($ir['userid'])));
$do_check = $db->query($check);
if($db->num_rows($do_check) == 0)
{
	echo "You do not have the sufficent ingredents yet.

";
	echo "[url='theflat.php']Back to the Flat[/url]";
}
else
{
	$check_2 = sprintf("SELECT courseid FROM coursesdone WHERE courseid = 3 AND userid = %u",abs(@intval($ir['userid'])));
	$do_check_2 = $db->query($check_2);
	if($db->num_rows($do_check_2) == 0)
	{
		echo "You have not done the course yet.

";
		echo "[url='theflat.php']Back to the Flat[/url]";
	}
	else
	{
		item_add($ir['userid'], 8044, 1);
		item_remove($ir['userid'], 8021, 1);
		item_remove($ir['userid'], 8022, 1);
		echo "Congratulations, you crafted the Rolla Cola.

";
		echo "[url='theflay.php']Back to the Flat[/url]";
	}
}
}
Posted

Re: Only Let You Do Something When You Have Done A Course

 

$check = sprintf("SELECT inv_id FROM inventory WHERE inv_itemid = IN(8021,8022) AND inv_userid = %u",abs(@intval($ir['userid'])));

You can just use IN().

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...