Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have errors in your coding or want something specific added to your game? Check out our paid support here.


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

AuthorTopic: New Gang Upgrade  (Read 390 times)

BlackVengeance

  • Basic Member
  • *
  • Reputation Power: 18
  • BlackVengeance has no influence.
  • Offline Offline
  • Posts: 22
    • View Profile
New Gang Upgrade
« on: January 14, 2011, 02:56:20 PM »
I thought i had made this before, but i could not find it anywhere, but anyways here it is haven't tested it out that well, but if you see any errors in it please tell me and ill correct it. isn't much so here it is. Enjoy!

Add this SQL into your MYSQL database

Code: [Select]
CREATE TABLE IF NOT EXISTS `gangplace` (
  `gID` int(11) NOT NULL DEFAULT '0',
  `gMEMBERS` int(11) NOT NULL DEFAULT '0',
  `gCOST` bigint(32) DEFAULT '0',
  `gNAME` varchar(255) DEFAULT '',
  PRIMARY KEY (`gID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

The After that is done you simply open yourgang.php and find the section that calls for gang upgrades. it should look something like this depending on what addons you have in your game.

Code: [Select]
function gang_staff_upgrades()
{
global $ir,$c,$userid,$gangdata;

if($gangdata['gangVICEPRES'] != $userid AND $gangdata['gangPRESIDENT'] != $userid AND $userid!=1)
die("You do not have access to this...");

if(isset($_POST['membs']))
{
$_POST['membs']=strip_tags($_POST['membs']);
if($_POST['membs']*100000000 > $gangdata['gangMONEY'])
{
print "Your clan does not have enough money to upgrade that much capacity.";
}
else
{
$cost=$_POST['membs']*100000000;
mysql_query("UPDATE gangs SET gangCAPACITY=gangCAPACITY+{$_POST['membs']},gangMONEY=gangMONEY-$cost WHERE gangID={$ir['gang']}",$c);
print "You paid \$$cost to add {$_POST['membs']} capacity to your clan.";
}
}
else
{
print "<b><u>Capacity</u></b><br />
Current Capacity: {$gangdata['gangCAPACITY']}<br />
<form action='yourgang.php?action=staff&act2=upgrade' method='post'>Enter the amount of extra capacity you need. Each extra member slot costs \$100,000,000.<br />
<input type='text' name='membs' /><br />
<input type='submit' value='Buy' /></form>";
}
}

Completely replace that with this sexxeh thang!

Code: [Select]
function gang_staff_upgrades()
{
global $ir,$c,$userid,$gangdata;


print "<b><u>Capacity</u></b><br />
Current Capacity: {$gangdata['gangCAPACITY']}<br />";
$place=mysql_query("SELECT * FROM gangplace WHERE gMEMBERS > {$gangdata['gangCAPACITY']}",$c);

print"<table width=80% class=forumline>
<th>Location</th><th>Capacity</th><th>Cost</th><th>Buy</th><tr>";
while($gp=mysql_fetch_array($place))
print"<td>{$gp['gNAME']}</td><td>{$gp['gMEMBERS']}</td>
<td>{$gp['gCOST']}</td>
<td><a href=yourgang.php?action=staff&act2=doupgrade&ID={$gp['gID']}>Buy</a></td><tr>";
}

function gang_staff_doupgrades()
{
global $ir,$c,$userid,$gangdata;


print "<b><u>Capacity</u></b><br />";
$gangplace=mysql_query("SELECT * FROM gangplace WHERE gID={$_GET['ID']}",$c);
$gp=mysql_fetch_array($gangplace);
if($gangdata['gangVICEPRES'] != $userid AND $gangdata['gangPRESIDENT'] != $userid AND $userid!=1)
die("You do not have access to this...");


if($gp['gCOST'] > $gangdata['gangMONEY'])
{
die("Your clan does not have enough money to upgrade that much capacity.");
}
if($gp['gMEMBERS'] < $gangdata['gangCAPACITY'])
{
die("You can not downgrade your clan!.");
}
else
{
mysql_query("UPDATE gangs SET gangCAPACITY={$gp['gMEMBERS']},gangMONEY=gangMONEY-{$gp['gCOST']} WHERE gangID={$ir['gang']}",$c);
print "You paid \${$gp['gCOST']} to move your clan into a {$gp['gNAME']}.";
}
}



After you do that you need to add another case as i made this two functions


So find this
Code: [Select]
case "upgrade":
gang_staff_upgrades();
break;

And below add this

Code: [Select]
case "doupgrade":
gang_staff_doupgrades();
break;


And holy cow you just added this first coding i have done in like 2 years. Pat your self on the back. Ill be adding some more stuff here soon! Stay Sexxeh! ;)
Logged
 


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