Jump to content
MakeWebGames

Recommended Posts

Posted

Re: [mc code V2]Updated Lottery

I have been trying to figure out how to get my players to win the money.. when the lottery is over it says that you have won the weekly lottery and you were credited $0.00 can anyone fix that please??

Posted

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.

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

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

I have 2 errors, will anyone help?

 

You have bought 1 lottery tickets. Go HomeQUERY ERROR: Unknown column 'amount' in 'field list'

Query was INSERT INTO `lottery` (id,userid, amount) VALUES (0,2, 1000)

 

QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unix_timestamp(),0,'You won the weekly lottery and were credited $')' at line 1

Query was INSERT INTO events VALUES('',,unix_timestamp(),0,'You won the weekly lottery and were credited $')

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

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

add this sql to users table

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

  • 4 months later...
  • 1 month later...
  • 3 months later...
Posted

Going through the code....

 

$lotterySQL = sprintf("SELECT * FROM `lottery` WHERE `userID` = %d",

abs((int)$userid));

 

Is wrong. In the table created its set as userid. Not userID so you will need to change that query.

 

In the cron file at the bottom where the winner is credited the money.

 

There is no query its just a sprintf

 

so either make that line a query

 

$creditSQL = mysql_query(sprintf(

 

or add underneath that line

 

mysql_query($creditSQL);

 

and it will now credit the winner.

 

Feky's version is nicer with the form option for buying more tickets at once.

Posted

Silly question :)

If one or more users have mass ammounts of cash and are able to exploit the lottery wouldnt that be unfair.

My theory is let a user buy a certain amount of tickets and it wont let them buy anymore until other players have bought some

and even then lets say joe bloggs buys 25 more tickets then others are able to buy some coz Joe has reset the ticket sales to 25 so others can buy...

Posted

Make it x amount of tickets done by how many users you have.

Maybe something like

check who has been online for a week. Grab that number x 5 and let them have a max share of the tickets.

For example

Say you have 100 users. So total 500 tickets available. Each user has a max of 5 tickets they can purchase.

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