Jump to content
MakeWebGames

Richard

Members
  • Posts

    277
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Richard

  1. Re: Looking To Buy Yeah, best to get this kind of mod from an experienced coder, Mine are a bit rubbish
  2. Re: [MCCODES V2+V1] Easiest Editing System you will ever need... Very nice work, Looks good :) +1
  3. Re: Businesses Mod [Mccode V2] Wow, nice work KiX :D Looks very nice
  4. Re: Businesses Mod [Mccode V2]   I dont mind at all :) Nice little update to it, Good work KiX
  5. Re: Businesses Mod [Mccode V2]   YEAH GREAT MOD BUT WHEN I ADDED LINKS TO EXPLORE I HAD TO CHANGE... <a href='business_view.php">Business listings</a> <a href='business_create.php">Create a business</a> <a href='business_home.php">Your business</a>........... TO Business listings Create a business Your business ......... AND IT WAS CAUSING ERRORS HERE M8 NICE MOD BUT I AM A REALLY NOOB CODER AND I SPOTTED IT STRAIGHT AWAY I THOUGHT U COULD OF LEAST GOT LINKS RIGHT :S In my script I use echo 'Text here'; So all my links appear like that, it isnt an error
  6. Re: Businesses Mod [Mccode V2] I think I might have named the donate_cash function as donate_vault, Just change that to fix
  7. Re: Businesses Mod [Mccode V2] Oh also replac: $ttl_profit += $fetch_cash['busCash'];   With $ttl_profit += ($fetch_cash['busCash'] + 1);
  8. Re: Businesses Mod [Mccode V2] Sorry about that Replace: $rate = (int) (($fb['busCash'] / $ttl_profit * 100) / 20);   With: $rate = (int) ((($fb['busCash'] + 1) / $ttl_profit * 100) / 20);
  9. Re: Businesses Mod [Mccode V2] Thanks Dylan :) Spent two days on it lol
  10. Re: Businesses Mod [Mccode V2] Last post now Make business_view.php <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Business details</p>'; switch ($_GET['page']) { case 'class': view_class(); break; case 'profile': view_profile(); break; case 'sendapp': send_application(); break; default: business_index(); break; } function business_index() { global $ir; echo '<p align="center"> [b]Business classes:[/b] <table width="600">'; $fetch_classes = mysql_query("SELECT * FROM `businesses_classes` ORDER BY `classId` ASC"); while($r = mysql_fetch_assoc($fetch_classes)) { echo ' <tr> <td width="275" align="right">'.stripslashes($r['className']).' •</td> <td width="50"></td> <td width="275" align="left">> [url="business_view.php?page=class&id='.$r['classId'].'"]View '.stripslashes($r['className']).' businesses[/url]</td> </tr>'; } echo '</table> </p>'; } function view_class() { global $ir; if($_GET['id']) { $fetch_class = mysql_query(sprintf("SELECT * FROM `businesses_classes` WHERE (`classId` = '%u')", abs((int) $_GET['id']))); if(!mysql_num_rows($fetch_class)) { echo 'You cannot view a business class that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_class); echo '<hr width="600"> <p align="center"> [b]'.stripslashes($r['className']).':[/b] [i]'.stripslashes($r['classDesc']).'[/i] <hr width="600"> <p align="center"> [b]Business details:[/b] The '.stripslashes($r['className']).' business is small and starts with a maximum of [b]'.number_format($r['classMembers']).'[/b] members until it has been upgraded. The total start up cost of a '.stripslashes($r['className']).' business is $'.number_format($r['classCost']).'.</p> <hr width="600"> <table width="600" class="table"> <tr> <th colspan="4">'.stripslashes($r['className']).' ranks</th> </tr>'; $fetch_ranks = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE `rankClass` = '%u'", abs((int) $_GET['id']))); while($rn = mysql_fetch_assoc($fetch_ranks)) { echo ' <tr> <td width="25%">[b]Rank:[/b] '.stripslashes($rn['rankName']).'</td> <td width="20%">[b]Primary stat:[/b] '.stripslashes($rn['rankPrim']).'</td> <td width="20%">[b]Secondary stat:[/b] '.stripslashes($rn['rankSec']).'</td> <td width="45%">[b]Stat gain:[/b] '.$rn['rankPGain'].' '.stripslashes($rn['rankPrim']).' and '.$rn['rankSGain'].' '.stripslashes($rn['rankSec']).'</td> </tr>'; } echo '</table> <hr width="600"> <table width="600" class="table"> <tr> <th colspan="2">'.stripslashes($r['className']).' businesses</th> </tr>'; $bus_rating = mysql_query("SELECT `busCash` FROM `businesses`"); $ttl_profit = 0; while($fetch_cash = mysql_fetch_assoc($bus_rating)) { $ttl_profit += ($fetch_cash['busCash'] + 1); } $fetch_businesses = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE `busClass` = '%u'", abs((int) $_GET['id']))); while($fb = mysql_fetch_assoc($fetch_businesses)) { $rate = (int) ((($fb['busCash'] + 1) / $ttl_profit * 100) / 20); echo ' <tr> <td width="85%">[url="business_view.php?page=profile&id='.$fb['busId'].'"][b]'.stripslashes($fb['busName']).'[/b][/url] - [url="viewuser.php?u='.$fb['userid'].'"][i]'.stripslashes($fb['username']).'[/i][/url]</td> <td width="15%">[img=images/business/'.$rate.'.gif]</td> </tr>'; } echo '</table> <hr width="600">'; } } else { echo 'You did not select a business class to view.'; } } function view_profile() { global $ir; if($_GET['id']) { $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) LEFT JOIN `users` ON (`userid` = `busDirector`) WHERE (`busId` = '%u')", abs((int) $_GET['id']))); if(!mysql_num_rows($fetch_business)) { echo 'You cannot view a business that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_business); echo '<hr width="400"> <table width="400" class="table"> <tr> <th colspan="2">Details of '.stripslashes($r['busName']).' - '.stripslashes($r['className']).'</th> </tr> <tr height="100"> <td colspan="2" valign="middle" align="center">'; if($r['busImage']) { echo '[img='.stripslashes($r['busImage']).']'; } else { echo 'This business has no banner at this time.'; } echo '</td></tr> <tr> <th colspan="2">Further information</th> </tr> <tr height="150"> <td colspan="2" valign="middle" align="center"> <table width="200"> <tr> <td> [b]Class:[/b] '.stripslashes($r['className']).' [b]Director:[/b] [url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url] [b]Latest profit:[/b] $'.number_format($r['busProfit']).' [b]Previous profit:[/b] $'.number_format($r['busYProfit']).' [b]Latest customers:[/b] '.number_format($r['busCust']).' [b]Previous customers:[/b] '.number_format($r['busYCust']).' [url="business_view.php?page=sendapp&id='.$_GET['id'].'"]Send application[/url] </td> </tr> </table> </td> </tr> <tr> <th colspan="2">'.stripslashes($r['busName']).' members</th> </tr> <tr> <td width="50%">[b]Name:[/b] [url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url]</td> <td width="50%">[b]Rank:[/b] Director (None)</td> </tr>'; $fetch_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", abs((int) $_GET['id']))); while($fm = mysql_fetch_assoc($fetch_members)) { echo ' <tr> <td width="50%">[b]Name:[/b] [url="viewuser.php?u='.$fm['userid'].'"]'.stripslashes($fm['username']).'[/url]</td> <td width="50%">[b]Rank:[/b] '.stripslashes($fm['rankName']).' ($'.number_format($fm['bmembCash']).')</td> </tr>'; } echo '</table> <hr width="400">'; } } else { echo 'You did not select a business to view.'; } } function send_application() { global $ir; $check_bus = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busId` = '%u')", abs((int) $_GET['id']))); $check_app = mysql_query(sprintf("SELECT * FROM `businesses_apps` WHERE (`appMember` = '%u') AND (`appBusiness` = '%d')", $ir['userid'], abs((int) $_GET['id']))); $check = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busDirector` = '%u')", $ir['userid'])); $check_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); if(!mysql_num_rows($check_bus)) { echo 'You cannot send an application to a non-existant business.'; } else if(mysql_num_rows($check) || mysql_num_rows($check_member)) { echo 'You are part of a business right now, leave before sending an application to a new one.'; } else if(mysql_num_rows($check_app)) { echo 'You have a sent application to this business right now, wait for a responce.'; } else if(!$_GET['id']) { echo 'You did not choose a business to send an application to.'; } else if($_POST['application']) { $app = str_replace(array("\n"), array(" "), strip_tags($_POST['application'])); $string_app = mysql_real_escape_string($app); mysql_query(sprintf("INSERT INTO `businesses_apps` (`appId`, `appMember`, `appBusiness`, `appText`, `appTime`) VALUES ('NULL','%d', '%u', '%s', '%d')", $ir['userid'], abs((int) $_GET['id']), $string_app, time())); echo 'Your application was sent to the selected business, a responce will be given from the director soon.'; } else { $r = mysql_fetch_assoc($check_bus); echo '<form action="business_view.php?page=sendapp&id='.$_GET['id'].'" method="post"> <p align="center"> [b]Enter an application below to send a request to the director of '.stripslashes($r['busName']).'.[/b] You can send one application at a time, wait for the result of that application before sending another. If the business director is not active, it might take a while for the application to be managed, So it could be worth speaking with the director before submitting a new application to the business. Entering a detailed application will increase the chance of having it accepted, but this is no guarantee. Your working stats will also be sent to the director of the business with the application to help them decide. Your application: <textarea type="text" name="application" s="40" rows="10" cols="70" maxlength="255"></textarea> <input type="submit" value="Submit application" /></p> </form>'; } } $h->endpage(); ?>   Make business_cron.php (run each night) <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } include "global_func.php"; $select_businesses = mysql_query("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) ORDER BY `busId` ASC"); while($bs = mysql_fetch_assoc($select_businesses)) { $amount = mysql_num_rows(mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE `bmembBusiness` = '%u'", $bs['busId']))); $new_customers = ((($bs['classCost'] / 5000) * ($amount + 1) + rand(-12, 18)) / 2); $new_profit = (($new_customers + rand(-4, 8)) * ((($bs['classCost'] / 2500) * rand(2, 8)) / 10) * ($amount + 1)); mysql_query(sprintf("UPDATE `businesses` SET `busYCust` = `busCust`, `busYProfit` = `busProfit`, `busCust` = '%d', `busProfit` = '%d', `busCash` = `busCash` + '%d' WHERE `busId` = '%u'", $new_customers, $new_profit, ($new_profit - $bs['busCash']), $bs['busId'])) OR die('Cron not run'); $fetch_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", $bs['busId'])); while($fm = mysql_fetch_assoc($fetch_members)) { $fetch_stat = array( 'strength' => 'strength', 'intel' => 'IQ', 'labour' => 'labour' ); mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", $fm['bmembCash'], $fm['userid'])); mysql_query(sprintf("UPDATE `userstats` SET `{$fetch_stat[$fm['rankPrim']]}` = `{$fetch_stat[$fm['rankPrim']]}` + '%.6f', `{$fetch_stat[$fm['rankSec']]}` = `{$fetch_stat[$fm['rankSec']]}` + '%.6f' WHERE (`userid` = '%u')", $fm['rankPGain'], $fm['rankSGain'], $fm['userid'])); if($bs['busCash'] < $fm['bmembCash']) { $text = "Member ID {$fm['bmembMember']} was not paid their \$".number_format($fm['bmembCash'])." due to lack of funds."; mysql_query(sprintf("INSERT INTO `businesses_alerts` (`alertId`, `alertBusiness`, `alertText`, `alertTime`) VALUES ('NULL', '%u', '%s', '%d')", $bs['busId'], $text, time())); mysql_query(sprintf("UPDATE `businesses` SET `busDebt` = `busDebt` + '%d' WHERE `busId` = '%u'", $fm['bmembCash'], $bs['busId'])); } else { mysql_query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` - '%d' WHERE `busId` = '%u'", $fm['bmembCash'], $bs['busId'])); } } if($bs['busDebt'] > $bs['classCost']) { $send_event = mysql_query(sprintf("SELECT `bmembMember` FROM WHERE `bmembBusiness` = '%u' ORDER BY `bmembId` DESC", $bs['busId'])); while($se = mysql_fetch_assoc($send_event)) { $text = "The {$bs['busName']} business went bankrupt\, all members have been discharged."; insert_event($se['bmembMember'], $text); } mysql_query(sprintf("DELETE FROM `businesses_members` WHERE (`bmembBusiness` = '%u')", $bs['busId'])); mysql_query(sprintf("DELETE FROM `businesses` WHERE (`busId` = '%u')", $bs['busId'])); } } ?>   Links: [url="business_view.php"]Business listings[/url] [url="business_create.php"]Create a business[/url] [url="business_home.php"]Your business[/url]
  11. Re: Businesses Mod [Mccode V2] Make business_manage.php <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Manage business</p>'; $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) WHERE (`busDirector` = '%u')", $ir['userid'])); if(!mysql_num_rows($fetch_business)) { echo 'You do not own a business right now!'; $h->endpage(); exit; } else { $inf = mysql_fetch_assoc($fetch_business); } switch ($_GET['p']) { case 'new_name': new_business_name(); break; case 'new_banner': new_business_banner(); break; case 'new_rank': edit_member_rank(); break; case 'new_salary': edit_member_salary(); break; case 'view_vault': view_vault(); break; case 'donate_cash': donate_cash(); break; case 'debt': sort_debt(); break; case 'bankrupt': bankrupt_business(); break; case 'credit_member': credit_member(); break; case 'view_apps': manage_applications(); break; case 'kick_out': kick_member(); break; default: business_index(); break; } function business_index() { global $ir, $inf; if($inf['busDebt']) { echo 'This business is in debt of $'.number_format($inf['busDebt']).' right now. Click [url="business_manage.php?p=debt"]here[/url] to sort it out. To bankrupt and close down the business, click [url="business_manage.php?p=bankrupt"]here[/url] to complete proceedings.'; } else { echo ' <table width="300"> <tr> <td> [b]Manage business:[/b] [url="business_manage.php?p=new_name"]Edit business name[/url] [url="business_manage.php?p=new_banner"]Change banner[/url] [url="business_manage.php?p=credit_member"]Credit cash to member[/url] [url="business_manage.php?p=view_apps"]Manage applications[/url] [url="business_manage.php?p=new_rank"]Edit member rank[/url] [url="business_manage.php?p=new_salary"]Edit member salary[/url] [url="business_manage.php?p=kick_out"]Kick member out[/url] [url="business_manage.php?p=view_vault"]View the vault[/url] [url="business_manage.php?p=bankrupt"]Bankrupt the business[/url] </td> </tr> </table>'; } } function new_business_name() { global $ir, $inf; if(!$_POST['name']) { echo '<form action="business_manage.php?p=new_name" method="post"> <p align="center"> [b]You are changing the business name of the '.stripslashes($inf['busName']).' business.[/b] Please enter a new name in the input box below and click \'Change name\' to submit the new name. <input type="text" name="name" /> <input type="submit" value="Change name" /> </p> </form>'; } else { $check = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busName` = '%s')", mysql_real_escape_string($_POST['name']))); if(!mysql_num_rows($check)) { mysql_query(sprintf("UPDATE `businesses` SET `busName` = '%s' WHERE `busId` = '%u'", stripslashes($_POST['name']), $inf['busId'])); echo 'The business name was changed to '.stripslashes($_POST['name']).'!'; business_alert($inf['busId'], "The business name was changed to ".stripslashes($_POST['name'])."."); } else { echo 'This business name is in use at this time.'; } } } function new_business_banner() { global $ir, $inf; if(!$_POST['banner']) { echo '<form action="business_manage.php?p=new_banner" method="post"> <p align="center"> [b]You are changing the banner of the '.stripslashes($inf['busName']).' business.[/b] Please enter a new banner image location in the input box below and click \'Change banner\' to submit the new image. [b]Current image:[/b] '; if($inf['busImage']) { echo '[img='.stripslashes($inf['busImage']).']'; } else { echo 'This business has no banner at this time.'; } echo ' New image: <input type="text" name="banner" size="50" /> <input type="submit" value="Change banner" /> </p> </form>'; } else { mysql_query(sprintf("UPDATE `businesses` SET `busImage` = '%s' WHERE `busId` = '%u'", stripslashes($_POST['banner']), $inf['busId'])); echo 'The business banner was updated.'; business_alert($inf['busId'], "The business banner has been updated."); } } function edit_member_rank() { global $ir, $inf; if(!$_POST['member'] || !$_POST['rank']) { echo '<form action="business_manage.php?p=new_rank" method="post"> <p align="center"> [b]Set the business rank:[/b] Business member: <select name="member"> <option value="0">None</option>'; $select_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) WHERE (`bmembBusiness` = '%u') ORDER BY `bmembId` ASC", $inf['busId'])); while($sm = mysql_fetch_assoc($select_members)) { echo '<option value="'.$sm['userid'].'">'.stripslashes($sm['username']).'</option>'; } echo '</select> Business rank: <select name="rank"> <option value="0">None</option>'; $select_ranks = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE (`rankClass` = '%u') ORDER BY `rankId` ASC", $inf['classId'])); while($sr = mysql_fetch_assoc($select_ranks)) { echo '<option value="'.$sr['rankId'].'">'.stripslashes($sr['rankName']).' ($'.number_format($sr['rankCash']).')</option>'; } echo '</select> <input type="submit" value="Change rank" /></p> </form>'; } else { $select_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u') AND (`bmembBusiness` = '%u')", abs((int) $_POST['member']), $inf['busId'])); if(!mysql_num_rows($select_member)) { echo 'You cannot edit the rank of this member.'; } else { $select_cash = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE (`rankId` = '%u')", abs((int) $_POST['rank']))); $sc = mysql_fetch_assoc($select_cash); echo 'This member\'s rank was updated.'; mysql_query(sprintf("UPDATE `businesses_members` SET `bmembRank` = '%d', `bmembCash` = '%d' WHERE (`bmembMember` = '%u')", abs((int) $_POST['rank']), $sc['rankCash'], abs((int) $_POST['member']))); business_alert($inf['busId'], "Member ID ".abs((int) $_POST['member'])."\'s rank was changed."); } } } function edit_member_salary() { global $ir, $inf; if(!$_POST['member'] || !$_POST['salary']) { echo '<form action="business_manage.php?p=new_salary" method="post"> <p align="center"> [b]Set the new business salary:[/b] Business member: <select name="member"> <option value="0">None</option>'; $select_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) WHERE (`bmembBusiness` = '%u') ORDER BY `bmembId` ASC", $inf['busId'])); while($sm = mysql_fetch_assoc($select_members)) { echo '<option value="'.$sm['userid'].'">'.stripslashes($sm['username']).'</option>'; } echo '</select> Salary amount: <input type="text" name="salary" size="8" maxlength="6" /> <input type="submit" value="Change salary" /></p> </form>'; } else { $select_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u') AND (`bmembBusiness` = '%u')", abs((int) $_POST['member']), $inf['busId'])); if(!mysql_num_rows($select_member)) { echo 'You cannot edit the salary of this member.'; } else { echo 'This member\'s salary was updated to $'.number_format($_POST['salary']).'.'; mysql_query(sprintf("UPDATE `businesses_members` SET `bmembCash` = '%d' WHERE (`bmembMember` = '%u')", abs((int) $_POST['salary']), abs((int) $_POST['member']))); business_alert($inf['busId'], "Member ID ".abs((int) $_POST['member'])."\'s salary was changed to \$".number_format($_POST['salary'])."."); } } } function view_vault() { global $ir, $inf; echo '<form action="business_manage.php?p=donate_cash" method="post"> Your business has $'.number_format($inf['busCash']).' secured in it\'s vault. [b]Donate cash:[/b] Cash amount: <input type="text" name="cash" /> <input type="submit" value="Donate cash">'; } function sort_debt() { global $ir, $inf; if($_POST['cash'] > 0) { if($_POST['cash'] > $ir['money']) { echo 'You do not have enough cash to sort out that amount of debt.'; } else if($_POST['cash'] > $inf['busDebt']) { echo 'The business does not owe that much cash in debt.'; } else { mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", abs((int) $_POST['cash']), $ir['userid'])); mysql_query(sprintf("UPDATE `businesses` SET `busDebt` = `busDebt` - '%d' WHERE `busId` = '%u'", abs((int) $_POST['cash']), $inf['busId'])); echo 'You have cleared up $'.number_format($_POST['cash']).' of the business debt.'; business_alert($inf['busId'], "".$ir['username']." paid \$".number_format($_POST['cash'])." of the business debt."); } } else { echo '<form action="business_manage.php?p=debt" method="post"> Your business has $'.number_format($inf['busDebt']).' of debt. [b]Enter amount:[/b] Cash: <input type="text" name="cash" /> <input type="submit" value="Submit" /> </form>'; } } function donate_vault() { global $ir, $inf; if($_POST['cash'] > 0) { if($_POST['cash'] > $ir['money']) { echo 'You do not have enough cash to donate this much to the business.'; } else { mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", abs((int) $_POST['cash']), $ir['userid'])); mysql_query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` + '%d' WHERE `busId` = '%u'", abs((int) $_POST['cash']), $inf['busId'])); echo 'You have donated $'.number_format($_POST['cash']).' to the business.'; business_alert($inf['busId'], "".$ir['username']." donated \$".number_format($_POST['cash'])." to the business."); } } else { echo 'You missed one or more of the required fields.'; } } function kick_member() { global $ir, $inf; if(!isset($_POST['member'])) { echo 'Please select a member to kick out of the business: <form action="business_manage.php?p=kick_out" method="post"> Business member: <select name="member"> <option value="0">None</option>'; $select_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) WHERE (`bmembBusiness` = '%u') ORDER BY `bmembId` ASC", $inf['busId'])); while($sm = mysql_fetch_assoc($select_members)) { echo '<option value="'.$sm['userid'].'">'.stripslashes($sm['username']).'</option>'; } echo '</select> <input type="submit" value="Kick out" /> </form>'; } else { mysql_query(sprintf("DELETE FROM `businesses_members` WHERE `bmembMember` = '%u'", abs((int) $_POST['member']))); echo 'This member has been kicked out of the business.'; business_alert($inf['busId'], "Member ID ".$_POST['member']." was kicked out of the business."); } } function bankrupt_business() { global $ir, $inf; if(!$_GET['confirm']) { echo 'You are about to bankrupt the '.stripslashes($inf['busName']).' business. Please confirm this action. Once this has been confirmed there is no chance to go back. > [url="business_home.php?p=bankrupt&confirm=1"]Bankrupt the business[/url]'; } else { $send_event = mysql_query(sprintf("SELECT `bmembMember` FROM WHERE `bmembBusiness` = '%u' ORDER BY `bmembId` DESC", $bs['busId'])); while($se = mysql_fetch_assoc($send_event)) { $text = "The director has chosen to bankrupt the {$inf['busName']} business\, all members have been discharged."; insert_event($se['bmembMember'], $text); } mysql_query(sprintf("DELETE FROM `businesses_members` WHERE (`bmembBusiness` = '%u')", $inf['busId'])); mysql_query(sprintf("DELETE FROM `businesses` WHERE (`busId` = '%u')", $inf['busId'])); echo 'You have decided to bankrupt the business, all members have been fired.'; } } function credit_member() { global $ir, $inf; if($_POST['cash'] AND $_POST['member']) { if($_POST['cash'] > $inf['busCash']) { echo 'You cannot credit more than the business has in it\'s vault.'; } else { mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", abs((int) $_POST['cash']), abs((int) $_POST['member']))); mysql_query(sprintf("UPDATE `businesses` SET `busCash` = `busCash` - '%d' WHERE `busId` = '%u'", abs((int) $_POST['cash']), $inf['busId'])); echo 'You gave $'.number_format($_POST['cash']).' to this member from the vault.'; business_alert($inf['busId'], "Member ID ".$_POST['member']." was credited \$".number_format($_POST['cash'])." from the business."); } } else { echo '<form action="business_manage.php?p=credit_member" method="post"> <p align="center"> Your business vault contains $'.number_format($inf['busCash']).' at this time, which can be credited to a member. Select a member from the box below and enter an amount of cash to give to them. Cash amount: <input type="text" name="cash" /> Business member: <select name="member"> <option value="0">None</option> <option value="'.$ir['memberId'].'">'.stripslashes($ir['memberName']).'</option>'; $select_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) WHERE (`bmembBusiness` = '%u') ORDER BY `bmembId` ASC", $inf['busId'])); while($sm = mysql_fetch_assoc($select_members)) { echo '<option value="'.$sm['userid'].'">'.stripslashes($sm['username']).'</option>'; } echo '</select> <input type="submit" value="Credit cash" /> </p> </form>'; } } function manage_applications() { global $ir, $inf; if(!isset($_GET['a'])) { $fetch_apps = mysql_query(sprintf("SELECT * FROM `businesses_apps` LEFT JOIN `users` ON `userid` = `appMember` WHERE `appBusiness` = '%u'", $inf['busId'])); echo '<table width="600" class="table"> <tr> <th width="15%">Member</th> <th width="50%">Application</th> <th width="15%">Time</th> <th width="20%">Manage</th> </tr>'; while($r = mysql_fetch_assoc($fetch_apps)) { echo ' <tr> <td>[url="viewuser.php?u='.$r['userid'].'"]'.stripslashes($r['username']).'[/url]</td> <td>'.stripslashes($r['appText']).'</td> <td>'.date('d-m-Y, g:i:s A', $r['appTime']).'</td> <td>[url="business_manage.php?p=view_apps&a=accept&id='.$r['appId'].'"][size="1"]Accept[/size][/url] [size="1"]-[/size] [url="business_manage.php?p=view_apps&a=decline&id='.$r['appId'].'"][size="1"]Decline[/size][/url]</td> </tr>'; } echo '</table>'; } else if($_GET['a'] == 'accept' AND $_GET['id']) { $fetch_app = mysql_query(sprintf("SELECT * FROM `businesses_apps` LEFT JOIN `users` ON `userid` = `appMember` WHERE `appId` = '%u'", abs((int) $_GET['id']))); if(mysql_num_rows($fetch_app)) { $it = mysql_fetch_assoc($fetch_app); $check = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $it['appMember'])); if(!mysql_num_rows($check)) { $rows = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembBusiness` = '%u')", $inf['busId'])); if(mysql_num_rows($rows) < $inf['classMembers']) { $fetch_rank = mysql_query(sprintf("SELECT * FROM `businesses_ranks` WHERE (`rankClass` = '%u') ORDER BY `rankCash` ASC LIMIT 1", $inf['classId'])); $fr = mysql_fetch_assoc($fetch_rank); business_alert($inf['busId'], "Member ID ".$it['appMember']." has been accepted into the business."); mysql_query(sprintf("INSERT INTO `businesses_members` (`bmembId`, `bmembMember`, `bmembBusiness`, `bmembCash`, `bmembRank`) VALUES ('NULL', '%u', '%d', '%d', '%d')", $it['appMember'], $inf['busId'], $fr['rankCash'], $fr['rankId'])); mysql_query(sprintf("DELETE FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); echo 'The selected application has been accepted.'; } else { echo 'Your business cannot hold more members at this time.'; } } else { echo 'This member is part of a business at this time, the application could not be accepted.'; mysql_query(sprintf("DELETE FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); } } else { echo 'The selected application no longer exists.'; } } else if($_GET['a'] == 'decline' AND $_GET['id']) { $fetch_app = mysql_query(sprintf("SELECT * FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); if(mysql_num_rows($fetch_app)) { echo 'The selected application was declined, It has been removed from the log.'; mysql_query(sprintf("DELETE FROM `businesses_apps` WHERE `appId` = '%u'", abs((int) $_GET['id']))); } else { echo 'The selected application no longer exists.'; } } else { echo 'You did not select an application to manage, go back and select one!'; } } $h->endpage(); ?>   Still more...
  12. Re: Businesses Mod [Mccode V2] Make business_create.php <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Create business</p>'; if($_POST['name'] AND $_POST['class']) { $fetch_class = mysql_query(sprintf("SELECT * FROM `businesses_classes` WHERE (`classId` = '%u')", abs((int) $_POST['class']))); $check = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busDirector` = '%u')", $ir['userid'])); $check_member = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); if(!mysql_num_rows($fetch_class)) { echo 'You cannot start a business in a class that doesn\'t exist.'; } else { $r = mysql_fetch_assoc($fetch_class); if($ir['level'] < 10) { echo 'You must be at least Level 10 to begin a business.'; } else if($ir['money'] < $r['classCost']) { echo 'You cannot afford to start a business of this class right now.'; } else if(mysql_num_rows($check) || mysql_num_rows($check_member)) { echo 'You are part of a business at this time, leave to start a new one.'; } else { mysql_query(sprintf("INSERT INTO `businesses` (`busId`, `busName`, `busClass`, `busDirector`) VALUES ('NULL','%s', '%d', '%u')", stripslashes($_POST['name']), abs((int) $_POST['class']), $ir['userid'])); mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", $r['classCost'], $ir['userid'])); echo 'The '.$_POST['name'].' business was created.'; } } } else { echo '<form action="business_create.php" method="post"> <p align="center"> [b]Create a new business:[/b] Please enter a name for the new business below, then select a class. Business name: <input type="text" name="name" /> Business class: <select name="class"> <option value="0">None</option>'; $select_classes = mysql_query("SELECT * FROM `businesses_classes` ORDER BY `className` ASC"); while($c = mysql_fetch_assoc($select_classes)) { echo '<option value="'.$c['classId'].'">'.stripslashes($c['className']).' ($'.number_format($c['classCost']).')</option>'; } echo '</select> <input type="submit" value="Create business" /></p> </form>'; } $h->endpage(); ?>   Then make business_home.php <?php include_once (DIRNAME(__FILE__). '/globals.php'); echo '<p class="heading">Manage business</p>'; $check = mysql_query(sprintf("SELECT * FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); $check_two = mysql_query(sprintf("SELECT * FROM `businesses` WHERE (`busDirector` = '%u')", $ir['userid'])); if(!mysql_num_rows($check_two) AND !mysql_num_rows($check)) { echo 'You are not a member of a business right now, come back another time.'; $h->endpage(); exit; } else { $r = mysql_fetch_assoc($check); $b = mysql_fetch_assoc($check_two); $fetch_business = mysql_query(sprintf("SELECT * FROM `businesses` LEFT JOIN `businesses_classes` ON (`classId` = `busClass`) WHERE (`busId` = '%u') OR (`busId` = '%u')", $r['bmembBusiness'], $b['busId'])); if(!mysql_num_rows($fetch_business)) { echo 'This business does not exist at this time, please come back later.'; $h->endpage(); exit; } else { $inf = mysql_fetch_assoc($fetch_business); } } switch ($_GET['p']) { case 'leave_business': leave_business(); break; case 'view_members': view_members(); break; default: business_index(); break; } function business_index() { global $ir, $inf; echo '[b]'.stripslashes($inf['busName']).' options:[/b] '; if($inf['busDirector'] == $ir['userid']) { echo '[url="business_manage.php"]Manage business[/url] '; } else { echo '[url="business_home.php?p=leave_business"]Leave the business[/url] '; } echo '[url="business_home.php?p=view_members"]View members[/url] <table width="600" class="table"> <tr> <th>#</th> <th>Alert text</th> <th>Time</th> </tr>'; $business_alerts = mysql_query(sprintf("SELECT * FROM `businesses_alerts` WHERE `alertBusiness` = '%u' ORDER BY `alertTime` DESC", $inf['busId'])); while($ba = mysql_fetch_assoc($business_alerts)) { echo ' <tr> <td width="5%">'.$ba['alertId'].'</td> <td width="65%">'.stripslashes($ba['alertText']).'</td> <td width="30%">'.date('d-m-Y, g:i:s A', $ba['alertTime']).'</td> </tr>'; } echo '</table>'; } function leave_business() { global $ir, $inf; if($inf['busDirector'] != $ir['userid']) { if(!$_GET['confirm']) { echo 'You are about to leave the '.$inf['busName'].' business. Please confirm this action. > [url="business_home.php?p=leave_business&confirm=1"]Leave the business[/url]'; } else { mysql_query(sprintf("DELETE FROM `businesses_members` WHERE (`bmembMember` = '%u')", $ir['userid'])); echo 'You have decided to leave the business.'; } } else { echo 'You cannot leave the business while still the director.'; } } function view_members() { global $ir, $inf; echo '<table width="600" class="table"> <tr> <th width="50%">Member name</th> <th width="50%">Job rank</th> </tr>'; $fetch_members = mysql_query(sprintf("SELECT * FROM `businesses_members` LEFT JOIN `users` ON (`userid` = `bmembMember`) LEFT JOIN `businesses_ranks` ON (`rankId` = `bmembRank`) WHERE `bmembBusiness` = '%u'", $inf['busId'])); while($fm = mysql_fetch_assoc($fetch_members)) { echo ' <tr> <td>[url="viewuser.php?u='.$fm['userid'].'"]'.stripslashes($fm['username']).'[/url] ['.$fm['userid'].']</td> <td>'.stripslashes($fm['rankName']).' ($'.number_format($fm['bmembCash']).')</td> </tr>'; } echo '</table>'; } $h->endpage(); ?>
  13. Ok, first of all, I spent alot of time on this, It is kinda basic, but works well I think. Had to be converted so might have a few bugs, let me know if there are some. This will take More than one page, so dont post until it is all here. Run SQL: CREATE TABLE IF NOT EXISTS `businesses` ( `busId` int(11) NOT NULL AUTO_INCREMENT, `busName` varchar(255) NOT NULL, `busClass` int(11) NOT NULL, `busDirector` int(11) NOT NULL, `busProfit` bigint(25) NOT NULL, `busYProfit` bigint(25) NOT NULL, `busCust` int(11) NOT NULL, `busYCust` int(11) NOT NULL, `busCash` int(11) NOT NULL, `busDebt` int(11) NOT NULL, `busImage` varchar(255) NOT NULL, PRIMARY KEY (`busId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `businesses_alerts` ( `alertId` int(11) NOT NULL AUTO_INCREMENT, `alertBusiness` int(11) NOT NULL DEFAULT '0', `alertTime` int(11) NOT NULL DEFAULT '0', `alertText` text NOT NULL, PRIMARY KEY (`alertId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `businesses_apps` ( `appId` int(11) NOT NULL AUTO_INCREMENT, `appMember` int(11) NOT NULL, `appBusiness` int(11) NOT NULL, `appText` text NOT NULL, `appTime` int(11) NOT NULL, PRIMARY KEY (`appId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `businesses_classes` ( `classId` int(11) NOT NULL AUTO_INCREMENT, `className` varchar(255) NOT NULL, `classDesc` text NOT NULL, `classMembers` int(11) NOT NULL, `classCost` int(11) NOT NULL, PRIMARY KEY (`classId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; INSERT INTO `businesses_classes` (`classId`, `className`, `classDesc`, `classMembers`, `classCost`) VALUES (1, 'Fireworks stand', 'Our customers will explode in delight with our fireworks. Great for holidays or any special event.', 4, 500000), (2, 'Hair salon', 'A hair salon is a place where one goes to get their hair cut, as well as styled, highlighted or coloured.', 4, 750000), (3, 'Law firm', 'A law firm is a business entity formed by one or more lawyers to engage in the practice of law. The money made is determined by the work hours the company sells. The amount of employees will increase this, aswell as the hired lawyers stats.', 6, 4000000), (4, 'Flower shop', 'A store where flowers are purchased.', 4, 100000), (5, 'Car dealership', 'Our customers need transportation. Sell them our best and send them on their way.', 8, 6000000); CREATE TABLE IF NOT EXISTS `businesses_members` ( `bmembId` int(11) NOT NULL AUTO_INCREMENT, `bmembMember` int(11) NOT NULL, `bmembBusiness` int(11) NOT NULL DEFAULT '0', `bmembCash` int(11) NOT NULL, `bmembRank` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`bmembId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `businesses_ranks` ( `rankId` int(11) NOT NULL AUTO_INCREMENT, `rankName` varchar(255) NOT NULL, `rankClass` int(11) NOT NULL, `rankCash` int(11) NOT NULL, `rankPrim` enum('labour','intel','strength') NOT NULL, `rankSec` enum('labour','intel','strength') NOT NULL, `rankPGain` decimal(11,2) NOT NULL, `rankSGain` decimal(11,2) NOT NULL, PRIMARY KEY (`rankId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ; INSERT INTO `businesses_ranks` (`rankId`, `rankName`, `rankClass`, `rankCash`, `rankPrim`, `rankSec`, `rankPGain`, `rankSGain`) VALUES (1, 'Sales person', 1, 1000, 'intel', 'labour', '30.50', '15.25'), (2, 'Product manager', 1, 2500, 'labour', 'strength', '20.00', '10.00'), (3, 'Cashier', 1, 5000, 'intel', 'strength', '25.00', '12.00'), (4, 'Stylist', 2, 800, 'intel', 'labour', '25.00', '12.50'), (5, 'Cleaner', 2, 1400, 'labour', 'strength', '20.00', '10.00'), (6, 'Shampooist', 2, 2100, 'intel', 'labour', '25.00', '12.50'), (7, 'Lawyer', 3, 1200, 'intel', 'labour', '40.00', '20.00'), (8, 'Cleaner', 3, 800, 'labour', 'strength', '20.00', '10.00'), (9, 'Receptionist', 3, 600, 'intel', 'labour', '30.00', '15.00'), (10, 'Florist', 4, 500, 'intel', 'labour', '25.00', '12.50'), (11, 'Cleaner', 4, 750, 'labour', 'strength', '20.00', '10.00'), (12, 'Salesman', 5, 3400, 'labour', 'intel', '30.00', '15.00'), (13, 'Cleaner', 5, 1400, 'labour', 'strength', '20.00', '10.00'), (14, 'Receptionist', 5, 900, 'intel', 'labour', '34.00', '17.00');   Add into global_func.php function business_alert($business, $text) { mysql_query(sprintf("INSERT INTO `businesses_alerts` (`alertId`, `alertBusiness`, `alertText`, `alertTime`) VALUES ('NULL', '%u', '%s', '%d')", $business, $text, time())); }   Next page...
  14. Re: [MCCODES V2] Updated Jail now lets users Offer rescue Price Very nice illusions :) +1
  15. Re: New Houses Mod [Mccodes V2] As far as I know all of them have been fixed, But with a big mod like this bugs can pop up anywhere, So hopefully they have all been taken care of
  16. Re: New Houses Mod [Mccodes V2]   Im not too sure about this, I've looked at the query, seems fine to me. And the upgrades work on the engine I am using, Does anyone else have this problem?
  17. Re: New Houses Mod [Mccodes V2] Oh, on the query replace houseId with hID
  18. Re: New Houses Mod [Mccodes V2] The profile page query has to be modified to fetch the house from owner_houses, Cant help much with that though, until I know what the query is. And in the move out function, make it set their will to 100 too, forgot that
  19. Re: New Houses Mod [Mccodes V2] Add a link to the house rentals section, Rented houses
  20. Re: New Houses Mod [Mccodes V2] Here, add this case: case 'rented': view_rentals(); break; Then add this function function view_rentals() { global $ir; $houses = mysql_query(sprintf("SELECT * FROM `owned_houses` LEFT JOIN `houses` ON (`houseId` = `uhouseHouse`) LEFT JOIN `users` ON (`userid` = `uhouseTenant`) WHERE `uhouseTenant` > '0' AND (`uhouseOwner` = '%u')", $ir['userid'])); echo '<table width="700" class="table"> <tr> <th width="45%">House name</th> <th width="25%">Tenant</th> <th width="15%">Income</th> <th width="15%">Nights left</th> </tr>'; while($r = mysql_fetch_assoc($houses)) { echo '<tr> <td>'.stripslashes($r['hNAME']).'</td> <td>[url="userprofile.php?id='.$r['userid'].'"]'.stripslashes($r['username']).'[/url]</td> <td>+ $'.number_format($r['uhouseRent']).' each night</td> <td>'.number_format($r['uhouseRTime']).' nights</td> </tr>'; } echo '</table>'; } Screenshot:
  21. Re: New Houses Mod [Mccodes V2] Fixed cron:   $houses = mysql_query(sprintf("SELECT * FROM `owned_houses` LEFT JOIN `users` ON (`userid` = `uhouseTenant`) WHERE `uhouseTenant` > '0'")); while ($r = mysql_fetch_array($houses)) { mysql_query("UPDATE `owned_houses` SET `uhouseRTime` = `uhouseRTime` - '1' WHERE `uhouseRTime` > '0'"); mysql_query(sprintf("UPDATE `users` SET `money` = `money` - '%d' WHERE `userid` = '%u'", $r['uhouseRent'], $r['uhouseTenant'])); mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE `userid` = '%u'", $r['uhouseRent'], $r['uhouseOwner'])); mysql_query("UPDATE `owned_houses` SET `uhouseTenant` = '0' WHERE `uhouseRTime` <= '0'"); }   in houses.php replace: mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE (`userid` = '%u')", $r['houseCost'], $ir['userid']));   with: mysql_query(sprintf("UPDATE `users` SET `money` = `money` + '%d' WHERE (`userid` = '%u')", $r['hPRICE'], $ir['userid']));   Thanks for pointing those out by the way _SaMz_,
  22. Re: New Houses Mod [Mccodes V2] I'll get right to them
  23. Re: Battle ladder [Mccodes V2] Wow, nice job illusions, Looks brilliant
  24. Re: Battle ladder [Mccodes V2] I dont mind at all :) Feel free to do anything with it
  25. Re: Battle ladder [Mccodes V2] Well, you could run this sql data if you wanted: INSERT INTO `battle_ladders` (`ladderId`, `ladderName`, `ladderLevel`) VALUES (1, 'Beginner league', 0), (2, 'Amateur league', 5), (3, 'Professional league', 10), (4, 'Master league', 15);   Would create 4 ladders
×
×
  • Create New...