Problem with script

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
kouhi
Registered User
Posts: 71
Joined: Sun Jun 26, 2005 11:08 am

Problem with script

Post by kouhi » Wed Oct 11, 2006 4:21 pm

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

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Wed Oct 11, 2006 4:41 pm

If you are having problems with a mod, you will have to ask your question in that mod's thread.

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Thu Oct 12, 2006 1:01 am

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?

cybrid23
Former Team Member
Posts: 9877
Joined: Wed Jun 29, 2005 5:55 am
Location: Somewhere in the Midwest...
Contact:

Post by cybrid23 » Thu Oct 12, 2006 1:07 am

And this relates to phpBB support how?
---Never leave home without a towel and your peril sensitive sunglasses.
---Do Not PM Me For Support. It will go unanswered.
Thanks.

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Sun Oct 15, 2006 2:45 am

It doesn't... it should be in the mod authors section. :P

User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK
Contact:

Post by karlsemple » Sun Oct 15, 2006 2:49 am

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
Image

Locked

Return to “2.0.x Support Forum”