
Akash
Members-
Posts
218 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by Akash
-
Re: [mc code V2]Updated Lottery I have no idea what I can do. I have tested this again on my dev site. Works perfectly for me. Perhaps you've installed something wrong. Apologies.
-
Re: [MCcode] Raffle Script out of interest I recommend you sell it, it's slightly more advanced that the current scripts out there that are similar. Good luck
-
Re: [mc code V2]Updated Lottery Sorry, I ALWAYS forget this. Use the file below. <?php require('globals.php'); $ticketPRICE = 10000; //Price of a lottery ticket, change this. if(!isset($_GET['buy'])) { $lotterySQL = sprintf("SELECT * FROM `lottery` WHERE `userID` = %d", abs((int)$userid)); $myTICKETS = mysql_num_rows(mysql_query($lotterySQL)); // Query checks how many tickets the user had. $tickets = mysql_num_rows(mysql_query("SELECT * FROM `lottery`")); // Query checks how many tickets have been purchased. echo'<h3>Weekly Lottery</h3> '; $jackpot = abs((int)$tickets*$ticketPRICE); // Jackpot formula echo'This is the current Jackpot. '; echo sprintf('<h2>$%d</h2>', $jackpot); // The current Jackpot echo sprintf('Welcome to the weekly lottery. Currently, [b]%d[/b] tickets have been purchased. You have [b]%d[/b] tickets ', abs((int)$tickets), abs((int)$myTICKETS)); // How many tickets have been purchased & how many user has echo' [url="' .$_SERVER['PHP_SELF']. '?buy=1"]Click here to buy a ticket (' .$ticketPRICE. ')[/url]'; } else if(isset($_GET['buy'])) { if(!is_numeric($_GET['buy']) || $_GET['buy'] > "1") { echo'There has been an error. Please go [url="' .$_SERVER['PHP_SELF']. '"]back[/url] and try again'; header('Location: ' .$_SERVER['PHP_SELF']. ''); exit; } $_GET['buy'] = abs((int)$_GET['buy']); if($ir['money'] < $ticketPRICE) { echo'You do not have enough money.'; exit; $h->endpage(); } $updateSQL = sprintf("UPDATE `users` SET `money` = `money` - %d WHERE `userid` = %d", abs((int)$ticketPRICE), abs((int)$userid)); $updateQUERY = mysql_query($updateSQL); $insertSQL = sprintf("INSERT INTO `lottery` VALUES ('', %d, %d)", abs((int)$userid), abs((int)1)); mysql_query($insertSQL); echo' You purchased a lottery ticket! [url="' .$_SERVER['PHP_SELF']. '?buy=1"]Click here to buy another ticket[/url]'; } else { echo'There has been an error. Please go [url="' .$_SERVER['PHP_SELF']. '"]back[/url] and try again'; } ?>
-
Re: [mc code V2]Updated Lottery I don't really think a screenshot is necessary. It's just a page saying: x no of tickets have been purchased, you have x no tickets and whatthe Jackpot is.
-
Re: [mc code V2]Updated Lottery Thanks, didn't know that. Well anyone who uses this, might aswell use what HD has posted, it's more efficient :-)
-
Re: [mccode v2] Lottery I've posted an updated, what looks to be a bug free version of the lottery. Only one table in the DB with 3 fields. No fields added to the users table and the modification is much more efficient. http://criminalexistence.com/ceforums/i ... ic=29157.0 is the link Please report any bugs, queries or anything else to my email: [email protected]
-
Hey guys, I'm only posting a new topic because my old one is so long, that the updated version won't necessarily get noticed. My previous lottery was very buggy and many users had problems with it. Apologies for that. This one doesn't have any bugs when tested by myself and a few others. Each ticket costs $10,000 and the jackpot builds up as you buy tickets. There's no limit to how many tickets you can purchase and once the week is up, the money is automatically credited to the winner. The winner is chosen randomly using the PHP 'mt_rand' function. So there's no involvement of any staff in deciding the winner. Upload this file as whatever you like: <?php require('globals.php'); $ticketPRICE = 10000; //Price of a lottery ticket, change this. if(!isset($_GET['buy'])) { $lotterySQL = sprintf("SELECT * FROM `lottery` WHERE `userID` = %d", abs((int)$userid)); $myTICKETS = mysql_num_rows(mysql_query($lotterySQL)); // Query checks how many tickets the user had. $tickets = mysql_num_rows(mysql_query("SELECT * FROM `lottery`")); // Query checks how many tickets have been purchased. echo'<h3>Weekly Lottery</h3> '; $jackpot = abs((int)$tickets*$ticketPRICE); // Jackpot formula echo'This is the current Jackpot. '; echo sprintf('<h2>$%d</h2>', $jackpot); // The current Jackpot echo sprintf('Welcome to the weekly lottery. Currently, [b]%d[/b] tickets have been purchased. You have [b]%d[/b] tickets ', abs((int)$tickets), abs((int)$myTICKETS)); // How many tickets have been purchased & how many user has echo' [url="' .$_SERVER['PHP_SELF']. '?buy=1"]Click here to buy a ticket[/url]'; } else if(isset($_GET['buy'])) { if(!is_numeric($_GET['buy']) || $_GET['buy'] > "1") { echo'There has been an error. Please go [url="' .$_SERVER['PHP_SELF']. '"]back[/url] and try again'; header('Location: ' .$_SERVER['PHP_SELF']. ''); exit; } $_GET['buy'] = abs((int)$_GET['buy']); $updateSQL = sprintf("UPDATE `users` SET `money` = `money` - %d WHERE `userid` = %d", abs((int)$ticketPRICE), abs((int)$userid)); $updateQUERY = mysql_query($updateSQL); $insertSQL = sprintf("INSERT INTO `lottery` VALUES ('', %d, %d)", abs((int)$userid), abs((int)1)); mysql_query($insertSQL); echo' You purchased a lottery ticket! [url="' .$_SERVER['PHP_SELF']. '?buy=1"]Click here to buy another ticket[/url]'; } else { echo'There has been an error. Please go [url="' .$_SERVER['PHP_SELF']. '"]back[/url] and try again'; } ?> Then create a cron_weekly.php file and set the cron as 0 12 * * 0 <?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; include('global_func.php'); $ticketPRICE = 10000; $jpSQL = mysql_num_rows(mysql_query("SELECT * FROM `lottery`")) or die(mysql_error()); $jackpot = money_formatter(abs((int)$jpSQL*$ticketPRICE)); $winner = rand(1,$jpSQL); $winnerSQL = sprintf("SELECT `userid` FROM `lottery` WHERE `id` = %d", abs((int)$winner)); $winnerQUERY = mysql_query($winnerSQL); $user = mysql_fetch_array($winnerQUERY); $creditSQL = sprintf("UPDATE `users` SET `money` = `money` + %d WHERE `userid` = (%d)", $jackpot, abs((int)$user['userid'])); event_add($user['userid'],"You won the weekly lottery and were credited {$jackpot}",$c); mysql_query("TRUNCATE TABLE `lottery`"); ?> Finally, add SQL DROP TABLE IF EXISTS `lottery`; CREATE TABLE IF NOT EXISTS `lottery` ( `id` int(11) NOT NULL auto_increment, `userid` int(11) NOT NULL, `qty` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; If you want to change the ticket price, you need to change it in the main file and the cron file. Please report any bugs, queries or anything else to my email: [email protected]
-
Re: [V2]Coin Toss Modification Sorry about that, I'm just changing that now.
-
Re: [V2]Coin Toss Modification Nice idea, I'll do that if I get some time. :)
-
Re: [V2]Coin Toss Modification Thanks
-
Hey guys, One of my simplest mods, I had a bit of time to spare so here it is: Details: All you need to do is bet up to $500,000 and choose heads or tails. If the coin lands on the correct one, you win double. If not, you lose your bet cash. No images, only text. Version: V2 (2.0.0) <?php /******************************************* -- Coin Toss Modification, for MC Codes V2 -- Free for modification -- Copyright (c), Revolutionary Gaming 2009 -- Not for resale *******************************************/ require('globals.php'); if(!isset($_POST['bet'])) { echo' <h3>Coin Toss Game</h3> Welcome to the Coin Toss game. You may bet up to $500,000 on this game. All you do is simply enter your bet and choose heads/tails. If you choose the correct one, you will double your money. <form action="' .$_SERVER['PHP_SELF']. '" method="post"> Your bet: <input type="text" value="0" name="money"> <select name="choose"> <option value="Heads">Heads</option> <option value="Tails">Tails</option> </select> <input type="submit" value="Bet" name="bet">'; } if(isset($_POST['bet'])) { if(!isset($_POST['money'])) { echo'You must enter an amount of money'; exit; $h->endpage(); } if(!is_numeric($_POST['money'])) { echo'Error, please try again'; exit; $h->endpage(); } if($_POST['money'] > 500000 || $_POST['money'] < 1) { echo'You can only bet a maximum of $500,000 and a minimum of $1. Please try again.'; exit; $h->endpage(); } $coin = rand(1,2); if($coin == 1) { $landed = "Heads"; } if($coin == 2) { $landed = "Tails"; } if($_POST['choose'] == $landed) { $win = $_POST['money'] * 2; $winSQL = sprintf("UPDATE `users` SET `money` = `money` + '%u' WHERE `userid` = '%u'", abs(@intval($win)), abs(@intval($userid))); mysql_query($winSQL); echo'You chose [b]' .$_POST['choose']. '[/b] and WON! The coin landed on [b]' .$landed. '[/b] For guessing correctly, you doubled your money. You win: [b]$' .$win. '[/b]!'; } else if($_POST['choose'] != $landed) { $lose = $_POST['money']; $loseSQL = sprintf("UPDATE `users` SET `money` = `money` - '%u' WHERE `userid` = '%u'", abs(@intval($lose)), abs(@intval($userid))); mysql_query($loseSQL); echo'You chose [b]' .$_POST['choose']. '[/b] and LOST! The coin landed on [b]' .$landed. '[/b] Unlucky, you lose: [b]$' .$lose. '[/b]!'; } else { echo'There has been an error, please try again. If this persists, please report as a bug'; exit; } } ?> You must upload with any filename and add a link in casino/wherever you find appropriate. Enjoy. No bugs so far, but if you do find any, please post.
-
Re: [self Made] New Login Page Umm correct me if I'm wrong, but isn't this awfully similar to the one here: http://www.lancs.ac.uk/ug/crowthep/documents/index.txt If that is your website, I apologise/if I have read wrong or something, I am sorry. If it is from there, at least give credit to them.
-
Re: Where do people host? Lunar Pages... I host with them and they're great, no problems so far, it's fast, very cheap. In total, I paid $118.80 for two years of hosting with a free domain (for a year). The amount of space they give is immense, some statistics below: Space: 1500 GB Bandwidth: 5000 GB Emails: 999 Subdomains: 999 Parked Domains: 999 Add-on Domains: Unlimited MySQL Databases: 999 FTP Accounts: 999 That was what I purchased in May 2008. Now they have even better plans :)
-
Re: [mccode] Customisable Merit System [$15.00] Like I explained to you already on MSN, it didn't say it gives merits. Although it didn't say is doesn't either, like people have said, you should have read properly and asked. I'll talk to you on MSN about this but you shouldn't really have moaned/posted negatively about the mod until we have it sorted between us.
-
Re: Which piece of code is better to use? Thanks for all the help guys. :)
-
Re: Which piece of code is better to use? So I'm guessing Lithium's right then, as no one's challenged him :P. Thanks for your help guys.
-
Hi guys, I just wanted to know which piece of code out of the following two is better to use. Basically, all I want is to makesure that the $_POST['hs'] from the form submitted is numerical. In one I have used eregi, and I don't actually know if it's right. The other uses is_numeric. Eregi if (!eregi('[0-9]', $_POST['hs'])) { echo'Invalid scores'; $h->endpage(); exit; } is_numeric if(!is_numeric($_POST['hs'])) { echo'Invalid scores'; $h->endpage(); exit; }
-
Re: mccode lite Lite is nearly the same as V1, in terms of coding style so it's not difficult to convert them at all. Just get V1 mods and convert. OR, as a majority of mods are V2, convert them to V1, then to lite. I'd advise you to buy something else i.e. horizons, unless you're planning to make your own game that is completely different to the MC ones out there. Good luck :)
-
Re: [mccode] Free Starter Pack Nice idea DissObey, but just so you know it doesn't run a query on every visit to the explore page becuase if the user has claimed their starter pack/kit, the query doesn't run anyway. Also, the only reason I did it on explore is toget the user involved. Instead of crediting it to them, I put in on explore so not every user will get it. e.g. one user may not see it. Otherwise, the game becomes too much of an automated system with no chance for the user to do something. That's just my view.
-
Re: Anolog Clock [All versions] Webster, what's the point of brushing off the criticism people give? Why not actually try learning from it instead of mocking it? All killah did was give his views in a polite way.
-
Re: [mccode] Free Starter Pack it looks like its trying to detect the mccode version, because only V2 has globals.php Nedved, that part of the code, as you can see, detects whether the file 'globals.php' exists. If it does, it continues with the file as normal. If not, it uses the includes for V1. The point of it is to make the script compatible with V1 and V2 MC Codes to stop users from asking 'convert to V1/V2 for me please'. I'm not 100% if the file will work in V1, it should do.
-
Re: [mccode] Free Starter Pack Sorry again. You will see this somewhere: $mysql_query($updateSQL); change it to: mysql_query($updateSQL);
-
Re: [mccode] Free Starter Pack Guys, The last file I posted had some errors, here is a version that should work but I haven't tested: <?php /*----------------------------------------------------- -- Made by Akash for CE users -- Free Starter Pack -- Mail [email][email protected][/email] if you need help or converting -----------------------------------------------------*/ //The below makes your file compatible with MC Codes Version 1 and 2. if (file_exists('globals.php')) { require('globals.php'); } else { 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(); } //Carries out the queries only if the donatorpack value in the database is 0. if ($ir['donatorpack']== 0) { echo'Welcome to ' .$set['game_name']. ', we hope you enjoy your stay and here is a complimentary pack from us to get you started.'; //This is the writing they will get after clicking on the button in explore.php $updateSQL = sprintf(" UPDATE `users` SET `money` = `money` + '%d', `crystals` = `crystals` + '%d', `donatordays` = `donatordays` + '%d', `donatorpack` = '%d' WHERE (`userid` = ('%u'))", @intval(10000), @inval(100), @intval(5), @intval(1), @intval($userid)); $mysql_query($updateSQL); //Edit any of these to credit whatever you want e.g. instead of crystals, it may be points. Please DO NOT change the donatorpack=1 as this is part of the mod. Changing it may result in users claiming more than one pack. //If you don't want the item function remove everything from below here, to where it says STOP HERE FOR REMOVING ITEMS. $itmid = 1; //This is the item ID, whatever item you want it to add, just type in the ID here. If you want a random item then replace $itmid = 1; with itmid=rand(1,100), with the numbers being whatever you want. $itemSQL = sprintf(" INSERT INTO `inventory` VALUES('','%u','%u','%u')", @intval($itmid), @intval($userid), @intval(1)); mysql_query($itemSQL); mysql_query("INSERT INTO inventory VALUES('',$itmid,$userid,1)",$c); echo' '; //You do not need to change anything here, unless you want more than one of the item to be given. In this case, just edit the 1 at the end to the quantity. //STOP HERE FOR REMOVING ITEMS. event_add($userid,"You were given a complimentary starter kit to begin you off. We hope you enjoy your stay at {$set['game_name']} and please mail [url='viewuser.php?u=1'][b]<font color=red>Owner Name[/b]</font>[/url] for any help you need.",$c); //This is the event they will receive once they have been credited. Edit the Owner Name to the owner's name and if needed, the writing in the event. } //If the value of donatorpack is 1, this will display a message saying you've claimed your kit. else { echo'You have already claimed your starter kit!'; //This simply ensures that the user does not claim more than one pack. $h->endpage(); exit; } $h->endpage(); ?>
-
Re: Setting up a new game.. Basically, the installer file checks four things. If each of them are OK, the total adds up to 4. If one or more of them do not work, then the total is below four and an error occurs. All you need to do is change: if($pvf+$wvf+$dvf+$avf < 4) TO if($pvf+$wvf+$dvf+$avf < 3) This will make sure that even if one of the four things says Failed, in your case the root, the installer will continue.
-
Re: [mccode] Free Starter Pack Guys, I'm only posting again to provide you with an updated file. It's slightly neater and perhaps slightly better than the other one. There are more annotations on it allowing it to be customised with ease. I can't seem to find the 'Edit post' button, so I've had to do it here. This is all compatible with V1/V2 and if you do find any errors, simply let me know and I'll deal with them ASAP. <?php /*----------------------------------------------------- -- Made by Akash for CE users -- Free Starter Pack -- Mail [email][email protected][/email] if you need help or converting -----------------------------------------------------*/ //The below makes your file compatible with MC Codes Version 1 and 2. if (file_exists('globals.php')) { require('. /globals.php'); } else { 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(); } //Carries out the queries only if the donatorpack value in the database is 0. if ($ir['donatorpack']== 0) { echo'Welcome to ' .{$set['game_name']}. ', we hope you enjoy your stay and here is a complimentary pack from us to get you started.'; //This is the writing they will get after clicking on the button in explore.php $updateSQL = sprintf(" UPDATE `users` SET `money` = `money` + '%d', `crystals` = `crystals` + '%d', `donatordays` = `donatordays` + '%d', `donatorpack` = '%d' WHERE (`userid` = ('%u'))", @intval(10000), @inval(100), @intval(5), @intval(1), @intval($userid)); $mysql_query($updateSQL); //Edit any of these to credit whatever you want e.g. instead of crystals, it may be points. Please DO NOT change the donatorpack=1 as this is part of the mod. Changing it may result in users claiming more than one pack. //If you don't want the item function remove everything from below here, to where it says STOP HERE FOR REMOVING ITEMS. $itmid = 1; //This is the item ID, whatever item you want it to add, just type in the ID here. If you want a random item then replace $itmid = 1; with itmid=rand(1,100), with the numbers being whatever you want. itemSQL = sprintf(" INSERT INTO `inventory` VALUES('','%u','%u','%u')", @intval($itmid), @intval($userid), @intval(1)); mysql_query($itemSQL); mysql_query("INSERT INTO inventory VALUES('',$itmid,$userid,1)",$c); echo' '; //You do not need to change anything here, unless you want more than one of the item to be given. In this case, just edit the 1 at the end to the quantity. //STOP HERE FOR REMOVING ITEMS. event_add($userid,"You were given a complimentary starter kit to begin you off. We hope you enjoy your stay at {$set['game_name']} and please mail [url='viewuser.php?u=1'][b]<font color=red>Owner Name[/b]</font>[/url] for any help you need.",$c); //This is the event they will receive once they have been credited. Edit the Owner Name to the owner's name and if needed, the writing in the event. } //If the value of donatorpack is 1, this will display a message saying you've claimed your kit. else { echo'You have already claimed your starter kit!'; //This simply ensures that the user does not claim more than one pack. $h->endpage(); exit; } $h->endpage(); ?> I hope everyone enjoys this :).