Jump to content
MakeWebGames

Recommended Posts

Posted

Well I seen quite a few lottery mods on this site, but not one of them was bugles, and lacked some easy to implement features. So I decided to make my own, and post it for free so everyone can use it

This is a money, and crystals/points lottery. (Please note, they are called points in my game, but it can be easily changed!)

SQLS:

[mysql]CREATE TABLE IF NOT EXISTS `moneylotto` (

`ticketid` int(11) NOT NULL auto_increment,

`userid` int(11) NOT NULL,

PRIMARY KEY (`ticketid`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `pointslotto` (

`ticketid` int(11) NOT NULL auto_increment,

`userid` int(11) NOT NULL,

PRIMARY KEY (`ticketid`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `moneylottowinners` (

`id` int(11) NOT NULL auto_increment,

`winner` int(11) NOT NULL,

`amount` int(11) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `pointslottowinners` (

`id` int(11) NOT NULL auto_increment,

`winner` int(11) NOT NULL,

`amount` int(11) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

[/mysql]

lotterycron.php

You're unable to view this code.

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

 

lottery.php

You're unable to view this code.

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

 

pointslottery.php

You're unable to view this code.

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

 

Make lotterycron.php to run every week at 9PM, link lotter.php, and pointslottery.php

and your done!

Any bugs, feel free to post and ill do my best to fix them up.

Posted
Why are you mixing the hardcore php commands with the mccodes class commands if you get me?

Nope lol. I dont get you. Can you explain to me a little more? Give me an example of whats not quite right?

Posted

Your coding is very untidy and you are persistent throughout the mod..

Good attempt Just try and be persistent

ie

using print and echo... pick one and stick with it throughout the script

referring to mysql_ then going to $db-> pick one and go with it

Posted
what difference does it make? Its just the way I do it.

Also, whats "('ima n00b')" all about?

There is difference in the speeds in mccodes db class & mysql.

It looks messier

+ I suspect the ima n00b is dannys way of saying do you see what i mean

Posted

Ok thanks for pointing those points out! Ive updated the original post with a more consistent code ;)

It still looks a bit messy, as I don't use tab spaces... (not really sure where to put tab spaces tbh lol)

Posted
what difference does it make? Its just the way I do it.

Also, whats "('ima n00b')" all about?

There is difference in the speeds in mccodes db class & mysql.

It looks messier

+ I suspect the ima n00b is dannys way of saying do you see what i mean

Lol?

It's just a class, there is nothing wrong with the way he's doing it.

How will it effect anything?

$db->query is just mysql_query, all it really does is add or(die()) on then end.

Posted
Thats not the point, the point is he keeps jumping from on to the other, like a b00b, yeh, it should be n00b, but i cant say that, so just replace it ;)

I replaced it. But what really matters? the user experience? Or your experience looking over the code? Not as if users in your game are going to be asking to view your codes to make sure it has $db-> instead of mysql_ are they?

Posted
Hmm..

I know that many people use different ways of coding(Cleaning) and such, I use a type of 'lining'.

You're unable to view this code.

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

Apart from the obvious errors, that's going to take a considerably greater amount of time to type than either tabbing or not.

Posted

You dont get the point that im trying to tell you danny.

Players that play your game arnt going to be abel to see your code. So why does it really matter what your code is lke... You could make the mod I have posted as clean as you want. But it aint gona change what what the player in the game see's.

Now lets get back on topic now... Is there any bugs/errors in the mod that would need fixed?

or is everything good?

Posted
Now lets get back on topic now

The topic is this mod, im talking about the mod, your not. -.-

It will probabbly work, but yeh, the fact theres 100000s of others, ima let you figgure the rest out ;)

Posted

Nice mod :)

Also about your comment about tabbing.

When I first started I did not use tabs...i did not see why i would need to but after coding numerous features for my game I have realized how special tabbing can actually be.

If the script is relatively small, then tabbing is not of much use tbh but when the script begins to be pretty large then tabbing would be a good method to use.

Tabbing simply allows you to sift through code and recognize regions of the code with greater ease..

I personally use tabbing for code between functions so i can easily tell where one function ends and the next begins...

also its good to use tabbing on code in between brackets..

 

You're unable to view this code.

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

 

With the method above you can easily recognize what code is between what brackets. This extremely helpful when there is a lot of code in between the brackets.

Everyone has there own method of tabbing i guess...this is simply mine...

Its also not bad to add comments in the script as well...

The entire point of tabbing/comments is so that you or someone else can easily look through the script and make necessary changes...

Hope that helps you understand about tabbing and when its appropriate to use them :)

Happy Holidays,

Curt

EDIT: Well my example did not come out perfect but hopefully you get the idea :)

Posted

Apart from the obvious errors, that's going to take a considerably greater amount of time to type than either tabbing or not.

I sort of forgot about that :L And for cleaning a modification only takes me 2-5 minutes. Danny and everyone else has a right to comment on the mod relating to what ever. Needs to be re-done, what else you can use, or little tips(Which they have done). But non the less it's a free modification for the community and well done on it. :)

Posted

Actually your picking at something that could in fact be better. $db->query adds something over mysql_query (even if it's just OR die(mysql_error()); ) It's still something, since $db->num_rows adds nothing to mysql_num_rows() All you're doing is calling a class function to call a php function what's the point? I could be wrong not looked at v2's class in some time, however I do believe nothing is added.

As for the player + developer thing he is right, as long as it works, and is relatively fast for slow connection users they won't care.

As for tabbing get an IDE and it's done automatically for you. :whistling:

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