-
Posts
244 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by Analog
-
if($enperc > 100) { $enperc = 100; }
-
LOL, and how is this different? Your taking multiple values storing in one db field, using explode to put them in an array, and checking against it... There is no difference!!!
-
I just have to laugh... Danny, wasn't you just telling me implode/explode was "the worst way to do it" and now you use it ;) Another method to do this would be create a separate table to store just the banned IP addresses and check against it.
-
Probably hitting the max value of the defined data type for the database field exp
-
Its inserting the item into the players inventory without first checking if the player already has that item. item_add function from global_func.php function item_add($user, $itemid, $qty, $notid=0) { global $db; if($notid > 0) { $q=$db->query("SELECT * FROM inventory WHERE inv_userid={$user} and inv_itemid={$itemid} AND inv_id != {$notid}"); } else { $q=$db->query("SELECT * FROM inventory WHERE inv_userid={$user} and inv_itemid={$itemid}"); } if($db->num_rows($q) > 0) { $r=$db->fetch_row($q); $db->query("UPDATE inventory SET inv_qty=inv_qty+{$qty} WHERE inv_id={$r['inv_id']}"); } else { $db->query("INSERT INTO inventory (inv_itemid, inv_userid, inv_qty) VALUES ({$itemid}, {$user}, {$qty})"); } }
-
the problem is not in your inventory... Check the file for your searching streets feature and see if it use the function item_add when giving the item
-
if(!$ir['gang'] && $ir['jail']) { print "<tr><td>[url='yourgang.php']Your Gang[/url]</td></tr>"; } else { print "<tr><td>[url='jail.php']Jail ($jc)[/url]</td></tr>"; } change to if($ir['gang'] ) { print "<tr><td>[url='yourgang.php']Your Gang[/url]</td></tr>"; }
-
What about support for the mods? Not sure about everyone else, but I like to keep issue involving a mod within the original posting for the mod. Are you going to link to the original postings of them or provide an area for the creators to offer support...
-
if(!ir['ddays']) { mysql_query("UPDATE `users` SET `color_filed` = 'defaultcolor' WHERE `userid` = $userid"); } Untested, will need to change variable/table/fields accordingly Just the general idea to get you going...
-
In your sql you are only selecting current_page however, later in the function you are trying to call the userid field, which you didn't select in the query. $paddy=$db->query("SELECT `current_page`, `userid` FROM users_table WHERE user_id=$user_id LIMIT 5"); $ass=$db->fetch_row($paddy);
-
Nice Work.. 10x better than I could ever do..
-
Welcome to MWG Manworm!
-
New/Modification of ingame stats/pooled stats
Analog replied to Roh's topic in Requests & In Production
Your problem is that you are missing what us.vitality is greater than.. [mysql]WHERE us.vitality > ?[/mysql] -
if (!isset($_REQUEST['name']) or strlen($_REQUEST['name']) < 1 or !$gvars->check_gang_name_allowable_special_characters($_REQUEST['name']) or !ctype_alpha(substr($_REQUEST['name'], 0, 1))) { $name = $ir['username'] . "'s " . $gvars->name_su; } else { $name = $_REQUEST['name']; } $_REQUEST['name'] is the variable that is being checked by the if statement, then the $name variable is set.
-
Well, I haven't released anything lately so here is a little mod for you all.... This is an add on for the gang system that was created by Floydian. You may find the gang system: General Info Gang president can open shop at a cost of $15,000, this allows up 25 slots for items Additional slots can be purchase for $2,500 (this buys another 25 slots) President can set the prices in which gang members can purchase items for. Items set at a price of $0 can not be purchased, only given away. Run this SQL: ALTER TABLE `gangs` ADD `gangSHOP` INT( 11 ) NOT NULL DEFAULT '0' CREATE TABLE IF NOT EXISTS `gang_shop` ( `gs_id` int(11) NOT NULL AUTO_INCREMENT, `gs_gang` int(11) NOT NULL, `gs_item` int(11) NOT NULL, `gs_cost` bigint(20) NOT NULL, `gs_qty` int(11) NOT NULL, PRIMARY KEY (`gs_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Copy below code and save as gang_shop.php, upload to gangs/plugins/private/ <?php /** * @name gang_shop.php * @author TwiztedFake * @version 1.0.0 * @copyright All rights reserved by TwiztedFake 2010 * All rights reserved. No piracy is permitted. Use this file at your own risk. * There is no warrenty, and the author assumes no liability. */ if (!defined('GANG_MODULE')) { return; } $gvars->links_mygang += array( 'gs_home' => array( 'label' => 'Shop', 'order' => 9 ), ); $gvars->actions += array( 'sgang_shop_settings' => 'sgang_shop_settings', 'sgang_shop_open' => 'sgang_shop_open', 'sgang_shop_item_give' => 'sgang_shop_item_give', 'sgang_shop_item_update' => 'sgang_shop_item_update', 'sgang_shop_upgrade' => 'sgang_shop_upgrade', 'sgang_shop_item_remove' => 'sgang_shop_item_remove', 'gs_item_purchase' => 'gs_item_purchase', 'gs_home' => 'gs_home', 'gs_shop_donate' => 'gs_shop_donate', 'gs_shop_donate_go' => 'gs_shop_donate_go', ); $gvars->links_staff += array( 'sgang_shop_settings' => array( 'label' => 'Shop Managment', 'order' => 12 ), ); function sgang_shop_item_remove() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php'); return; } $itm = abs($_POST['itm']); $q = mysql_query("SELECT g.*, i.itmname FROM gang_shop g LEFT JOIN items i ON g.gs_item = i.itmid WHERE g.gs_id = $itm AND g.gs_gang = {$gvars->data['gangID']}"); if(!mysql_num_rows($q)) { print "<h3>Inventory item not found.</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } $info = mysql_fetch_array($q); $itname = stripslashes($info['itmname']); if($info['gs_qty']) { print "<h3>You can only remove an inventory listings if there is 0 quanity listed</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } mysql_query("DELETE FROM gang_shop WHERE gs_gang = {$gvars->data['gangID']} AND gs_id = $itm AND gs_qty = 0"); print "<h3>Listing removed..</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } function sgang_shop_item_give() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php'); return; } $itm = abs($_POST['itm']); $q = mysql_query("SELECT g.*, i.itmname FROM gang_shop g LEFT JOIN items i ON g.gs_item = i.itmid WHERE g.gs_id = $itm AND g.gs_gang = {$gvars->data['gangID']}"); if(!mysql_num_rows($q)) { print "<h3>Inventory not found.</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } $info = mysql_fetch_array($q); $itname = stripslashes($info['itmname']); if($_POST['qty']) { $qty = abs($_POST['qty']); $who = abs($_POST['who']); if($qty > $info['gs_qty']) { print "<h3>You can not give out more than the shop inventory.</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } if(!$who) { print "<h3>You didn't select a gang member.</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } shop_staff_item($gvars->data['gangID'],$info['gs_item'],$qty,$who,$itname); gang_go_back('yourgang.php'); return; } $q_get = sprintf('select u.userid, u.username from users as u where u.gang = %d order by u.username', $gvars->ir['gang']); $q_get = mysql_query($q_get); $member_list = ''; while (list($them_id, $them_name) = mysql_fetch_row($q_get)) { $member_list .= <<<EOT <option value="$them_id">$them_name</option>\n EOT; } print "<h2>Giving Item</h2> <form action='yourgang.php?action=sgang_shop_item_give' method='post'> <input type='hidden' name='itm' value='{$info['gs_id']}' /> <table style='cwstyle' cellpadding='4' cellspacing='2'> <tr> <th colspan='2' class='cwstyle'>$itname</th> </tr> <tr> <th>Qty In stock</th> <th class='cwstyle'>{$info['gs_qty']}</th> </tr> <tr> <th>Qty to give</th> <th class='cwstyle'><input type='text' name='qty' /></th> </tr> <tr> <th>Give to</th> <th class='cwstyle'> <select name='who'> <option value='0'>Select one...</option> $member_list </select> </th> </tr> <tr> <th colspan='2' class='cwstyle'> <input type='submit' value='Give Item' /> </th> </tr> </table> </form>"; } function sgang_shop_item_update() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php'); return; } $itm = abs($_POST['itm']); $q = mysql_query("SELECT g.*, i.itmname FROM gang_shop g LEFT JOIN items i ON g.gs_item = i.itmid WHERE g.gs_id = $itm AND g.gs_gang = {$gvars->data['gangID']}"); if(!mysql_num_rows($q)) { print "<h3>Inventory not found.</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } if($_POST['update'] == "yes") { $cost = abs($_POST['cost']); mysql_query("UPDATE gang_shop SET gs_cost = $cost WHERE gs_id = $itm and gs_gang = {$gvars->data['gangID']}"); print "<h2>Inventory Updated!</h2>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } $info = mysql_fetch_array($q); $itname = stripslashes($info['itmname']); print "<h2>Update Shop Item</h2> <table class='cwstyle' cellpadding='4' cellspacing='2'> <tr> <th>Item Name</th> <th class='cwstyle'>$itname</th> </tr> <tr> <th>Quanity</th> <th class='cwstyle'>{$info['gs_qty']}</th> </tr> <tr> <th>Price</th> <th class='cwstyle'>".money_formatter($info['gs_cost'])."</th> </tr> </table> <form action='yourgang.php?action=sgang_shop_item_update' method='post'> Set New Price <input type='hidden' name='itm' value='{$info['gs_id']}' /> <input type='hidden' name='update' value='yes' /> <input type='text' name='cost' /> <input type='submit' value='Update' /> </form>"; } function sgang_shop_upgrade() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php'); return; } if(!$gvars->data['gangSHOP']) { print "<h4>[b]Your gang has yet to open a shop[/b]</h4> <form action='yourgang.php?action=sgang_shop_open' method='post'> <input type='submit' value='Open Shop' /></form>"; return; } if($_POST['open'] == "yes") { $es = abs($_POST['extra']); $cost = $es * 2500; $es = $es * 25; if($cost > $gvars->data['gangMONEY']) { print "<h4>[b]Your gang doesn't have enough money in its vault to upgrade its shop.[/b]<h4>"; gang_go_back('yourgang.php'); return; } mysql_query("UPDATE gangs SET gangMONEY = gangMONEY - $cost, gangSHOP = gangSHOP + $es WHERE gangID = {$gvars->data['gangID']}"); $es2 = $gvars->data['gangSHOP'] + $es; print "<h2>Gang Shop</h2> You have upgraded the gangs shop at a cost of ".money_formatter($cost)." You added $es spaces to the shop. The shop can now hold upto $es2 items. [url='yourgang.php?action=sgang_shop_settings'][b]Return to Shop Settings[/b][/url]"; } else { print "<h2>Gang Shop Upgrade</h2> Additional spaces may be purchased in sets of 25 at a cost of $2,500.</p> <form action='yourgang.php?action=sgang_shop_upgrade' method='post'> <input type='hidden' name='open' value='yes' /> Extra Spaces: <input type='text' name='extra' /> <input type='submit' value='Upgrade Shop' /> </form>"; } } function sgang_shop_settings() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php'); return; } print "<h2>Gang Shop Management</h2>"; if(!$gvars->data['gangSHOP']) { print "[b]Your gang has yet to open a shop[/b] <form action='yourgang.php?action=sgang_shop_open' method='post'> <input type='submit' value='Open Shop' /></form>"; return; } $q = mysql_query("SELECT gs_qty FROM gang_shop WHERE gs_gang = {$gvars->data['gangID']}"); $SpaceUsed = 0; while($z = mysql_fetch_array($q)) { $SpaceUsed += $z['gs_qty']; } $GiveButton = "<form action='yourgang.php?action=sgang_shop_item_give' method='post'> <input type='hidden' name='itm' value='%4\$d' /> <input type='submit' value='Give' /></form>"; $UpdateButton = "<form action='yourgang.php?action=sgang_shop_item_update' method='post'> <input type='hidden' name='itm' value='%4\$d' /> <input type='submit' value='Update' /></form>"; $RemoveButton = "<form action='yourgang.php?action=sgang_shop_item_remove' method='post'> <input type='hidden' name='itm' value='%4\$d' /> <input type='submit' value='Remove' /></form>"; $itout = "<tr><td>%s</td><td>%d</td><td>%s</td><td style='text-align:center;'>$GiveButton</td><td style='text-align:center;'>$UpdateButton</td><td style='text-align:center;'>$RemoveButton</td></tr>"; $q = mysql_query("SELECT gs.*, i.itmname FROM gang_shop gs LEFT JOIN items i ON gs.gs_item = i.itmid WHERE gs_gang = {$gvars->data['gangID']}"); while($z = mysql_fetch_array($q)) { $itnm = stripslashes($z['itmname']); $itcost = money_formatter($z['gs_cost']); $itlist .= sprintf($itout,$itnm,$z['gs_qty'],$itcost,$z['gs_id']); } print "<table class='cwstyle' cellspacing='2' cellpadding='2' width='200'> <tr> <th width='150'>Shop Size</th> <th width='50' class='cwstyle'>{$gvars->data['gangSHOP']}</th> </tr> <tr> <th width='150'>Total Space Used</th> <th width='50' class='cwstyle'>$SpaceUsed</th> </tr> </table> <form action='yourgang.php?action=sgang_shop_upgrade' method='post'> <input type='submit' value='Upgrade Shop' /></form> <h2>Items In Shop</h2> <table class='cwstyle' cellspacing='2' width='600'> <tr> <th class='cwstyle'>Item</th> <th class='cwstyle'>Qty</th> <th class='cwstyle'>Cost</th> <th class='cwstyle' colspan='3'>Action</th> </tr> $itlist </table>"; } function sgang_shop_open() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php'); return; } if($_POST['open'] == "yes") { $es = abs($_POST['extra']); $cost = 15000 + ($es * 2500); $es = $es * 25 + 25; if($cost > $gvars->data['gangMONEY']) { print " [b]Your gang doesn't have enough money in its vault to open a shop.[/b]"; gang_go_back('yourgang.php'); return; } mysql_query("UPDATE gangs SET gangMONEY = gangMONEY - $cost, gangSHOP = gangSHOP + $es WHERE gangID = {$gvars->data['gangID']}"); print "<h2>Gang Shop</h2> You have opened the gangs shop at a cost of ".money_formatter($cost)." The shop can hold upto $es items."; } else { print "<h2>Gang Shop Open</h2> Opening a shop cost $15,000 for the basics. This gives your gangs shop space for 25 items. Additional spaces may be purchased in sets of 25 at a cost of $2,500.</p> <form action='yourgang.php?action=sgang_shop_open' method='post'> <input type='hidden' name='open' value='yes' /> Extra Spaces: <input type='text' name='extra' /> <input type='submit' value='Open Shop' /> </form>"; } } function gs_item_purchase() { global $gvars; $itm = abs($_POST['itm']); $q = mysql_query("SELECT g.*, i.itmname FROM gang_shop g LEFT JOIN items i ON g.gs_item = i.itmid WHERE g.gs_id = $itm AND g.gs_gang = {$gvars->data['gangID']}"); if(!mysql_num_rows($q)) { print "<h3>Inventory not found.</h3>"; gang_go_back('yourgang.php?action=sgang_shop_settings'); return; } $info = mysql_fetch_array($q); $itname = stripslashes($info['itmname']); if($_POST['qty']) { $qty = abs($_POST['qty']); if($qty > $info['gs_qty']) { print "<h4>Purchase amount exceeds inventory balance</h4>"; gang_go_back('yourgang.php?action=gs_home'); return; } $cost = $qty * $info['gs_cost']; if($cost > $gvars->ir['money']) { print "<h4>You don't have enough money for the purchase"; gang_go_back('yourgang.php?action=gs_home'); return; } shop_item_purchase($gvars->data['gangID'],$info['gs_item'],$qty,$gvars->userid,$itname,$cost); return; } //Display purchase form print "<h3>Purchasing from gang shop</h3> <form action='yourgang.php?action=gs_item_purchase' method='post'> <input type='hidden' name='buy' value='yes' /> <input type='hidden' name='itm' value='{$info['gs_id']}' /> <table class='cwstyle' cellpadding='4'> <tr> <th>Item</th> <th class='cwstyle'>$itname</th> </tr> <tr> <th>In Stock</th> <th class='cwstyle'>{$info['gs_qty']}</th> </tr> <tr> <th>Cost Each</th> <th class='cwstyle'>".money_formatter($info['gs_cost'])."</th> </tr> <tr> <th>Purchase</th> <th class='cwstyle'><input type='text' name='qty' /></th> </tr> <tr> <td colspan='2' style='text-align:center;'> <input type='submit' value='Purchase' /> </td> </tr> </table> </form>"; } function gs_shop_donate_go() { global $gvars; if(!$gvars->data['gangSHOP']) { print "Your gang has yet to open a shop"; gang_go_back('yourgang.php'); return; } //inv_id ... player inv id of item to donate //qty ... amount player wants to donate $inv = abs($_POST['inv_id']); $qty = abs($_POST['qty']); $q = mysql_query("SELECT gs_qty FROM gang_shop WHERE gs_gang = {$gvars->data['gangID']}"); $SpaceUsed = 0; while($z = mysql_fetch_array($q)) { $SpaceUsed += $z['gs_qty']; } if($SpaceUsed + $qty > $gvars->data['gangSHOP']) { print "<h3>Sorry, the gang shop inventory limit has been reached.</h3> <h4>The shop can hold {$gvars->data['gangSHOP']} items, it currently holds $SpaceUsed</h4> <h4>Shop must be upgraded to hold more items</h4>"; gang_go_back('yourgang.php'); return; } $q = mysql_query("SELECT iv.*, i.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid = i.itmid WHERE iv.inv_id = $inv AND iv.inv_userid = {$gvars->userid}"); if(!mysql_num_rows($q)) { print "<h3>Item not found in your inventory!</h3>"; //gang_go_back('yourgang.php?action=gs_shop_donate'); return; } $inv_info = mysql_fetch_array($q); if($qty > $inv_info['inv_qty']) { print "<h3>You don't own that many!</h3>"; //gang_go_back('yourgang.php?action=gs_shop_donate'); return; } //Take item from player item_remove($gvars->userid, $inv_info['inv_itemid'], $qty); //Give to gang $q = mysql_query("SELECT * FROM gang_shop WHERE gs_item = {$inv_info['inv_itemid']} AND gs_gang = {$gvars->data['gangID']}"); if(mysql_num_rows($q)) { $gi = mysql_fetch_array($q); mysql_query("UPDATE gang_shop SET gs_qty = gs_qty + $qty WHERE gs_id = {$gi['gs_id']}"); } else { mysql_query("INSERT INTO gang_shop VALUES ('',{$gvars->data['gangID']},{$inv_info['itmid']},0,$qty)"); } $in = stripslashes($inv_info['itmname']); //Add gang log $pn = $gvars->ir['username']; $text = "$pn donated $in x$qty to the gang."; gang_new_event($gvars->data['gangID'],$text,"ff"); print "<h3>You donated $in x$qty to your gang.</h3>"; } function gs_shop_donate() { global $gvars; print "<h2>Gang Shop</h2>"; if(!$gvars->data['gangSHOP']) { print "Your gang has yet to open a shop"; gang_go_back('yourgang.php'); return; } $inv = mysql_query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$gvars->userid} ORDER BY i.itmtype ASC, i.itmname ASC"); if (!mysql_num_rows($inv)) { print "<h2>You have no items!</h2>"; } //Show players item list $itout = "<tr> <td>%s</td> <td>%s</td> <td>%d</td> <td style='text-align:center;'> <form action='yourgang.php?action=gs_shop_donate_go' method='post'> <input type='hidden' name='inv_id' value='%d'> <input type='text' name='qty' size='5'/> <input type='submit' value='Donate' /> </form> </td> </tr>"; while($z = mysql_fetch_array($inv)) { $itnm = stripslashes($z['itmname']); $ittype = stripslashes($z['itmtypename']); $itlist .= sprintf($itout,$itnm,$ittype,$z['inv_qty'],$z['inv_id']); } print "<table class='cwstyle' width='600' cellpadding='2'> <tr> <th class='cwstyle'>Item</th> <th class='cwstyle'>Type</th> <th class='cwstyle'>Qty</th> <th class='cwstyle'>Action</th> </tr> $itlist </table>"; } function gs_home() { global $gvars; print "<h2>Gang Shop</h2> <form action='yourgang.php?action=gs_shop_donate' method='post'> <input type='submit' value='Donate Item' /></form> "; if(!$gvars->data['gangSHOP']) { print "Your gang has yet to open a shop"; gang_go_back('yourgang.php'); return; } $BuyButton = "<form action='yourgang.php?action=gs_item_purchase' method='post'> <input type='hidden' name='itm' value='%4\$d' /> <input type='submit' value='Purchase' /></form>"; $itout = "<tr><td>%s</td><td style='text-align:center;'>%d</td><td>%s</td><td style='text-align:center;'>$BuyButton</td></tr>"; $q = mysql_query("SELECT gs.*, i.itmname FROM gang_shop gs LEFT JOIN items i ON gs.gs_item = i.itmid WHERE gs_gang = {$gvars->data['gangID']} AND gs_cost > 0"); if(!mysql_num_rows($q)) { print "<h3>No inventory available</h3>"; return; } while($z = mysql_fetch_array($q)) { $itnm = stripslashes($z['itmname']); $itcost = money_formatter($z['gs_cost']); $itlist .= sprintf($itout,$itnm,$z['gs_qty'],$itcost,$z['gs_id']); } print "<table class='cwstyle' cellspacing='2' width='600'> <tr> <th class='cwstyle' colspan='4'>For Sale</th> </tr> <tr> <th class='cwstyle'>Item</th> <th class='cwstyle'>In Stock</th> <th class='cwstyle'>Cost</th> <th class='cwstyle'>Action</th> </tr> $itlist </table>"; $itout = "<tr><td>%s</td><td style='text-align:center;'>%d</td></tr>"; $itlist = ""; $q = mysql_query("SELECT gs.*, i.itmname FROM gang_shop gs LEFT JOIN items i ON gs.gs_item = i.itmid WHERE gs_gang = {$gvars->data['gangID']} AND gs_cost = 0"); while($z = mysql_fetch_array($q)) { $itnm = stripslashes($z['itmname']); $itcost = money_formatter($z['gs_cost']); $itlist .= sprintf($itout,$itnm,$z['gs_qty']); } print " <table class='cwstyle' cellspacing='2' width='250'> <tr> <th class='cwstyle' colspan='2'>Items In Storage</th> </tr> <tr> <th class='cwstyle'>Item</th> <th class='cwstyle'>In Stock</th> </tr> $itlist </table>"; } ######################################################### ### Below functions are just used to take care of item/money moving and logging of actions.. ### ######################################################### function shop_item_purchase($gang,$item,$qty,$who,$name,$price) { global $gvars; //Take item from gang shop mysql_query("UPDATE gang_shop SET gs_qty = gs_qty - $qty WHERE gs_gang = $gang AND gs_item = $item"); //Take money from player mysql_query("UPDATE users SET money = money - $price WHERE userid = $who"); //Give money to gang mysql_query("UPDATE gangs SET gangMONEY = gangMONEY + $price WHERE gangID = $gang"); //Give item to player item_add($who, $item, $qty); $price = money_formatter($price); //Add gang event $q = mysql_query("SELECT username FROM users WHERE userid = $who"); $wn = mysql_fetch_array($q); $pn = $wn['username']; $text = "$pn purchased $name x$qty from the gang for $price"; gang_new_event($gang,$text,"ff"); //Output for page print "<h4>You purchased $name x$qty from the gang shop for $price.</h4>"; } function shop_staff_item($gang,$item,$qty,$who,$name) { global $gvars; //Take from gang mysql_query("UPDATE gang_shop SET gs_qty = gs_qty - $qty WHERE gs_gang = $gang AND gs_item = $item"); //Give to player item_add($who, $item, $qty); //Add gang event $q = mysql_query("SELECT username FROM users WHERE userid = $who"); $wn = mysql_fetch_array($q); $pn = $wn['username']; $text = "$pn was given $name x$qty from the gang"; gang_new_event($gang,$text,"ff"); //Add player event $text = "You were given $name x$qty from your gang"; event_add($who,$text); //Output for page print "<h4>$pn was given $name x$qty.</h4>"; }
-
1. Does you host allow crons? 2. If so, verify that your cron_minute.php file does not contain any error 3. Setup your cron A cron file is just another ordinary file, with the exception that you host will run the file at specified intervals that you have setup using the crontab or shell.
-
Auto Mail + Username change add on ....
Analog replied to VitalEnd's topic in Requests & In Production
For MC v2, welcome mail $time = time(); $db->query("INSERT INTO mail VALUES ('',0,0,$i,$time,'mail subject here','mail text here')"); $db->query("UPDATE users SET new_mail=new_mail+1 WHERE userid=$i"); Add this after the insert query that adds the players information... Now, I'm not sure if this is what you need. As you have not stated which version of MC you are working with. -
I had a similar problem to this in the past.. It was due to the database being on 1 server and the files on another.. So when the laston field updated, it used unix timestamp for the database server, which was set at a different time than the file server.. I fixed it by changing the query that updated the laston field to use a time stamp from the file server instead.. in header.php.. $laston = time(); $db->query("UPDATE users SET laston='$laston',lastip='$IP' WHERE userid=$userid");
-
You would have had something to answer What if we could all go to another dimension?
-
My opinions... The menu area looks out of place. Almost as if it were taken from another layout.. The corners are square than the rest of the page elements along with the shadowing effect (white). I think the main content area would like better if it were all one color, or if the fade effect (top and bottom black area) more closely matched the rest of the area.
-
It could work.. Another method would be to only pass the username and email over to the game. On the game side a temporary pass word could be randomly generated and emailed to the user. Along with an in-game mail requesting that the user set a more secure password.
-
To fix it how you have it setup add this to your form (edit_item_form function) <input type='hidden' name='itmid' value='{$itemi['itmid']}' /> My suggestion would be not to delete the item, instead use an UPDATE query to modify the values of the data for the item... Example $db->query("UPDATE table SET field = 'field', text = 'text', num = 'num' WHERE itmid = 'itmid'");
-
Your not passing a variable of $_POST['itmid'] from your form to the query Is this to update an item? If so why are you deleting it, then adding a new item?
-
Nice work.. I like seeing the variables at the start of the file for configuration options.. "Thumbs Up"