Believe it or not, I was actually the first person to ever post this edit publicly lol. Back in 2007. I posted it on a board that I no longer use so I decided to bring it over to CW. This edit stops gangs from kicking users, leaving, or changing presidents while at war.
Find:
function gang_staff_kick()
{
Replace the whole function with:
function gang_staff_kick()
{
global $ir,$c,$userid,$gangdata;
$wq=mysql_query("SELECT * FROM gangwars where warDECLARER={$ir['gang']} or warDECLARED={$ir['gang']}",$c);
if(mysql_num_rows($wq) > 0)
{
die ("You Cannot Kick While At War!");
}
else if($gangdata['gangPRESIDENT'] == $userid || $gangdata['gangVICEPRES'] == $userid || $userid==1)
{
$_GET['ID'] = abs((int) $_GET['ID']);
$who=$_GET['ID'];
if($who==$gangdata['gangPRESIDENT'])
{
print "The gang president cannot be kicked.";
}
else if($who == $userid)
{
print "You cannot kick yourself, if you wish to leave transfer your powers to someone else and then leave like normal.";
}
else
{
$q=mysql_query("SELECT * FROM users WHERE userid=$who AND gang={$gangdata['gangID']}",$c);
if(mysql_num_rows($q))
{
$kdata=mysql_fetch_array($q);
mysql_query("UPDATE users SET gang=0,daysingang=0 WHERE userid=$who",$c);
print "<b>{$kdata['username']}</b> was kicked from the Gang.";
event_add($who,"You were kicked out of {$gangdata['gangNAME']} by <a href='viewuser.php?u=$userid'>{$ir['username']}</a>",$c,'gang');
mysql_query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'<a href=''viewuser.php?u=$who''>{$kdata['username']}</a> was kicked out of the Gang by <a href=''viewuser.php?u=$userid''>{$ir['username']}</a>');",$c);
}
else
{
print "Trying to kick nonexistant user";
}
}
}
else
{
print "You do not have permission to perform this action.";
}
}
Find:
function gang_leave()
{
Replace the whole function with:
function gang_leave()
{
global $ir,$c,$userid,$gangdata;
$wq=mysql_query("SELECT * FROM gangwars where warDECLARER={$ir['gang']} or warDECLARED={$ir['gang']}",$c);
if(mysql_num_rows($wq) > 0)
{
die ("You Cannot Leave Your Gang During War");
}
else if($gangdata['gangPRESIDENT'] == $userid || $gangdata['gangVICEPRES'] == $userid)
{
print "You cannot leave while you are still president or vice-president of your gang.";
}
else
{
mysql_query("UPDATE users SET gang=0,daysingang=0 WHERE userid=$userid",$c);
mysql_query("INSERT INTO gangevents VALUES ('',{$ir['gang']},unix_timestamp(),'<a href=''viewuser.php?u=$userid''>{$ir['username']}</a> left the gang.');",$c);
print "You left your gang.";
}
}
Find:
function gang_staff_pres()
{
Replace the whole function with:
function gang_staff_pres()
{
global $ir,$c,$userid,$gangdata;
$wq=mysql_query("SELECT * FROM gangwars where warDECLARER={$ir['gang']} or warDECLARED={$ir['gang']}",$c);
if(mysql_num_rows($wq) > 0)
{
die ("You Cannot Change Presidents While At War");
}
else if($gangdata['gangPRESIDENT'] == $userid || $userid==1)
{
if(isset($_POST['subm']))
{
mysql_query("UPDATE gangs SET gangPRESIDENT={$_POST['vp']} WHERE gangID={$gangdata['gangID']}",$c);
$m=mysql_query("SELECT * FROM users WHERE userid={$_POST['vp']}",$c);
$memb=mysql_fetch_array($m);
event_add($memb['userid'],"You were transferred presidency of {$gangdata['gangNAME']}.",$c,'gang');
print "Presidency was transferred to {$memb['username']}";
}
else
{
print "<form action='yourgang.php?action=staff&act2=pres' method='post'>
Enter the ID of the new president.<br />
<input type='hidden' name='subm' value='submit' />
ID: <input type='text' name='vp' value='{$gangdata['gangPRESIDENT']}' maxlength='7' width='7' /><br />
<input type='submit' value='Change' /></form>";
}
}
}
All comments are welcome....hope this can help someone....