Jump to content
MakeWebGames

Recommended Posts

Posted

i want my attacklost say if someone looses attack they have to go to hosp here is my code

<?php
$atkpage=1;
include_once ('globals.php');

$_GET['ID']==abs((int) $_GET['ID']);
$_SESSION['attacking']=0;
$od=$db->query("SELECT * FROM users WHERE userid={$_GET['ID']}");
if($db->num_rows($od))
{
$r=$db->fetch_row($od);
print "You lost to {$r['username']}";
$expgain=abs(($ir['level']-$r['level'])^3);
$expgainp=$expgain/$ir['exp_needed']*100;
print " and lost $expgainp% EXP!";
$db->query("UPDATE users SET exp=exp-$expgain, attacking=0 WHERE userid=$userid");
$db->query("UPDATE users SET exp=0 WHERE exp<0");
event_add($r['userid'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] attacked you and lost.",$c);
$atklog=mysql_escape_string($_SESSION['attacklog']);
$db->query("INSERT INTO attacklogs VALUES('',$userid,{$_GET['ID']},'lost',unix_timestamp(),0,'$atklog');");
$warq=$db->query("SELECT * FROM gangwars WHERE (warDECLARER={$ir['gang']} AND warDECLARED={$r['gang']}) OR (warDECLARED={$ir['gang']} AND warDECLARER={$r['gang']})");
if ($db->num_rows($warq) > 0)
{
$war=$db->fetch_row($warq);
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+1 WHERE gangID={$r['gang']}");
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-1 WHERE gangID={$ir['gang']}");
print "
You lost 1 respect for your gang!";
}
}
else
{
print "You lost to Mr. Non-existant! =O";
}
if( !isset($_SESSION['attacklost']) )
{
   echo 'Cheaters dont get no where.';
   $h->endpage();
   exit;
}
$h->endpage();
?>
Posted

Re: If user looses ther attack

 

[php]<?php
$atkpage=1;
include_once ('globals.php');

$_GET['ID']==abs((int) $_GET['ID']);
$_SESSION['attacking']=0;
$od=$db->query("SELECT * FROM users WHERE userid={$_GET['ID']}");
if($db->num_rows($od))
{
$r=$db->fetch_row($od);
print "You lost to {$r['username']}";
$expgain=abs(($ir['level']-$r['level'])^3);
$expgainp=$expgain/$ir['exp_needed']*100;
print " and lost $expgainp% EXP!";
$hosp = mt_rand(25,60);
$reason = sprintf("Lost to <a href=\'viewuser.php?ID=%u\'>%s</a>", $r['userid'], mysql_real_escape_string($r['username']));
$db->query(sprintf("UPDATE users SET exp = exp - %s, hospital = %s, hospreason = '%s', attacking = 0 WHERE (userid = %s)",$expgain,$hosp, $reason, abs(@intval($userid))));
$db->query("UPDATE users SET exp=0 WHERE exp<0");
event_add($r['userid'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] attacked you and lost.",$c);
$atklog=mysql_escape_string($_SESSION['attacklog']);
$db->query("INSERT INTO attacklogs VALUES('',$userid,{$_GET['ID']},'lost',unix_timestamp(),0,'$atklog');");
$warq=$db->query("SELECT * FROM gangwars WHERE (warDECLARER={$ir['gang']} AND warDECLARED={$r['gang']}) OR (warDECLARED={$ir['gang']} AND warDECLARER={$r['gang']})");
if ($db->num_rows($warq) > 0)
{
$war=$db->fetch_row($warq);
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+1 WHERE gangID={$r['gang']}");
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-1 WHERE gangID={$ir['gang']}");
print "
You lost 1 respect for your gang!";
}
}
else
{
print "You lost to Mr. Non-existant! =O";
}
if( !isset($_SESSION['attacklost']) )
{
   echo 'Cheaters dont get no where.';
   $h->endpage();
   exit;
}
$h->endpage();
?>
Posted

Re: If user looses ther attack

If you can't work out how to do something this simple you shouldn't own a game, Just look at the code and as Shizzle said, figure it out yourself from attackhosp.php!

Posted

Re: If user looses ther attack

 

If you can't work out how to do something this simple you shouldn't own a game, Just look at the code and as Shizzle said, figure it out yourself from attackhosp.php!

I already done it >.<

Posted

Re: If user looses ther attack

 

Should of let him add that tiny bit of code though :P

It's a nice day, the sun is out. It made me feel good for a little bit so I decided to help out, Any other day I would've written an essay about how to poster sucks :-) Because I'm mean.

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