PrimeSuspect Posted May 30, 2011 Share Posted May 30, 2011 Hello How can i prevent attacking game staffs and newbies level under 5 ? Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 30, 2011 Share Posted May 30, 2011 if($odata['user_level'] > 1 || $odata['level'] < 5) { echo 'You can\' attack staff members or members under level 5'; die($h->endpage()); } Something like that. Make sure $odata is the thing used on attack.php (as i am not sure). Quote Link to comment Share on other sites More sharing options...
PrimeSuspect Posted May 30, 2011 Author Share Posted May 30, 2011 if($odata['user_level'] > 1 || $odata['level'] < 5) { echo 'You can\' attack staff members or members under level 5'; die($h->endpage()); } Something like that. Make sure $odata is the thing used on attack.php (as i am not sure). Thnx it worked for me Quote Link to comment Share on other sites More sharing options...
PrimeSuspect Posted May 30, 2011 Author Share Posted May 30, 2011 Opss ive just realased that that code blocks to attack every single player... Any idea ? Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted May 30, 2011 Share Posted May 30, 2011 it should be if($odata['user_level'] > 1 && $odata['level'] < 5) { echo 'Tou can\'t attack staff members or members under level 5!'; die($h->endpage()); } you have to use && (AND) instead of || (OR) when checking to see if a number is inbetween 2 numbers Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 30, 2011 Share Posted May 30, 2011 (edited) it should be you have to use && (AND) instead of || (OR) when checking to see if a number is inbetween 2 numbers Then the only people protected would be staff under level 5... @ op - make sure it's under the query (e.g. under the if() that checks if the player you're attacking is in hosptail). Edited May 30, 2011 by Dominion Quote Link to comment Share on other sites More sharing options...
PrimeSuspect Posted May 30, 2011 Author Share Posted May 30, 2011 it should be if($odata['user_level'] > 1 && $odata['level'] < 5) { echo 'Tou can\'t attack staff members or members under level 5!'; die($h->endpage()); } you have to use && (AND) instead of || (OR) when checking to see if a number is inbetween 2 numbers its not working :( Quote Link to comment Share on other sites More sharing options...
Danny696 Posted May 30, 2011 Share Posted May 30, 2011 it should be if($odata['user_level'] > 1 && $odata['level'] < 5) { echo 'Tou can\'t attack staff members or members under level 5!'; die($h->endpage()); } you have to use && (AND) instead of || (OR) when checking to see if a number is inbetween 2 numbers No, It really shouldnt. Quote Link to comment Share on other sites More sharing options...
PrimeSuspect Posted May 30, 2011 Author Share Posted May 30, 2011 No, It really shouldnt. i add it to attack.php , there are no error but its not working.I can still attack players level under 5 and staffs Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 30, 2011 Share Posted May 30, 2011 its not working :( Look at what i have said. -.- - make sure it's under the query (e.g. under the if() that checks if the player you're attacking is in hosptail). Quote Link to comment Share on other sites More sharing options...
Danny696 Posted May 30, 2011 Share Posted May 30, 2011 i add it to attack.php , there are no error but its not working.I can still attack players level under 5 and staffs Thats because what he said was wrong. Juding that you are using the original McCodes, I see no reason why dom's didnt work. I suppose you could try adding extra parentheses.. :/ Mabey something like; if(($odata['user_level'] != (0||1)) || ($odata['level'] < 5)) { echo 'You can\' attack staff members and/or members under level 5'; die($h->endpage()); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.