Akash Posted May 30, 2009 Posted May 30, 2009 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: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then create a cron_weekly.php file and set the cron as 0 12 * * 0 You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Finally, add SQL You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. 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] Quote
Haunted Dawg Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery $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); Could become $winnerSQL = mysql_query("SELECT `userid` FROM `lottery` ORDER BY RAND() LIMIT 1"); $user = mysql_fetch_assoc($winnerSQL); Quote
Akash Posted May 30, 2009 Author Posted May 30, 2009 Re: [mc code V2]Updated Lottery $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); Could become $winnerSQL = mysql_query("SELECT `userid` FROM `lottery` ORDER BY RAND() LIMIT 1"); $user = mysql_fetch_assoc($winnerSQL); Thanks, didn't know that. Well anyone who uses this, might aswell use what HD has posted, it's more efficient :-) Quote
Akash Posted May 30, 2009 Author Posted May 30, 2009 Re: [mc code V2]Updated Lottery screenshot? 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. Quote
Assault Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery Ah, I understand. I'll try this out Quote
gurpreet Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery With the weekly cron would it be: curl gamename.com/cron_weekly.php curl gamename.com/cron_weekly.php?code=longasscodehere gamename.com/cron_weekly.php Or what? Quote
destroyer555 Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery Great mod! +1 from me :-) Quote
CrazyT Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery With the weekly cron would it be: curl gamename.com/cron_weekly.php curl gamename.com/cron_weekly.php?code=longasscodehere gamename.com/cron_weekly.php Or what? It would be..: curl http://gamename.com/cron_weekly.php?code=SOME CODE HERE Quote
gurpreet Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery +1 badgirl, HD and Akash! Quote
gurpreet Posted May 30, 2009 Posted May 30, 2009 Re: [mc code V2]Updated Lottery Screenshot, as Akash said it's basic. Quote
Assault Posted May 31, 2009 Posted May 31, 2009 Re: [mc code V2]Updated Lottery Well i found a gltich in the mod, i dunno how to fix it but should it include You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Or something simliar to this, right now you can buy a ticket but it gives you a negative money balance. Quote
gurpreet Posted May 31, 2009 Posted May 31, 2009 Re: [mc code V2]Updated Lottery Yeh >.< Just can't add it in the right place. Name:G_u_r_p_Z [1] Donator: 222 Days Left Money: $-110,000 Quote
Akash Posted May 31, 2009 Author Posted May 31, 2009 Re: [mc code V2]Updated Lottery Well i found a gltich in the mod, i dunno how to fix it but should it include You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Or something simliar to this, right now you can buy a ticket but it gives you a negative money balance. Sorry, I ALWAYS forget this. Use the file below. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
Assault Posted May 31, 2009 Posted May 31, 2009 Re: [mc code V2]Updated Lottery So im trying to make it so that users can purchase a MAX of 6 tickets a week I have the sql You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. then i think i have the weekly cron correct You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. not sure how to do it for the main file though Quote
Assault Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery Anyone sure on how to make this happen? It would be very greatly appreciated. Thanks So im trying to make it so that users can purchase a MAX of 6 tickets a week I have the sql You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. then i think i have the weekly cron correct You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. not sure how to do it for the main file though Quote
D T K Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery Anyone sure on how to make this happen? It would be very greatly appreciated. Thanks So im trying to make it so that users can purchase a MAX of 6 tickets a week I have the sql You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. then i think i have the weekly cron correct You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. not sure how to do it for the main file though That SQL would give them a default of 6 tickets ill see if i can do the Max thing Quote
Assault Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery Thanks, yeah I want them to have a Max of 6 tickets per week and refresh it weekly. Quote
D T K Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery Lottery.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Cron Weekly You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. This should work i didnt test it. My game isnt up yet :P Quote
Miniman Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery Lottery.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Cron Weekly You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. This should work i didnt test it. My game isnt up yet :P Wtf? You don't need that bit in cron weekly.... Quote
Assault Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery the die function shouldnt be in the weekly and the lottery.php file didnt work You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
D T K Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery Lottery.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Cron Weekly You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. This should work i didnt test it. My game isnt up yet :P Right lol i forgot i put it there :P anyway should work now Quote
Assault Posted June 2, 2009 Posted June 2, 2009 Re: [mc code V2]Updated Lottery the die function shouldnt be in the weekly and the lottery.php file didnt work You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
Feky Posted June 17, 2009 Posted June 17, 2009 Re: [mc code V2]Updated Lottery still dont work lol the user dosent get credited when he wins the lottery 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.