Jump to content
MakeWebGames

Lottery Mod


Recommended Posts

This module is not completed yet but its nearly there so ill post up the code

Module Info

Module Name: Lottery System

Module Version: v1.00

Module Creator: NonStopCoding

This module will allow users to be able to buy a lottery ticket or tickets depending on what you the game owner set max tickets to be

for the demo purposes i only used 10.

The more tickets you buy the better of a chance (kinda its still pretty much random) you have at winning

Staff members with user level of 2 can update the ticket price and set max tickets user can buy

Secured the code the best i can (please do post if you find a weak point)

SQL

You're unable to view this code.

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

 

open up your globals.php goto the very last line and add this code

You're unable to view this code.

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

 

save and close globals.php

lottery.php - (Please Remember to remove ,$allowed from line 21)

http://pastebin.com/0BRjW8an

lotto_cron.php

This file here i used mccodes v2.05b if you use lower version of mccodes this might not work for you if so remove this snippet of code and add your's from your cron file

 

You're unable to view this code.

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

 

Some Screenshots

[ATTACH=CONFIG]2087[/ATTACH][ATTACH=CONFIG]2088[/ATTACH][ATTACH=CONFIG]2089[/ATTACH]

466827181_BlockedPage.png.f7a5099625c04bc7d32b8fcdf6684179.png

playerview.png.fe88ae758fc609e3473f62d371181409.png

staffview.png.55f745f6dcecdc293e7e982d91dd5201.png

Edited by NonStopCoding
Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

This module is not completed yet but its nearly there so ill post up the code

Module Info

Module Name: Lottery System

Module Version: v1.00

Module Creator: NonStopCoding

This module will allow users to be able to buy a lottery ticket or tickets depending on what you the game owner set max tickets to be

for the demo purposes i only used 10.

The more tickets you buy the better of a chance (kinda its still pretty much random) you have at winning

Staff members with user level of 2 can update the ticket price and set max tickets user can buy

Secured the code the best i can (please do post if you find a weak point)

SQL

You're unable to view this code.

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

 

open up your globals.php goto the very last line and add this code

You're unable to view this code.

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

 

save and close globals.php

lottery.php - (Please Remember to remove ,$allowed from line 21)

http://pastebin.com/0BRjW8an

lotto_cron.php

This file here i used mccodes v2.05b if you use lower version of mccodes this might not work for you if so remove this snippet of code and add your's from your cron file

 

You're unable to view this code.

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

 

Some Screenshots

[ATTACH=CONFIG]2087[/ATTACH][ATTACH=CONFIG]2088[/ATTACH][ATTACH=CONFIG]2089[/ATTACH]

Thanks mate, works well.

Can't seem to get the cron working though..

Any suggestions?

Link to comment
Share on other sites

Then you have no visible errors and everything is running like a dream as far as i can tell. At the end of all your queries before the semi colon put in

You're unable to view this code.

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

 

Similar to this:

You're unable to view this code.

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

Link to comment
Share on other sites

Then you have no visible errors and everything is running like a dream as far as i can tell. At the end of all your queries before the semi colon put in

You're unable to view this code.

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

 

Similar to this:

You're unable to view this code.

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

Okay, will try that soon

Link to comment
Share on other sites

edit

- - - Updated - - -

 

Yeah I know

Only thing i can think of that would throw the code off is if you dont have the event_add function

check the include "config.php"; make sure that it has the global_funcs.php file included in it if not i guess this could be your problem if so heres your fixe choices

1. Add this code into your config file some place

 

You're unable to view this code.

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

 

2. copy the code below into your cron file

You're unable to view this code.

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

 

There is slim chance that this event_add function might be dfiffrent from yours but if so open up your global funcs file and find the function and copy it into the module

3. try add this to your cron

 

You're unable to view this code.

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

 

Edit: Also without the money_formatter() function the code will fail

Edited by NonStopCoding
Link to comment
Share on other sites

edit

- - - Updated - - -

 

Only thing i can think of that would throw the code off is if you dont have the event_add function

check the include "config.php"; make sure that it has the global_funcs.php file included in it if not i guess this could be your problem if so heres your fixe choices

1. Add this code into your config file some place

 

You're unable to view this code.

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

 

2. copy the code below into your cron file

You're unable to view this code.

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

 

There is slim chance that this event_add function might be dfiffrent from yours but if so open up your global funcs file and find the function and copy it into the module

3. try add this to your cron

 

You're unable to view this code.

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

 

Edit: Also without the money_formatter() function the code will fail

Still nothing

You're unable to view this code.

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

Link to comment
Share on other sites

What editor do you use? You keep getting asterisks in your code. Whatever it is uninstal it and get something better like sublime text, PHPStorm, NetBeans, or hell even NotePad++. I would prefer you get PHPStorm if you have the money or get NetBeans, that way you get some IDE functionality like code completion and better error handling inside the text editor.

Also, look into logging errors or create your own error handler, you only say you get a blank screen but we can't help you unless you tell us your error

Link to comment
Share on other sites

Also, if you use an editor, save the file, then upload the file, overwriting the existing one. Don't copy and paste it into the online code editor. To me it seems you may have an encoding format problem.

Okay thanks, I will look for one, at the moment I am using my phone, so I will look for a php editor for mobile

Link to comment
Share on other sites

Okay thanks, I will look for one, at the moment I am using my phone, so I will look for a php editor for mobile

I mix my editors up but there for windows your sony runs off android i have same phone accept a lower version mine is the Sony Xperia L the apps for php editors are pretty crap for android i must admit

Aptana Studio 3

The world’s most powerful open-source web development IDE just got better. Rebuilt from the ground-up. It's now much faster, customizable and includes new features to help you be more productive. Learn more.

download http://www.aptana.com/products/studio3/download.html

I also use notepad ++ (i only use this for mysql coding as aptana don't handle it but if you have both installed and create a file with the db extention it opens notepad++ for you )

Link to comment
Share on other sites

I mix my editors up but there for windows your sony runs off android i have same phone accept a lower version mine is the Sony Xperia L the apps for php editors are pretty crap for android i must admit

Aptana Studio 3

The world’s most powerful open-source web development IDE just got better. Rebuilt from the ground-up. It's now much faster, customizable and includes new features to help you be more productive. Learn more.

download http://www.aptana.com/products/studio3/download.html

I also use notepad ++ (i only use this for mysql coding as aptana don't handle it but if you have both installed and create a file with the db extention it opens notepad++ for you )

That right there is false advertisement and grounds for why anyone shouldnt use it.

Link to comment
Share on other sites

Still no luck with the cron...

Looks like I may have to just scrap the lottery on my game if I can't get the cron working

What error/issue are you encountering with the cron?

 

  • Cron doesn't run at all
  • Cron doesn't run at the correct time
  • Query fails
    • What fails about it?
    • Have you debugged it?
      • How did you debug it?

       

     

Link to comment
Share on other sites

What error/issue are you encountering with the cron?

 

  • Cron doesn't run at all
  • Cron doesn't run at the correct time
  • Query fails
    • What fails about it?
    • Have you debugged it?
      • How did you debug it?

       

     

Not running at all.

This is what I have

You're unable to view this code.

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

Link to comment
Share on other sites

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