Blade Maker Posted October 26, 2010 Posted October 26, 2010 Decided to make this free now, it is my first real mod. let me explain what it does: There is a new page that you can go to, you can buy a lottery ticket there for $1,000, once you buy the ticket, you lose your $1,000. The more you buy the more of a chance you have of winning, when you run out of money then you are not able to buy a ticket anymore. You then get a ticket entry into the database, and after 7 days you then draw a random winner from the database, and add the whatever amount of money the prize was to there account. You then clear the data in the database table and restart it for the next week. lottery.php: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. buy_ticket.php: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Weekly Cron: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. I believe the above cron would work, just put it in a weekly cron. You will need to make the sql database for the lottery part. You pick the winner randomly in the database and give the prize to the players account. Modify this how you would like, rate it 1 - 5 thanks... Quote
Djkanna Posted October 26, 2010 Posted October 26, 2010 Not bad you may need to mention to change the URL param in the meta tag. [mysql] CREATE TABLE `lottery` ( `lotID` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `lotUser` VARCHAR(40) NOT NULL, PRIMARY KEY (`lotID`) ); [/mysql] Should do it. Quote
Djkanna Posted October 26, 2010 Posted October 26, 2010 Little update to buy_ticket.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
Blade Maker Posted October 26, 2010 Author Posted October 26, 2010 Whats that do to it? Besides the text, it worked fine before just wanna know what the difference is. Quote
Djkanna Posted October 26, 2010 Posted October 26, 2010 No need for the extra $check query . Ticket price is defined at the top so if you were to add to this it would be easier to edit the ticket price. Escaped the username upon input to the db. Generally just a little cleaner. Quote
Blade Maker Posted October 26, 2010 Author Posted October 26, 2010 Oh I tried it and it did not work so I will keep it my way sry. Quote
a_bertrand Posted October 26, 2010 Posted October 26, 2010 What doesn't work in Dj version as it seems indeed smarter... plus in your version adding the username directly to the database... without escape is certainly not the way to go. Quote
bladewolf2010 Posted October 26, 2010 Posted October 26, 2010 He's trying, all that counts. Maybe one day he'll be as great as illusions :P Quote
Uridium Posted October 26, 2010 Posted October 26, 2010 You have the starting of a decent mod well done :) Just a few things i would add to make it more impressive would be 1 winner 5 runner up prizes History that shows who won with which tickets.. tickets bought are actual tickets this is always impressive and looks like the creator has spent time on the mod.. Make the system fair so for example if you have suers in your game that are rich and can afford LOADS of tickets only allow them to buy If others have bought tickets too... Quote
Blade Maker Posted October 26, 2010 Author Posted October 26, 2010 Thanks, I will try to improve it, thanks for the comments. Quote
rulerofzu Posted October 26, 2010 Posted October 26, 2010 Is this the mod you was attempting to sell for $15? Sorry but this is just a stripped down version of the free one you can find by using the search. Not a very good stripped down version either. Quote
The Monk Posted October 27, 2010 Posted October 27, 2010 lottery.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. No reason to make a query for the users money, globals.php already has that. You can remove $money = (int)$ir['money']+0; if you feel its unnecessary but there are no queries ran on this page, load time shouldn't be any issue. Quote
Uridium Posted October 27, 2010 Posted October 27, 2010 Heres one i made for a non MCC game but the princiapl for this can be used to make one for MCC History layout Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.