Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted

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.

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