Jump to content
MakeWebGames

Tyr

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by Tyr

  1. Tyr

    Energy?

    Yep   2 questions now are your crons in the public_html root directory   And where it says ?code= did you put the code it gave you ?
  2. Tyr

    Energy?

    But what crons do they allow? ^_- 1 minute, 5 minute etc. Basically setting up your cron you need the code it gave you on install and you need to use that cron code on your cron jobs. It's easier to use the advanced cron options
  3. Tyr

    Energy?

    What host are you using?
  4. Tyr

    Energy?

    If you are on a Free Host you need to check and make sure they allow cron Jobs. If they do not, all things that involve count jail count, hospital count, stat bars, etc Will not budge ^_^
  5. add this above ?> in cron_minute.php $bombboom = $db->query("SELECT inv.`inv_itemid`,i.`itmid`,m.`userid` FROM `inventory` inv LEFT JOIN `items` i ON inv.`inv_itemid`=i.`itmid` LEFT JOIN `users` m ON inv.`inv_userid`=m.`userid` WHERE inv.`inv_itemid`=3"); while($bomb=$db->fetch_row($bombboom)) { if($db->num_rows($bombboom)>=0) { $db->query("UPDATE `users` SET `timer`=`timer`+1 WHERE `userid`={$bomb['userid']}"); } } $splat = $db->query("SELECT `timer`,`userid` FROM `users` WHERE `timer` > 9"); while($boo=$db->fetch_row($splat)) { $db->query("UPDATE users SET hospital=10,new_events=new_events+1,timer=0 WHERE userid={$boo['userid']}"); $db->query("INSERT INTO `events` VALUES('',".$boo['userid'].",unix_timestamp(),0,'You did not de-fuse the bomb in time and you have been sent to the hospital after it went off!')"); $db->query("DELETE FROM `inventory` WHERE `inv_itemid`=3 AND `inv_userid`={$boo['userid']}"); }
  6. Ok so I had a bit of time to spare and saw this [mccode lite] Mod Idea In the requests section. Granted the request was for McLite and was done by Zeddicus but I wanted to make one for V2. So here it is (: Enjoy! Any problems let me know. sendbomb.php <?php /* This mod created Free for the Members of Mwg All rights have been reserved Property of Tyr Please Keep this tag */ require_once("globals.php"); $_GET['ID'] = isset($_GET['ID']) && is_numeric($_GET['ID']) ? abs((int) $_GET['ID']) : false; $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; switch($_GET['action']) { case "index":index();break; case 'diffuse': diffuse(); break; case 'bomb': bomb(); break; case 'bomby': bomby(); break; default:index();break; } function index () { global $ir,$h; echo "<table width='70%' class='table'><tr><th>Wire 1</th><th>Wire 2</th><th>Wire 3</th><th>Wire 4</th></tr> <tr><td>[url='sendbomb.php?action=diffuse&ID=1']<font color=blue>Blue Wire</font>[/url]</td> <td>[url='sendbomb.php?action=diffuse&ID=2']<font color=green>Green Wire</font>[/url]</td> <td><a href='sendbomb.php?action=diffuse&ID=3'><font color=red>Red Wire</font></td> <td><a href='sendbomb.php?action=diffuse&ID=4'><font color=black>Black Wire</font></td> </tr><table>"; } function bomb() { global $ir,$h,$db; if(isset($_POST['bomb'])) { echo "You successfully Planted the bomb on ".$bomb['username']." [url='index.php'][b]Home[/b][/url]"; item_add($_GET['ID'], 3, 1); $kapow = sprintf("UPDATE `users` SET `bombattempts`=`bombattempts`-1 WHERE `userid`=%u", $ir['userid']); $db->query($kapow); } else { if(!$_GET['ID']) { echo "Invalid user ID selected. [url='index.php']Back[/url]"; $h->endpage(); exit; } $query1 = sprintf("SELECT m.`userid`,m.`user_level`,m.`username`,m.`gang`,m.`hospital`,m.`jail`,g.`gangID` FROM `users` m LEFT JOIN `gangs` g ON m.`gang`=g.`gangID` WHERE (`userid`=%u)", $_GET['ID']); $query2 = $db->query($query1); if(!$db->num_rows($query2)) { echo "The ID you have chosen does not exist"; $h->endpage(); exit; } $bomb = $db->fetch_row($query2); if($bomb['hospital'] > 0 || $bomb['jail'] > 0) { echo "You can not select to bomb a user who is in the hospital. [url='index.php'][b]Home[/b][/url]"; $h->endpage(); exit; } if($bomb['userid'] == $ir['userid']) { echo "Now why in the world would you attempt to blow up yourself? Working for Al-Quaida are we?"; $h->endpage(); exit; } elseif($bomb['user_level'] > 1) { echo "You are not permitted to bomb staff members!"; $h->endpage(); exit; } elseif($bomb['gang'] == $ir['gang']) { echo "You cannot bomb a member of your own clan!"; $h->endpage(); exit; } elseif($ir['bombattempts'] == 0) { echo "You do not have the capabilities to bomb another user."; //The amount of bombs a user can send. $h->endpage(); exit; } else { echo "<center>[b]<h2>Bomb User</h2>[/b]</center> <center> <form act='sendbomb.php?act=bomb' method='post'> <input type='hidden' name='bomb' value='bomb' /> You Are about to Bomb ".stripslashes($bomb['username']).", Are You Sure You Want To Continue?? <input type='submit' value='Yes!' />"; } } } function diffuse() { global $db,$ir,$h; $boom = sprintf("SELECT inv.`inv_itemid`,inv.`inv_userid`,i.`itmid`,m.`userid` FROM `inventory` inv LEFT JOIN `items` i ON inv.`inv_itemid`=i.`itmid` LEFT JOIN `users` m ON m.`userid`=inv.`inv_userid` WHERE (m.`userid`=%u)", $ir['userid']); $bomb = $db->query($boom); if(!$db->num_rows($bomb)) { echo "You do not have a bomb attached to you currently. Why try and blow yourself up? [url='index.php'][b]Home[/b][/url]"; $h->endpage(); exit; } if (!in_array($_GET['ID'], array(1, 2, 3, 4))) { echo "You did not select a Valid Wire! Go back and try again! [url='sendbomb.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $rand = rand(1,4); if($_GET['ID'] === 1 AND $rand != 1) { echo "While attempting to diffuse the bomb, you decide to snip the <font color=blue>blue</font> wire. Fatal mistake, it sends you howling to the hospital lucky to escape with your life! <a href='hospital.php'>[b]Hospital[/b]"; $bombquery = sprintf("UPDATE `users` SET `hospital`=20,`hospreason`='Failed Diffusion',`new_events`=`new_events`+1,`timer`=0 WHERE `userid`=%u", $ir['userid']); $insert = sprintf("INSERT INTO `events` VALUES('',%u,unix_timestamp(),0,'While attempting to diffuse the bomb it detonates you are very lucky to be alive!')", $ir['userid']); $delete = sprintf("DELETE FROM `inventory` WHERE `inv_itemid`=3 AND `inv_userid`=%u", $ir['userid']); $db->query($bombquery); $db->query($insert); $db->query($delete); $h->endpage(); exit; } elseif($_GET['ID'] === 2 AND $rand != 2) { echo "While attempting to diffuse the bomb, you decide to snip the <font color=green>green</font> wire. Fatal mistake, it sends you howling to the hospital lucky to escape with your life! <a href='hospital.php'>[b]Hospital[/b]"; $bombquery = sprintf("UPDATE `users` SET `hospital`=20,`hospreason`='Failed Diffusion',`new_events`=`new_events`+1,`timer`=0 WHERE `userid`=%u", $ir['userid']); $insert = sprintf("INSERT INTO `events` VALUES('',%u,unix_timestamp(),0,'While attempting to diffuse the bomb it detonates you are very lucky to be alive!')", $ir['userid']); $delete = sprintf("DELETE FROM `inventory` WHERE `inv_itemid`=3 AND `inv_userid`=%u", $ir['userid']); $db->query($bombquery); $db->query($insert); $db->query($delete); $h->endpage(); exit; } elseif($_GET['ID'] === 3 AND $rand !=3) { echo "While attempting to diffuse the bomb, you decide to snip the <font color=red>red</font> wire. Fatal mistake, it sends you howling to the hospital lucky to escape with your life! <a href='hospital.php'>[b]Hospital[/b]"; $bombquery = sprintf("UPDATE `users` SET `hospital`=20,`hospreason`='Failed Diffusion',`new_events`=`new_events`+1,`timer`=0 WHERE `userid`=%u", $ir['userid']); $insert = sprintf("INSERT INTO `events` VALUES('',%u,unix_timestamp(),0,'While attempting to diffuse the bomb it detonates you are very lucky to be alive!')", $ir['userid']); $delete = sprintf("DELETE FROM `inventory` WHERE `inv_itemid`=3 AND `inv_userid`=%u", $ir['userid']); $db->query($bombquery); $db->query($insert); $db->query($delete); $h->endpage(); exit; } elseif($_GET['ID'] === 4 AND $rand !=4) { echo "While attempting to diffuse the bomb, you decide to snip the <font color=black>black</font> wire. Fatal mistake, it sends you howling to the hospital lucky to escape with your life! <a href='hospital.php'>[b]Hospital[/b]"; $bombquery = sprintf("UPDATE `users` SET `hospital`=20,`hospreason`='Failed Diffusion',`new_events`=`new_events`+1,`timer`=0 WHERE `userid`=%u", $ir['userid']); $insert = sprintf("INSERT INTO `events` VALUES('',%u,unix_timestamp(),0,'While attempting to diffuse the bomb it detonates you are very lucky to be alive!')", $ir['userid']); $delete = sprintf("DELETE FROM `inventory` WHERE `inv_itemid`=3 AND `inv_userid`=%u", $ir['userid']); $db->query($bombquery); $db->query($insert); $db->query($delete); $h->endpage(); exit; } else { $statgain = mt_rand(1,100); $whichstat = mt_rand(1,5); if($whichstat==1) { $stat = strength; } elseif($whichstat==2) { $stat = agility; } elseif($whichstat==3) { $stat = guard; } elseif($whichstat==4) { $stat = labour; } else { $stat = IQ; } echo "Successful Diffusion! You gained ".$statgain." in your ".$stat.". [url='index.php'][b]Home[/b][/url]"; $update = sprintf("UPDATE `users` SET `timer`=0 WHERE `userid`=%u", $exp, $ir['userid']); $delete = sprintf("DELETE FROM `inventory` WHERE `inv_itemid`=3 AND `inv_userid`=%u", $ir['userid']); $statage = sprintf("UPDATE `userstats` SET %s=%u WHERE `userid`=%d", $stat, $statgain, $ir['userid']); $db->query($update); $db->query($delete); $db->query($statage); $h->endpage(); exit; } } ?>   SQLS ALTER TABLE `users` ADD `timer` NOT NULL Default 0; ALTER TABLE `users` ADD `bombattempts` NOT NULL Default 0;   Viewuser Link   [url='sendbomb.php?action=bomb&ID=".$r[']Bomb User[/url]   Now open up imadd.php and find $r=$db->fetch_row($q); Right beneath this add the following if($r['inv_itemid'] == 3) { echo "You cannot put a bomb on the market!"; $h->endpage(); exit; } Close/Save Now open up itemsend.php and find $r=$db->fetch_row($q); below this add if($r['inv_itemid'] == 3) { echo "You cannot give a ticking time bomb away!"; $h->endpage(); exit; } close and save Now open up itemsell.php find $r=$db->fetch_row($q); beneath add if($r['inv_itemid'] == 3) { echo "You cannot sell a ticking time bomb!!"; $h->endpage(); exit; }   Close and Save If you have any other files where users can send items in their inventory away just add the same type restrictions to those files as well. The Bombs are determined off the 2nd column added in users table "bombattempts" There are multiple differant ways users can obtain this, the choice is all up to you. It can be a donator only option Perhaps a Random Streets Find Daily Reward, etc etc. I'd suggest limiting the amount of bombs people gain, keeping it small :-) Any problems post here and I'll fix. **EDIT** Guess it would help to let everyone know what this mod does a *.* Basically a user can opt to plant a bomb on another user. If the other user has a bomb planted on them, they can go to a bomb diffusion center and attempt to cut 1 of 4 wires. The wires are always random so there is no cheating. If the user fails they are hospitalized for 20 minutes. If they succeed they get a random 1 through 100 stat gain in a Random userstat. If they do not try and diffuse it, in 10 minutes the timer goes off and they are hospitilized. cron next
  7. Thinking maybe my eyes are getting lazy   $bombexists = "SELECT in.inv_itemid,in.inv_userid,i.itmid,i.itmname,u.userid FROM inventory in LEFT JOIN items i ON in.inv_itemid=i.itmid LEFT JOIN users u ON in.inv_userid=u.userid WHERE in.inv_itemid=3"; $bombboom = $db->query($bombexists);   Can anyone see the err here? I'm getting You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in LEFT JOIN items i ON in.inv_itemid=i.itmid LEFT JOIN users u ON in.inv_userid' at line 1 But i just for the life of me cant see the error.
  8. yes,I think i'm going to recode entire thing from scratch and see what i get blah
  9. Nay,I was, I managed to fix that had a } in the wrong place Now it's just updating 1 gang tho >< the last gang. I set the gangs as a test 2 own land in that city the user i'm buying the item with has no land nor is he in a gang it takes his money, that tax bit works fine deducting but where it updates all the gangs a set amount of tax money only the last gang is getting the income
  10. Some of the random echo'd text is just me testing queries   <?php include "globals.php"; $_GET['ID']= abs((int) $_GET['ID']); $_POST['qty']= abs((int) $_POST['qty']); $query1 = $db->query("SELECT g.`gangID`,t.`gangID`,t.`city`,t.`tax` FROM `gangs` g LEFT JOIN `land` t ON g.`gangID`=t.`gangID` WHERE g.`gangID`={$ir['gang']} AND t.`city`={$ir['location']}"); $test= $db->fetch_row($query1); $taxquery = $db->query("SELECT `tax` FROM `land` WHERE `city`={$ir['location']}"); $taxation = $db->fetch_row($taxquery); if(!$_GET['ID'] || !$_POST['qty']) { print "Invalid use of file"; } else if($_POST['qty'] <= 0) { print "You have been added to the delete list for trying to cheat the game."; } else { $q=$db->query("SELECT * FROM items WHERE itmid={$_GET['ID']}"); if(mysql_num_rows($q) == 0) { print "Invalid item ID"; } else { $itemd=$db->fetch_row($q); if($ir['money'] < $itemd['itmbuyprice']*$_POST['qty']) { print "You don't have enough money to buy this item!"; $h->endpage(); exit; } if($itemd['itmbuyable'] == 0) { print "This item can't be bought!"; $h->endpage(); exit; } $price=($itemd['itmbuyprice']*$_POST['qty']); $tax = $price*$taxation['tax']; $taxprice = $price+$tax; $counting = $db->query("SELECT gangID FROM land WHERE city={$ir['location']} ORDER BY gangID ASC"); $count = $db->fetch_row($counting); $test = $db->num_rows($counting); $vault = $tax/$test; echo "".$vault.""; if($ir['money'] < $taxprice) { echo "You can not afford the Tax on this item"; $h->endpage(); exit; } item_add($userid, $_GET['ID'], $_POST['qty']); while($rr = $db->fetch_row($counting)) { if(!$db->num_rows($query1)) { echo "".$rr['gangID'].""; echo "Since Your gang does not own land in this location, you are charged a tax fee of ".$taxation['tax']." percent which goes towards gangs who do own land. Your grand total comes out to ".$taxprice." dollars."; $db->query("UPDATE users SET money=money-$taxprice WHERE userid=$userid"); $db->query("UPDATE gangs SET gangMONEY=gangMONEY+$vault WHERE gangID={$rr['gangID']}"); $db->query("INSERT INTO itembuylogs VALUES ('', $userid, {$_GET['ID']}, $taxprice, {$_POST['qty']}, unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for {$taxprice}')"); } } } $db->query("UPDATE users SET money=money-$price WHERE userid=$userid"); $db->query("INSERT INTO itembuylogs VALUES ('', $userid, {$_GET['ID']}, $price, {$_POST['qty']}, unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for {$price}')"); echo "You bought ".number_format($_POST['qty'])." ".stripslashes(htmlentities($itemd['itmname']))."(s) for \$".number_format($price).""; } $h->endpage(); ?>
  11. Right I attempted the while function and damn page timed out so not sure if i added it properly
  12. Well it's a bit more fickle than that sadly. Basically I am calling to another table with a JOIN statement and providing the JOINED TABLE matches info in the Gang table it should only update gangs that match the selected join base num_rows so say 3 out of 5 gangs match up with the Joined table, i want the 3 gangs to be updated on a query.
  13. How would one go about updating multiple differant people in a selected range.   for example   $db->query("UPDATE gangs SET gangMONEY=gangMONEY+$vault WHERE gangID={$test['gangID']}"); is my query. I am wanting it to update more than 1 gang.
  14. Thanks!
×
×
  • Create New...