Jump to content
MakeWebGames

Someone help me with using an ARRAY system here


Joshua

Recommended Posts

The way I want this to work is if a user matches ANY of the 3 race settings they can use it. If they Don't match, it denies them.

I am not sure how to get this to work like that

 

if($ir['race'] != $r['item_race'] OR $ir['race'] != $r['item_race2'] OR $ir['race'] != $r['item_race3'])

{

print "The selected item is not able to be used by your race.";

$h->endpage();

exit;

}

Any help would be appreciated, i'm thinking using arrays, but not sure how i'd set that up properly.

Link to comment
Share on other sites

RE: Someone help me with using an ARRAY system here

 

if($ir['race'] != $r['item_race'] && $ir['race'] != $r['item_race2'] AND $ir['race'] != $r['item_race3'])
{
//if you race isn't item_race, item_race2, and item_race3 then you shouldn't be here
print "The selected item is not able to be used by your race.";
$h->endpage();
exit;
}
Link to comment
Share on other sites

Problem i'm having Seany

Is that it only has to match ONE of the 3.

So if($ir['race'] != $r['item_race'] BUT It matches item_race2 or item_race 3. They can use the item

If $IR race doesnt match ANY of the 3 they cant :P

That's what my code does... If it doesn't match any ONE of the three, it throws the error inside the if control statement.

Link to comment
Share on other sites

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...