Jump to content
MakeWebGames

iSOS

Members
  • Posts

    152
  • Joined

  • Last visited

    Never
  • Days Won

    1

Everything posted by iSOS

  1. It was requested in V2 also so here it is, not tested. Bomb.php   <?php include(DIRNAME(__FILE__).'/globals.php'); //Start script. if(isset($_GET['Defuse'])) { $DefenderD = $db->query("SELECT `ID`,`Attacker`,`Defender` FROM `uBomb` WHERE (`Defender` = $userid)"); if(!$db->_num_rows($DefenderD)) { echo ('There are no bombs incoming towards you...'); $h->endpage(); exit(); } $DefenderD = $db->_fetch_array($DefenderD); $Rand = mt_rand(1,4); if($Rand === 4) { echo ('You\'ve cut the wrong wire!, The bomb exploded and you\'re now in hospital!'); $HospTime = mt_rand(40,200); $db->query("UPDATE `users` = `hospital` = `hospital` + ".$HospTime.", `hosp_reason` = 'Blown Up' WHERE (`userid` = $userid)"); $db->query("INSERT INTO `events` VALUES('',".abs(intval($DefenderD['Attacker'])).",UNIX_TIMESTAMP(),0,'".mysql_real_escape_string($ir['username'])." tried to defuse your bomb but FAILED!.')"); $db->query("DELETE FROM `uBomb` WHERE (`Defender` = $userid)"); }else{ echo ('You\'ve successfully defused the bomb, congratulations, now get some revenge!'); $db->query("INSERT INTO `events` VALUES('',".abs(intval($DefenderD['Attacker'])).",UNIX_TIMESTAMP(),0,'".mysql_real_escape_string($ir['username'])." Just defused the bomb you sent him.')"); $db->query("DELETE FROM `uBomb` WHERE (`Defender` = $userid)"); } $h->endpage(); exit(); } if((!$_GET['ID']) || (!ctype_digit($_GET['ID']))) { echo ('You\'ve clicked an invalid link, please report to an administrator.'); $h->endpage(); exit(); } $Data = $db->query("SELECT `userid`,`username` FROM `users` WHERE (`userid` = ".abs(intval($_GET['ID'])).")"); if(!$db->_num_rows($Data)) { echo ('This user doesn\'t exist.'); $h->endpage(); exit(); } $Money = 10000; //Change to any amount you want... echo (' <span style = "color:#8B0000">If you click [b]Confirm[/b], $'.number_format($Money).' will be deducted from you, and the bomb will be sent to the user. <form action = "Bomb.php?ID='.abs(intval($_GET['ID'])).'" method = "post"> <input type = "submit" value = "Confirm" name = "submit"> </form>'); if(isset($_POST['submit']) && is_string($_POST['submit'])) { $Defender = $db->query("SELECT `ID` FROM `uBomb` WHERE (`Defender` = ".abs(intval($_GET['ID'])).")"); if($_GET['ID'] == $userid) { echo ('Why send a bomb to yourself...'); $h->endpage(); exit(); } if($db->_num_rows($Defender)) { echo ('This user already has incoming bombs, please try again later.'); $h->endpage(); exit(); } if($ir['money'] < $Money) { echo ('You don\'t seem to have enough money, you have $'.number_format($ir['money']).', you need $'.number_format($Money).'.'); $h->endpage(); exit(); }else{ $db->query("UPDATE `users` SET `money` = `money` - ".$Money." WHERE (`userid` = $userid)"); //Money deduction... $db->query("INSERT INTO `uBomb` VALUES ('',$userid,".abs(intval($_GET['ID'])).",UNIX_TIMESTAMP())") or die($db->_error()); // DB insert echo ('You\'ve successfully sent the bomb, the user has 10 minutes to respond, otherwise it will explode automatically.'); $db->query("INSERT INTO `events` VALUES('',".abs(intval($_GET['ID'])).",UNIX_TIMESTAMP(),0,'".mysql_real_escape_string($ir['username']).", Has sent a bomb to you, Click <a href = \'/Bomb.php?Defuse&ID=".mysql_insert_id()."\'>HERE</a> to try and defuse the bomb.')",$c); } } ?>   Open header.php and add...   $Time = $db->query("SELECT `ID`,`Attacker`,`TimeStamp` FROM `uBomb` WHERE (`Defender` = $userid) LIMIT 1"); if(mysql_num_rows($Time)) { $Time = $db->fetch_row($Time); if(time() - $Time['TimeStamp'] < 600) { echo ('[b]A bomb is incoming, you have '.time_format(600 + $Time['TimeStamp'] - time()).' till it gets to you. <a href = "Bomb.php?Defuse"><span style = "color:green">Defuse The Bomb</span></a>'); } if(time() - $Time['TimeStamp'] > 600) { $Hosp = mt_rand(20,500); $db->query("UPDATE `users` SET `hosp_time` = `hosp_time` + ".$Hosp." WHERE (`userid` = $userid)") or die(mysql_error()); //MC LITE doesn't come with hospital so change fields to your own.. $db->query("DELETE FROM `uBomb` WHERE (`Defender` = $userid)") or die(mysql_error()); $db->query("INSERT INTO `events` VALUES ('',$userid,UNIX_TIMESTAMP(),0,'#<a href = \'/viewuser.php?u=".$Time['Attacker']."\'>".$Time['Attacker']."</a> sent a bomb, you failed to react in time and consequently it exploded.')") or die(mysql_error()); } }   The rest is the same. =)
  2. Here -- [mccode lite] Bomb User.
  3. This was requested by Agon, I've done it using the LITE version as that was the requested version, but I've never worked with LITE so there may be an error as I've not tested to it's fullest extent. If anyone is actually interested in having it in another version, just let me know. SQL: [mysql]CREATE TABLE IF NOT EXISTS `uBomb` ( `ID` int(11) NOT NULL auto_increment, `Attacker` int(11) NOT NULL, `Defender` int(111) NOT NULL, `TimeStamp` int(11) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;[/mysql] Bomb.php <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); //Start script. if(isset($_GET['Defuse'])) { $DefenderD = mysql_query("SELECT `ID`,`Attacker`,`Defender` FROM `uBomb` WHERE (`Defender` = $userid)"); if(!mysql_num_rows($DefenderD)) { echo ('There are no bombs incoming towards you...'); $h->endpage(); exit(); } $DefenderD = mysql_fetch_array($DefenderD); echo (' <table border = "1" class = "table" cellspacing = "1" width = "40%" align = "center"> <tr> <th>Wire</th> <th>Actions</th> </tr> <tr> <td>[b]<span style = "color:black">Black Wire</span>[/b]</td> <td><a href = "Bomb.php?Defuse&Wire=1">Cut</a></td> </tr> <tr> <td>[b]<span style = "color:greeb">Green Wire</span>[/b]</td> <td><a href = "Bomb.php?Defuse&Wire=2">Cut</a></td> </tr> <tr> <td>[b]<span style = "color:red">Red Wire</span>[/b]</td> <td><a href = "Bomb.php?Defuse&Wire=3">Cut</a></td> </tr> <tr> <td>[b]<span style = "color:white">White Wire</span>[/b]</td> <td><a href = "Bomb.php?Defuse&Wire=4">Cut</a></td> </tr> </table>'); } if(isset($_GET['Wire']) && ctype_digit($_GET['Wire'])) { $DefenderD = mysql_fetch_array(mysql_query("SELECT `ID`,`Attacker`,`Defender` FROM `uBomb` WHERE (`Defender` = $userid)")); $Rand = mt_rand(1,4); if($Rand === 4) { echo ('You\'ve cut the wrong wire!, The bomb exploded and you\'re now in hospital!'); $HospTime = mt_rand(40,200); mysql_query("UPDATE `users` = `Hosp_Time` = `Hosp_Time` + ".$HospTime." WHERE (`userid` = $userid)"); //Change these rows to your own MC LITE doesnt come with hospital mysql_query("INSERT INTO `events` VALUES('',".abs(intval($DefenderD['Attacker'])).",UNIX_TIMESTAMP(),0,'".mysql_real_escape_string($ir['username'])." tried to defuse your bomb but FAILED!.')") or die(mysql_error()); mysql_query("DELETE FROM `uBomb` WHERE (`Defender` = $userid)"); }else{ echo ('You\'ve successfully defused the bomb, congratulations, now get some revenge!'); mysql_query("INSERT INTO `events` VALUES('',".abs(intval($DefenderD['Attacker'])).",UNIX_TIMESTAMP(),0,'".mysql_real_escape_string($ir['username'])." Just defused the bomb you sent him.')") or die(mysql_error()); mysql_query("DELETE FROM `uBomb` WHERE (`Defender` = $userid)"); } } if($_GET['ID']) { if(!ctype_digit($_GET['ID'])) { echo ('You\'ve clicked an invalid link, please report to an administrator.'); $h->endpage(); exit(); } $Data = mysql_query("SELECT `userid`,`username` FROM `users` WHERE (`userid` = ".abs(intval($_GET['ID'])).")"); if(!mysql_num_rows($Data)) { echo ('This user doesn\'t exist.'); $h->endpage(); exit(); } $Money = 10000; //Change to any amount you want... echo (' <span style = "color:#8B0000">If you click [b]Confirm[/b], $'.number_format($Money).' will be deducted from you, and the bomb will be sent to the user. <form action = "Bomb.php?ID='.abs(intval($_GET['ID'])).'" method = "post"> <input type = "submit" value = "Confirm" name = "submit"> </form>'); if(isset($_POST['submit']) && is_string($_POST['submit'])) { $Defender = mysql_query("SELECT `ID` FROM `uBomb` WHERE (`Defender` = $userid)"); if(mysql_num_rows($Defender)) { echo ('This user already has incoming bombs, please try again later.'); $h->endpage(); exit(); } if($ir['money'] < $Money) { echo ('You don\'t seem to have enough money, you have $'.number_format($ir['money']).', you need $'.number_format($Money).'.'); $h->endpage(); exit(); }else{ mysql_query("UPDATE `users` SET `money` = `money` - ".$Money." WHERE (`userid` = $userid)"); //Money deduction... mysql_query("INSERT INTO `uBomb` VALUES ('',$userid,".abs(intval($_GET['ID'])).",UNIX_TIMESTAMP())") or die(mysql_error()); // DB insert echo ('You\'ve successfully sent the bomb, the user has 10 minutes to respond, otherwise it will explode automatically.'); mysql_query("INSERT INTO `events` VALUES('',".abs(intval($_GET['ID'])).",UNIX_TIMESTAMP(),0,'".mysql_real_escape_string($ir['username']).", Has sent a bomb to you, Click <a href = \'/Bomb.php?Defuse&ID=".mysql_insert_id()."\'>HERE</a> to try and defuse the bomb.')",$c); } } } ?>   Open global_func.php and add this is...This is "Magictallguys" function time_format($seconds) { // Seconds = The currect timestamp minus the second value, stated in the formula $seconds = floor($seconds); $days = intval($seconds / 86400); $seconds -= ($days * 86400); $hours= intval($seconds / 3600); $seconds -= ($hours * 3600); $minutes = intval($seconds / 60); $seconds -= ($minutes * 60); $result = array(); if($days) { $result[] = sprintf("%u day%s", number_format($days), ($days == 1) ? "" : "s"); } if($hours) { $result[] = sprintf("%u hour%s", $hours, ($hours == 1) ? "" : "s"); } if($minutes && (count($result) < 2)) { $result[] = sprintf("%u minute%s", $minutes, ($minutes == 1) ? "" : "s"); } if(($seconds && (count($result) < 2)) || !count($result)) { $result[] = sprintf("%u second%s", $seconds, ($seconds == 1) ? "" : "s"); } return implode(", ", $result); }   Open header.php, Add this where you want it to display...   $Time = mysql_query("SELECT `ID`,`Attacker`,`TimeStamp` FROM `uBomb` WHERE (`Defender` = $userid) LIMIT 1"); if(mysql_num_rows($Time)) { $Time = mysql_fetch_array($Time); if(time() - $Time['TimeStamp'] < 600) { echo ('[b]A bomb is incoming, you have '.time_format(600 + $Time['TimeStamp'] - time()).' till it gets to you. <a href = "Bomb.php?Defuse"><span style = "color:green">Defuse The Bomb</span></a>'); } if(time() - $Time['TimeStamp'] > 600) { $Hosp = mt_rand(20,500); mysql_query("UPDATE `users` SET `hosp_time` = `hosp_time` + ".$Hosp." WHERE (`userid` = $userid)") or die(mysql_error()); //MC LITE doesn't come with hospital so change fields to your own.. mysql_query("DELETE FROM `uBomb` WHERE (`Defender` = $userid)") or die(mysql_error()); mysql_query("INSERT INTO `events` VALUES ('',$userid,UNIX_TIMESTAMP(),0,\'<a href = \'/viewuser.php?u=".$Time['Attacker']."\'>".$Time['Attacker']."</a> sent a bomb, you failed to react in time and consequently it exploded.')") or die(mysql_error()); } }   That's it, for the Hospital queries, please change to your own as LITE doesn't come with a hospital. Any errors let me know asap, I did this quick so that may be the case...
  4. Agon, do you have a hospital or jail?, MC LITE doesn't come with them so what do you want it to do on explosion?
  5. I wouldn't use that script, full stop :L
  6. Erm, well let's just say that *everything* is better on the OP's template. *Looks almost like a knock off of my login template* -- You know that sounds like you're suggesting he ripped it though right?
  7. We'll wait for someone else to reply regarding this then won't we :L You say it's a "knock off" of yours, when in actual fact BogFX's is better in a million ways :wacko: Okay now I've looked at the similarities between the templates, and I see none...Lets wait for others to reply before you call me "Slow".
  8. Lol, Looks nothing like yours.
  9. Just so people know, there is no benefit nor disadvantage to using the ternary operator, simply preference, readability vs less lines lol
  10. Trust me $20 is too much to pay. It's simply another row in a table and an if() statement. Someone might 'flame' me for saying it, but I don't want him paying to much for something so simple. =)
  11. It's just personal preference. Just read up on sprintf(), It will be a lot quicker than waiting for people to post.
  12. So you didn't dual boot them, like you said you would.? I know you said there wasn't a "Try/Demo" option, But I've installed ubuntu a few times now and it has always had that option, and that's what I suggested first. I also remember you looking around the NET for any compatibility issues with your Internet drivers ect. You did find some 'instructions' so I'm guessing that meant there was compatibility errors, You should have printed them out or something. If you have completely deleted your Windows partition, If I'm correct there is no way to get it back unless you download a *warez* version of windows, or buy another Windows disk.
  13. You should post your actual form. Looking at those 'snippets', they look okay. Are you sure you're using "$_GET" as the form method?, or are you actually using "$_POST"?
  14. Lol, wasn't your other account here asking for this to be made? (GENERALGENERAL)
  15. No point in trying to help this guy, I've told him what to do multiple times, he just fails to read english. All he had to do was follow the instructions. Also on a side note... That link that was 'removed' was obviously mcaddons right? If so why? this forum always claims how it's *not* an mccodes forum, so where is the competition on there end.
  16. Are you sure you didn't copy that off a site, In that I mean you copied the words *not* the code lol.
  17. If you use Cpanel, go to "Parked Domains" and add it from there :)
  18. Hey, I'd like to develop a "Zap Engine" game. I'd also like a partner and/or a team. #Graphics Designer. #PHP programmer Obviously any of these would be a bonus, but If you feel you'd be a good partner or work well as a team, please PM me or reply here. I'm a PHP programmer, I've mainly worked with MCcodes, but I've delved into other projects, (Game Engine, Arcade scripts ect ect). Well anyway, cya around :)
  19. Ah, It was me, I did some of it but then got a bit tied up with a little job, so I posted some of the code on another forum, if no-one wants to do the rest, I'll do it once my time has freed up a bit.
  20. It looks really good, well done!. How much do you plan on selling it for?
×
×
  • Create New...