Jump to content
MakeWebGames

Recommended Posts

Posted

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,

Posted

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

Posted

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

Posted

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?)

Posted

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

Posted

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

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