Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Error with fethcing tools  (Read 680 times)

Onehempcat

  • Basic Member
  • *
  • Reputation Power: 16
  • Onehempcat has no influence.
  • Offline Offline
  • Posts: 5
    • View Profile
Error with fethcing tools
« on: November 19, 2009, 07:04:16 PM »
So I made items tools in my game, and now I want to make sure a player has the required tool to do an activity in my game. WELL, I cannot and I am almost certain it is easy, but just out of my brain for the last hour.
I made three tool variables in the users DB like the armor and weapons ones. I see that my tool has been equipped and that the number of the tool is also correct. This is my code
Code: [Select]
if($ir['equip_tool1'] || $ir['equip_tool2'] || $ir['equip_tool3'] != '79')
{
print "Error, you do not have a Fishing Pole. Or it is not equipped.<br />
<a href='exmakemoney.php'>&gt; Back...</a> Or <a href=remakeitem.php>Go Make One</a>!";
$h->endpage();
exit;
}

I am fairly certain this is saying ALL 3 slots do not have a tool number 79. When I want it to ask if one of the slots has the tool, if it does, than go on without the error.
Any help would be appreciated alot!!!! This has been bugging me.
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: Error with fethcing tools
« Reply #1 on: November 19, 2009, 07:25:29 PM »
What you are saying in this query is:
"If equip_tool1 exists or equip_tool2 exists or equip_tool3 does not equal 79"

This will work for what you want:
Code: [Select]
if($ir['equip_tool1'] != '79'|| $ir['equip_tool2'] != '79' || $ir['equip_tool3'] != '79')
{
print "Error, you do not have a Fishing Pole. Or it is not equipped.<br />
<a href='exmakemoney.php'>&gt; Back...</a> Or <a href=remakeitem.php>Go Make One</a>!";
$h->endpage();
exit;
}
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

Onehempcat

  • Basic Member
  • *
  • Reputation Power: 16
  • Onehempcat has no influence.
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Error with fethcing tools
« Reply #2 on: November 19, 2009, 07:29:39 PM »
Same. I should have mentioned, I tried that way also. Thats why i am so perplexed. I do not see a reason why it will not work. My thought with this second code is the same, it is still saying,
if equip1 does not have or if equip2 does not have .........  exit.

So if I don't have 3 poles equipped, It still exits with the error/exit.

I tested this theory by putting on 3 poles. It lets me in, with exiting. Strange right?
Logged

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: Error with fethcing tools
« Reply #3 on: November 19, 2009, 11:23:02 PM »
Code: [Select]
if($ir['equip_tool1'] !=79 AND $ir['equip_tool2'] !=79 AND $ir['equip_tool3'] != '79')
{
print "Error, you do not have a Fishing Pole. Or it is not equipped.<br />
<a href='exmakemoney.php'>&gt; Back...</a> Or <a href=remakeitem.php>Go Make One</a>!";
$h->endpage();
exit;
}

From what I'm understanding is you want it to check if ANY of the 3 tool tables have the item equipped right?

This will work.
« Last Edit: November 19, 2009, 11:24:36 PM by Immortalthug »
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: Error with fethcing tools
« Reply #4 on: November 20, 2009, 09:08:29 AM »
Haha my mistake, I misunderstood what your goal was. lol
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Error with fethcing tools
« Reply #5 on: November 20, 2009, 09:45:33 AM »
if($ir['equip_tool1'] !=79 AND $ir['equip_tool2'] !=79 AND $ir['equip_tool3'] != '79')
{
print 
"Error, you do not have a Fishing Pole. Or it is not equipped.<br />
<a href='exmakemoney.php'>&gt; Back...</a> Or <a href=remakeitem.php>Go Make One</a>!"
;
$h->endpage();
exit;
}


Will work, you could replace AND with &&
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Onehempcat

  • Basic Member
  • *
  • Reputation Power: 16
  • Onehempcat has no influence.
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Error with fethcing tools
« Reply #6 on: November 20, 2009, 09:55:40 AM »
Yeah, Thug's did fix it. I thank you guys for the help. I knew it was easy as pie, and I could not remember. YEY, it works it works. HA, I got one more just like it, coming soon. LMAO Once I clean the code up.
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.