kaball Posted June 9, 2009 Posted June 9, 2009 Hy all, i`m not so god at modding, and so i ask for your help if you want to give it offcourse :) I`ve searched on all topics and i didn`t find a mod that restrict players from attacking another player being 3 levels lower than the attacker, IF there is one can please someone give the link ? If not could anyone try to make this ? Thanks, Quote
Dayo Posted June 9, 2009 Posted June 9, 2009 Re: [MCCODES v2] Attack restriction add this $lvlcheck=$ir['level]-$r['level']; if ($lvlcheck >=4) { echo 'your level is too high to attack this person!'; $h->endpage(); EXIT;} put that after while($r=mysql_fetch_array($mw)) { may work not sure Quote
Haunted Dawg Posted June 9, 2009 Posted June 9, 2009 Re: [MCCODES v2] Attack restriction add this $lvlcheck=$ir['level]-$r['level']; if ($lvlcheck >=4) { echo 'your level is too high to attack this person!'; $h->endpage(); EXIT;} put that after while($r=mysql_fetch_array($mw)) { may work not sure You have no clue.. Quote
kaball Posted June 9, 2009 Author Posted June 9, 2009 Re: [MCCODES v2] Attack restriction i don`t find this line "while($r=mysql_fetch_array($mw)" in attack.php (this is where it should be wright?) Quote
Haunted Dawg Posted June 9, 2009 Posted June 9, 2009 Re: [MCCODES v2] Attack restriction Yes, your supposed to be in attack.php But read my post "You have no clue.." directed at Dayo. Quote
kaball Posted June 9, 2009 Author Posted June 9, 2009 Re: [MCCODES v2] Attack restriction Yes, your supposed to be in attack.php But read my post "You have no clue.." directed at Dayo. Haunted Dawg thanks for the code, you are one of the bests :) For everyone else who would like to use the code, here are some steps for implementing it: In attack.php find: //get player data $youdata=$ir; $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "" : ""; $oabbr=($ir['gender']=="Male") ? "" : ""; if($ir['attacking'] && $ir['attacking'] != $_GET['ID']) { print "Bad, Bad.... [url='index.php']Back[/url]"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($odata['hp'] == 1) { print "This player is.... [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; //and place below: } else if(($ir['level'] - $odata['level']) >= 3) { print "User not attackable. [url='index.php']Back[/url]"; $h->endpage(); exit; Save it and enjoy it :> Regards to all Quote
AbsentCrisis Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Attack restriction <?php // for colors } else if(($ir['level'] - $odata['level']) >= 4) // should be a 4 because this would only let you attack 2 levels lower { print "User not attackable. [url='index.php']Back[/url]"; $h->endpage(); exit; [c Quote
Dayo Posted June 10, 2009 Posted June 10, 2009 Re: [MCCODES v2] Attack restriction What do u mean? you have np clue Quote
Magictallguy Posted June 13, 2009 Posted June 13, 2009 Re: [MCCODES v2] Attack restriction What do u mean? you have np clue Your code contained an error.. Quote
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.