Jump to content
MakeWebGames

[mccode v2] Donator and Non-Donator Lottery


Recommended Posts

Posted

Well I was thinking that it was my time to contribute my first mod to the site. I have seen marvelous additions by people like illusions and I would like to try to learn from them.

Something similar has been done already, but this version has a bit of a tweak.

The first thing you need to do is create 2 items

- Lottery Ticket for Donators

- Lottery Ticker for non-Donators

You can call them whatever you want of course. The reason I chose to put them as item is so the user can decide when to use the purchased lottery ticket.

Right so lets give a go shall we. BTW, in my game, Underground Evolution, we do not use crystals, I have called them credits. So, you will need to change this in the code so it will work.

I hope you like it, so enjoy it.

Lottery for Donators

create a file called lottery.php (This is for your donations)

 

You're unable to view this code.

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

 

create a file called ipn_lot.php

 

You're unable to view this code.

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

 

*Note on this last file, if you see in the "INSERT INTO inventory" on the last line. You need to modify '115' to the id of the item Lottery Donator.

 

create a flie called lotterydone.php

You're unable to view this code.

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

 

create a file called lotterytick.php

 

You're unable to view this code.

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

 

create a file called buylottery.php

 

You're unable to view this code.

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

 

*Note on this last file, if you see in the "INSERT INTO inventory" on the last line. You need to modify '116' to the id of the item Lottery Non Donator.

 

SQL Stuff

create a table called lottery

 

You're unable to view this code.

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

 

create a table called lottery_accepted

 

You're unable to view this code.

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

 

Add 2 entries in your table USERS

ALTER TABLE `users` ADD `lottery` VARCHAR( 1 ) NOT NULL DEFAULT '0';

ALTER TABLE `users` ADD `lotterycap` VARCHAR( 2 ) NOT NULL DEFAULT '10';

Finally add to your explore.php the option to buy lottery tickets for your Non-Donatos

 

find in explore.php where it says

You're unable to view this code.

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

 

and add below it

You're unable to view this code.

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

 

Hmm I think that is it...I do not think I have forgotten anything. I hope you enjoy it as much as I did making it. Cheers!

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Re: Donator and Non-Donator Lottery [V2]

LOL I knew I forgot something. The CRON!

I have created it monthly, but you can change it to anything you prefer.

create a file cron_monthly.php

 

You're unable to view this code.

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

 

You are probably wondering why I have not used the event_add function.....well for some reason that i could not figure out yet, the function does not work to well in crons.. So I have put them directly. Anyways sorry for forgetting it b4. :)

Posted

Re: Donator and Non-Donator Lottery [V2]

For the non-donators it is all in the code I posted above. The donators lottery is only if they purchase the tickets through paypal, whereas for the people that do not want to use RL money, they can buy them with credits (crystals) in the explore.php

Posted

Re: Donator and Non-Donator Lottery [V2]

lol yer their is

o and by the way how do you do the cron things im confuseed how i run a week cron i know how to do a min and hour and day cron but not week

Posted

Re: Donator and Non-Donator Lottery [V2]

 

lol yer their is

o and by the way how do you do the cron things im confuseed how i run a week cron i know how to do a min and hour and day cron but not week

well it depends on your host. On my host it is pretty simple, All I do is follow a gui, but if u need to do it unix.

It would be like this

0 3 * * 1 <----- Every monday at 3 am in the morning for example,

Posted

Re: Donator and Non-Donator Lottery [V2]

Okay i Seen

 

You're unable to view this code.

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

 

selects 1 user duhh lol

and how you use tickets / valadate them for the draw and

will i have to change credits to crystals ? and lol

i see no quirey taking the tickets off them in the cron ?

Posted

Re: Donator and Non-Donator Lottery [V2]

 

Okay i Seen

 

You're unable to view this code.

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

 

selects 1 user duhh lol

and how you use tickets / valadate them for the draw and

will i have to change credits to crystals ? and lol

i see no quirey taking the tickets off them in the cron ?

LOL :)

well. The way I made the mod was to create 2 items. I called them Donator Lottery Ticket & Lottery Tickets

So, when you buy a lottery ticket it will send you the item yo your inventory. In order for it to be available for the monthly cron, u need to use the item.

Now regarding the draw it self, at the end of the month it randomly selects 1 ticket and will send the credits (crystals) to the winners.

Posted

Re: Donator and Non-Donator Lottery [V2]

OH MAN!!! YOU ARE RIGHT! I forgot to add the item creating section. My bad.. Here it is

staff_items.php find

 

You're unable to view this code.

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

 

and paste underneath

You're unable to view this code.

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

 

*note you will have to do this under each effect. There are 3 by default

next find this line

 

You're unable to view this code.

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

 

and replace with

 

You're unable to view this code.

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

 

now for the itemuse.php

*Remember that in my table I am using items 115 & 116. Your items will most likely have a different id number

find where it says

You're unable to view this code.

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

 

and paste underneath

 

You're unable to view this code.

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

 

and hopefully I have not forgotten anything else. hehe

Posted

Re: Donator and Non-Donator Lottery [V2]

ColdK, for your cron mate, if you wish to run it on a daily cron, or weekly, Just add that cron code into cron_day.php or cron_week.php ... That way the one specfic file for the cron isnt sitting in your files taking up space.

Posted

Re: Donator and Non-Donator Lottery [V2]

okay im confussed i set the donator ticket to value one lottery and then used it it didnt updaye anything not even how many tickets have been baught or nothing only thing it updated is the lottery number in the users table

Posted

Re: Donator and Non-Donator Lottery [V2]

you dont need to use the itemuse bit cause its already in the item effect to update the lotteery by 1

why dont it say that 0 lotto tickets have been baught when they have and i used them still not showing that any have been baught where it says total tickets baught 0 not budging thanks

Posted

Re: Donator and Non-Donator Lottery [V2]

The reason I am making them as items, is so other players can sell them in the market or whatever. Hence the itemuse.

 

When u use them it automatically inserts a line in the lottery table. Did you modify anything in the code besides the credits/crystals ?

Posted

Re: Donator and Non-Donator Lottery [V2]

d00d I was really half asleep when i posted this.. yes there is something in day cron.

in your daily cron file find

You're unable to view this code.

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

 

paste this under

You're unable to view this code.

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

 

Thanks Castle

Posted

Re: Donator and Non-Donator Lottery [V2]

i tryed to add the item use bit and i got a error when i used it ill post it ina bit

i only changed credits to crystal and thats that i seen the main thing so you use the ticked in item use where it inserts that will solve my problem ithink it was somiting like

unxepected { or i think it was }at line 182

}

}

$h endpage Blah lol;

php?>

Posted

Re: Donator and Non-Donator Lottery [V2]

hehe i think u cut a bit too much :)

I would try to copy/paste it from scratch

then do a fing/replace for

Credit and make it Crystal

credit and make it crystal

-case sensitive-

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