Page 1 of 1

Problem with script

Posted: Wed Oct 11, 2006 4:21 pm
by kouhi
Hi. I am making a NPC quest system for my board but I am having a problem with giving a user an item at the end of the quest. I was hoping someone could help me out

The shop system this is using is Zarath shop mod 3.0

here is the code which is the problem

Code: Select all

//BEGIN NPC QUEST
$users_id = $userdata['user_id'];
$users_id = intval($users_id);
$sql = "SELECT user_id, item_name FROM phpbb_user_items WHERE user_id = '$users_id' AND item_name = 'Bunny'";
if ( !($result=$db->sql_query($sql))) {
message_die(CRITICAL_ERROR, 'Unable to aquire user items.');
}
$items = $db->sql_fetchrow($result);
if ( !$items ) {
$Message =  "Can you buy me the bunny item please, I really want one.";
}
else
{
$Message =  "Yay I finally have a bunny, here, lets trade.<br>
<b> You have recived a Naru Plushie </b>";
$sql2 = $db->sql_query("DELETE FROM phpbb_user_items WHERE user_id = '$users_id' AND item_name = 'bunny'");
$sql3 = $db->sql_query("INSERT INTO `phpbb_user_items` ( `user_id` , `item_id` , `item_name` , `item_l_desc` , `item_s_desc` )
VALUES ( `$users_id`, `1532`, `Naru Plushie`, `Naru Quest Item`, `Guest Item` )");
} 
//END NPC QUEST
could someone help me get this to work

Posted: Wed Oct 11, 2006 4:41 pm
by Brf
If you are having problems with a mod, you will have to ask your question in that mod's thread.

Posted: Thu Oct 12, 2006 1:01 am
by Zarath
If you had read his post, you'd know that his problem is with custom code he's trying to write, and not with a mod at all.

change this

Code: Select all

$items = $db->sql_fetchrow($result);
if ( !$items ) { 
to

Code: Select all

if ( !($db->sql_numrows($result)) ) { 
Otherwise, can you tell us what your problem is?

Posted: Thu Oct 12, 2006 1:07 am
by cybrid23
And this relates to phpBB support how?

Posted: Sun Oct 15, 2006 2:45 am
by Zarath
It doesn't... it should be in the mod authors section. :P

Posted: Sun Oct 15, 2006 2:49 am
by karlsemple
Zarath wrote: If you had read his post, you'd know that his problem is with custom code he's trying to write, and not with a mod at all.



Either way it is still mod support and should not be sought here. He/she should either post in the mod writers disscussion forum as it looks like the user is writing some custom code or they should contact the author of the mod (you) directly :)

Locked