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: [v1] & [v2] Stop Gangs From Kicking While @ War  (Read 1609 times)

Cyanide

  • Global Moderator
  • Basic Member
  • *****
  • Reputation Power: 38
  • Cyanide has no influence.
  • Offline Offline
  • Posts: 55
    • MSN Messenger - xcyanide187x@live.com
    • View Profile
[v1] & [v2] Stop Gangs From Kicking While @ War
« on: April 01, 2009, 02:33:10 AM »
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:
Code: [Select]
function gang_staff_kick()
{

Replace the whole function with:
Code: [Select]
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:
Code: [Select]
function gang_leave()
{

Replace the whole function with:
Code: [Select]
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:
Code: [Select]
function gang_staff_pres()
{

Replace the whole function with:
Code: [Select]
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....
Logged

GetReal

  • Basic Member
  • *
  • Reputation Power: 0
  • GetReal is looked down upon.
  • Offline Offline
  • Posts: 2
    • View Profile
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #1 on: April 03, 2009, 10:24:29 PM »
I've been looking for something like this for ages.  Thanks Cyanide :D
Logged

BlackDogg

  • Basic Member
  • *
  • Reputation Power: 2
  • BlackDogg has no influence.
  • Offline Offline
  • Posts: 16
    • View Profile
    • Email
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #2 on: April 15, 2009, 05:58:37 PM »
cheers mate this is really usefull
Logged

BlackDogg

  • Basic Member
  • *
  • Reputation Power: 2
  • BlackDogg has no influence.
  • Offline Offline
  • Posts: 16
    • View Profile
    • Email
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #3 on: May 09, 2009, 04:35:33 AM »
What would i have to put in to stop one man gangs starting a war on  gang with morre members
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #4 on: May 13, 2009, 04:15:25 AM »
This is more like something we need.
Logged

Twist3d Fat3

  • Basic Member
  • *
  • Reputation Power: 52
  • Twist3d Fat3 has no influence.
  • Offline Offline
  • Posts: 42
    • View Profile
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #5 on: June 28, 2009, 12:22:45 AM »
Its a really good Idea, I would give It a +1

I will not use though because If my members want to leave the gang they are more than welcome too, I mean what If your members start fighting, or breaking gang rules? I wouldn't want to surrender just to get rid of someone.

Really nice Idea though :)
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #6 on: July 07, 2009, 07:16:41 AM »
Finally installed it
Works perfect.
Sweet.
Logged

mentaljason

  • Basic Member
  • *
  • Reputation Power: 13
  • mentaljason has no influence.
  • Offline Offline
  • Posts: 28
  • MentalJason HURRAH
    • View Profile
    • WWW
Re: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #7 on: January 14, 2010, 08:49:11 AM »
Very good. i have found a little problem that some gangs may declare war just to keep some members, and gangs can do changes just before they declare war so why not just block the people who have been declared againt from leaving the declaring gang doesnt need this.
Logged
Like Mccodes? Like things to be free? try My mods forum where all of the mods are free!

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: [v1] & [v2] Stop Gangs From Kicking While @ War
« Reply #8 on: January 14, 2010, 12:42:13 PM »
What if there declaring gang is losing, and they all leave the gang.
Logged
Project Choosen - 10%
Daniel - Hanson . Com
 


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