Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Gang War Surrender Resolved!!!!  (Read 506 times)

ReignFire

  • Basic Member
  • *
  • Reputation Power: 36
  • ReignFire has no influence.
  • Offline Offline
  • Posts: 56
    • View Profile
Gang War Surrender Resolved!!!!
« on: November 12, 2009, 07:49:44 PM »
i posted this in my original thread but i wanted to make this easier to find as i can not edit my original post to show as resolved. just trying to help everyone out!


function gang_staff_viewsurrenders()
{
global 
$db,$ir,$c,$userid,$gangdata;
if(!isset(
$_POST['subm']))
{
echo 
"<form action='yourgang.php?action=staff&act2=viewsurrenders' method='post'>
Choose who to accept the surrender from.<br />
<input type='hidden' name='subm' value='submit' />
Gang: <select name='sur' type='dropdown'>"
;
$sql sprintf(
"SELECT s.*, w.* " .
"FROM surrenders s " .
"LEFT JOIN gangwars w ON (s.surWAR = w.warID) " .
"WHERE (surTO = %u)"$ir['gang']);
$wq $db->query($sql);
while(
$r $db->fetch_row($wq))
{
$w = ($gangdata['gangID'] == $r['warDECLARER']) ? "You" "Them";
$f = ($gangdata['gangID'] == $r['warDECLARER']) ? "warDECLARED" "warDECLARER";
$SelectGangs sprintf("SELECT * FROM gangs WHERE (gangID = %u)"$r[$f]);
$ggq $db->query($SelectGangs);
$them $db->fetch_row($ggq);
echo 
sprintf("<option value='%u'>War vs. %s (Msg: %s)</option>"$r['surID'], stripslashes($them['gangNAME']), stripslashes($r['surMSG']));
}
echo 
"</select><br /><input type='submit' value='Accept Surrender' /></form>";
}
else
{
$_POST['sur'] = abs(@intval($_POST['sur']));
$SelectWar sprintf("SELECT surWAR FROM surrenders WHERE (surID = %u)"$_POST['sur']);
$q $db->query($SelectWar);
if(!
$db->num_rows($q))
{
echo 
"Invalid surrender";
$h->endpage();
exit;
}
$war $db->fetch_row($q);
$SelectGangWars sprintf("SELECT * FROM gangwars WHERE (warID = %u)"$war['surWAR']);
$wq $db->query($SelectGangWars);
if(
$db->num_rows($wq) == 0)
{
echo 
"Invalid Gang";
exit;
}
$r $db->fetch_row($wq);
$w = ($gangdata['gangID'] == $r['warDECLARER']) ? "You" "Them";
$f = ($gangdata['gangID'] == $r['warDECLARER']) ? "warDECLARED" "warDECLARER";

$AcceptSurrender sprintf("DELETE FROM surrenders WHERE (surID = %u)"$_POST['sur']);
$EndWar sprintf("DELETE FROM gangwars WHERE (warID = %u)"$war['surWAR']);
$db->query($AcceptSurrender);
$db->query($EndWar);

$SelectGang sprintf("SELECT gangID, gangNAME FROM gangs WHERE (gangID = %u)"$r[$f]);
$ggq $db->query($SelectGang);
$them $db->fetch_row($ggq);

$eventage sprintf("<a href='gangs.php?action=view&ID=%u'>%s</a> have accepted the surrender from <a href='gangs.php?action=view&ID=%u'>%s</a>. The war is over!"$ir['gang'], $gangdata['gangNAME'], $them['gangID'], $them['gangNAME']);

$event str_replace("'""''"$eventage);

$LogEvent sprintf("INSERT INTO gangevents VALUES ('', %u, unix_timestamp(), '%s'), ('', %u, unix_timestamp(), '%s')"$ir['gang'], $event$r[$f], $event);
$db->query($LogEvent);
echo 
"You have accepted surrender, the war is over.";
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Gang War Surrender Resolved!!!!
« Reply #1 on: November 13, 2009, 11:57:05 AM »
Nice, mabey put it in the mods next time.
Logged
Project Choosen - 10%
Daniel - Hanson . Com

ReignFire

  • Basic Member
  • *
  • Reputation Power: 36
  • ReignFire has no influence.
  • Offline Offline
  • Posts: 56
    • View Profile
Re: Gang War Surrender Resolved!!!!
« Reply #2 on: November 13, 2009, 12:05:21 PM »
its not really a mod but a fix...so thats where fixes should go then?
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.