Jump to content
MakeWebGames

Recommended Posts

Posted

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]

Posted

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);

Posted

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 :-)

Posted

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.

Posted

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?

Posted

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.

Posted

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.

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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....

Posted

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.

Posted

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

Posted

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.

 

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...