Jump to content

Script Error


currend

Recommended Posts

Hello.  I am having a problem with a game.  Let me explain.  I am working on a game and there seems to be a problem.  In the game a user can go into a "SafeHouse" to prevent them from being attacked.  This is as follows:

 

else if ($r['safehouse'] == 1)

{

print "This person is in a safehouse.  You cannot attack this player.<br />

<a href='index.php'>Back</a>";

$h->endpage();

exit;

}

else if ($ir['safehouse'] == 1)

{

print "You are in a safe house you cannot attack other players.<br />

<a href='index.php'>Back</a>";

$h->endpage();

exit;

}

 

The problem with this is.  If i go into a safe house someone can still attack me.  Yet if i try to attack someone I get the message saying i can't attack because im in a safehouse.  (which is how that one should be handled).  I just dont know how to fix whatever is causing the users to still be able to attack people who are in the safe house.  I have tried the > 0 but that still doesn't work.  Can someone enlighten me on what i am doing wrong?

Link to comment
Share on other sites

Here is everything above it

 

<?php

$menuhide=1;

$atkpage=1;

include "globals.php";

 

$_GET['ID'] == (int) $_GET['ID'];

if(!$_GET['ID'])

{

print "WTF you doing, bro?";

$h->endpage();

exit;

}

else if($_GET['ID'] == $userid)

{

print "Only the crazy attack themselves.";

$h->endpage();

exit;

}

else if ($i['safehouse'] == 1)

{

print "This person is in a safehouse.  You cannot attack this player.<br />

<a href='index.php'>Back</a>";

$h->endpage();

exit;

}

else if ($ir['safehouse'] == 1)

{

print "You are in a safe house you cannot attack other players.<br />

<a href='index.php'>Back</a>";

$h->endpage();

exit;

}

Link to comment
Share on other sites

I still can't see where the arrays $i, $r and $ir are coming from.

 

From the code you're showing, what message is actually being displayed?

Is it showing the "WTF you doing, bro?" or "Only the crazy attack themselves" messages? Or is it dropping through the entire if test to whatever comes after?

 

 

 

Link to comment
Share on other sites

In that case, it's not meeting the conditions.

Suggest you go back and look at what the values in $i, $r and $ir actually are.

 

 

Where would i look to find these?  I have searched everywhere and can't find anything that is associated with it.  Also, if i modify the line in question then i can't attack anyone else when im NOT in safehouse... just a strange script.  If i send you what you need to know can you modify ti for me as i dont want to screw anything up

Link to comment
Share on other sites

Basically you have to look closer at your logic.... echo stuff to see what is failing where. If you expecting a var to be equal to 1, then echo it out and see what it is set to. Echoing stuff is the best way to find flawed logic. You have to test each step and even set things to what you want, to get the results you want.

 

echo echo echo... that is my #1 solution to problems like this... echo all the vars you are using in the if/elseif/else chain you got going on there...

 

Nate

Link to comment
Share on other sites

I have no idea what echo is altho i have seen it.  I am not LITERATE at all in this.  This was a simple MOD that I added.  All other parts of the mod work except this one.  I just dont understand WHY its failing.  Would anyone be willing to take the PHP file and modify it or play around with it even if i must give access to myPhPadmin.  I seriously dont mind as long as i can get this problem resolved.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.