Jump to content
MakeWebGames

[mccode v2] 50 / 50 Chance Mod


Isomerizer

Recommended Posts

ohh lol forgot to tell you i did change the sql for that code just because my money one is using the original sql just change chance to tchance

CREATE TABLE `tchance` (

`logID` int( 20 ) NOT NULL AUTO_INCREMENT ,

`userID` int( 11 ) NOT NULL default '0',

`amount` int( 11 ) NOT NULL default '0',

`active` tinyint( 1 ) NOT NULL default '0',

PRIMARY KEY ( `logID` )

) ENGINE = MYISAM DEFAULT CHARSET = latin1;

Link to comment
Share on other sites

You're unable to view this code.

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

 

Changes:

* Made fields unsigned (signed auto_inc is the spawn of the devil, and signed amount is illogical)

* Removed defaults (unnecessary)

* Removed CHARSET definition (unnecessary)

* Removed number sizes (irrelevant)

* Retained field widths (record should align nicely to 128 bit boundary)

Notes:

logID is a simple 32-bit number (in fact 2^32-1).

userID is now an unsigned 32 bit number (though tbf, you will not hit 2^31 users)

amount is again unsigned allowing up to 4,294,967,295 though in practice you'd probably limit this at PHP level

active is an 8 bit number, but presumable acts like a boolean (0 or 1)

defaults widths are 10 for (unsigned) INT and 3 for (unsigned) TINYINT which is ample

default charset of the DB will be used, (though as it's all integers ... pretty much irrelevant)

Link to comment
Share on other sites

I wish my bank used unsigned integers. :P

Anyway, I'd suggest you change `amount` to SIGNED.

You may want negative values there, as it's an absolute.

And again, I'd suggest the usage of actual fix-length integers.

Because, it's like using the capacity of a T1 link to do the work of a cross-over LAN cable.

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