Jump to content
MakeWebGames

Recommended Posts

Posted

I currently now faced with another gang surrender fault. Im unsure what the cause is. The system will work fine but after so many surrenders are entered into the database its starts going mad. People start getting , they can view the surrender but the button disappears to others saying they have been sent a surrender but dont see anything to clicking the button for it to say surrender accepted which dosent close the war. ????????? I woundered if anyone else had this problem. Could it be when no one enters a message maybe? As I say it works form the start but then goes mad after so many. The only difference I can see is some have a message and some dont. Anyone had this? Thx for any help in advance.

Posted

Re: Gang Surrender problem. Yet another one.

Code I would say has the problem -

function gang_staff_viewsurrenders()

{

global $db,$ir,$c,$userid,$gangdata;

if(!isset($_POST['subm']))

{

print "<form action='yourgang.php?action=staff&act2=viewsurrenders' method='post'>

Choose who to accept the surrender from.

<input type='hidden' name='subm' value='submit' />

Gang: <select name='sur' type='dropdown'>";

$wq=$db->query("SELECT s.*,w.* FROM surrenders s LEFT JOIN gangwars w ON s.surWAR=w.warID WHERE surTO={$ir['gang']}");

while($r=$db->fetch_row($wq))

{

if($gangdata['gangID'] == $r['warDECLARER']) { $w="You";$f="warDECLARED"; } else { $w="Them";$f="warDECLARER"; }

$ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]);

$them=$db->fetch_row($ggq);

print "<option value='{$r['surID']}'>War vs. {$them['gangNAME']} (Msg: {$r['surMSG']})</option>";

}

print "</select>

<input type='submit' value='Accept Surrender' /></form>";

}

else

{

$_POST['sur'] = abs((int) $_POST['sur']);

$q=$db->query("SELECT surWAR FROM surrenders WHERE surID={$_POST['sur']}");

$_POST['war'] = $db->fetch_single($q);

$wq=$db->query("SELECT * FROM gangwars where warID={$_POST['war']}");

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

if($gangdata['gangID'] == $r['warDECLARER']) { $w="You";$f="warDECLARED"; } else { $w="Them";$f="warDECLARER"; }

$db->query("DELETE FROM surrenders WHERE surID={$_POST['sur']}");

$db->query("DELETE FROM gangwars WHERE warID={$_POST['war']}");

$ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]);

$them=$db->fetch_row($ggq);

$event=str_replace("'","''","{$gangdata['gangNAME']} have accepted the surrender from {$them['gangNAME']}, the war is over!");

$db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',".$r[$f].",unix_timestamp(),'$event')");

print "You have accepted surrender, the war is over.";

}

}

Posted

Re: Gang Surrender problem. Yet another one.

Looks like there might be a glitch if a gang sends 2 surrenders for the same war. Check your surrender table and remove any duplicates.

If that works, you might need to put code in place to prevent more than 1 surrender of a war.

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