Jump to content
MakeWebGames

help


skull

Recommended Posts

cant get this to work this is attack ladder

 

<?php

$atkpage=1;

include "globals.php";

if($ir['hospital']) { die("This page cannot be accessed while in hospital."); }

if($ir['jail']) { die("This page cannot be accessed while in jail."); }

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

$_SESSION['attacking']=0;

$ir['attacking']=0;

$db->query("UPDATE users SET attacking=0 WHERE userid=$userid");

$od=$db->query("SELECT * FROM users WHERE userid={$_GET['ID']}");

if($_SESSION['attackwon'] != $_GET['ID'])

{

die ("Cheaters don't get anywhere.");

}

if($db->num_rows($od))

{

$r=$db->fetch_row($od);

$gq=$db->query("SELECT * FROM gangs WHERE gangID={$r['gang']}");

$ga=$db->fetch_row($gq);

if($r['hp'] == 1)

{

print "What a cheater u are.";

}

else

{

$db->query("UPDATE users SET attacks_won=attacks_won+1 WHERE userid=$userid");

$db->query("UPDATE users SET attacks_total=attacks_total+1 WHERE userid=$userid");

$db->query("UPDATE users SET defends_lost=defends_lost+1 WHERE userid={$_GET['ID']}");

$db->query("UPDATE users SET defends_total=defends_total+1 WHERE userid={$_GET['ID']}");

$db->query("UPDATE users SET total_won=total_won+1 WHERE userid=$userid");

$db->query("UPDATE users SET total_lost=total_lost+1 WHERE userid={$_GET['ID']}");

$db->query("UPDATE users SET total_total=total_total+1 WHERE userid=$userid");

$db->query("UPDATE users SET total_total=total_total+1 WHERE userid={$_GET['ID']}");

$db->query("INSERT INTO userattacks VALUES($userid,'You attacked <a href=viewuser.php?u={$r['userid']}>{$r['username']}</a>, in a ladder battle.',unix_timestamp());");

$db->query("INSERT INTO userattacks VALUES({$r['userid']},'<a href=viewuser.php?u=$userid>{$ir['username']}</a> beat you in a ladder battle.',unix_timestamp());");

 

$half=$ir['maxenergy']/2/2;

$db->query("UPDATE users SET energy=energy+$half WHERE userid=$userid");

$_SESSION['attackwon']=0;

event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat');

if($you['ladderRANK'] < $them['ladderRANK'] && $you['ladderRANK'] == 1)

{

event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat');

die("<center>You did not lose or gain any ladder rank.</center>");

}

if($you['ladderRANK'] < $them['ladderRANK'] && $you['ladderRANK'] < 22)

{

event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat');

die("<center>You did not lose or gain any ladder rank.</center>");

}

if($you['ladderRANK'] < $them['ladderRANK'] && $you['ladderRANK'] > 21)

{

$newrank=$you['ladderRANK']-1;

$otherrank=$you['ladderRANK'];

$db->query("UPDATE ladder SET ladderRANK=$otherrank WHERE ladderRANK=$newrank");

$db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid");

die("<center>You have gained 1 position in the ladder rankings.</br>You are now rank <font color=red>$newrank</font>.</center>");

}

if($you['ladderRANK'] > $them['ladderRANK'] && $you['ladderRANK'] > 10)

{

event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat');

$blah=round(($you['ladderRANK']-$them['ladderRANK'])/2);

$newrank=$you['ladderRANK']-$blah;

$lowest=$newrank-1;

$dert=$db->query("SELECT * FROM ladder WHERE ladderRANK>$lowest AND ladderRANK<{$you['ladderRANK']}") or die(mysql_error());

while($others=$db->fetch_row($dert))

{

$db->query("UPDATE ladder SET ladderRANK=ladderRANK+1 WHERE ladderID={$others['ladderID']}") or die(mysql_error());

}

$db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid") or die(mysql_error());

die("<center>You have gained $blah position(s) in rank.</br>You are now rank <font color=red>$newrank</font>.</center>");

}

if($you['ladderRANK'] > $them['ladderRANK'] && $you['ladderRANK'] > 6)

{

event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat');

$newrank=$you['ladderRANK']-2;

$lowest=$newrank-1;

$dert=$db->query("SELECT * FROM ladder WHERE ladderRANK>$lowest AND ladderRANK<{$you['ladderRANK']}");

while($others=$db->fetch_row($dert))

{

$db->query("UPDATE ladder SET ladderRANK=ladderRANK+1 WHERE ladderID={$others['ladderID']}");

}

$db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid");

die("<center>You have gained 2 positions in rank.</br>You are now rank <font color=red>$newrank</font>.</center>");

}

if($you['ladderRANK'] > $them['ladderRANK'] && $you['ladderRANK'] < 7)

{

event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat');

$newrank=$you['ladderRANK']-1;

$lowest=$newrank-1;

$dert=$db->query("SELECT * FROM ladder WHERE ladderRANK>$lowest AND ladderRANK<{$you['ladderRANK']}");

while($others=$db->fetch_row($dert))

{

$db->query("UPDATE ladder SET ladderRANK=ladderRANK+1 WHERE ladderID={$others['ladderID']}");

}

$db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid");

die("<center>You have gained 1 position in rank.</br>You are now rank <font color=red>$newrank</font>.</center>");

}

}

}

$h->endpage();

?>

Link to comment
Share on other sites

Re: help

it doesnt update the query

you to battle ladder you attack

you finish and it on the screen were it says leave, mug and all attack ladder button ther when press it goes to this file and thats it blank page doesnt update

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