SRB Posted July 24, 2013 Posted July 24, 2013 Someone asked for this, so here it is. Your players can click on this once daily, and get between 2 and 5 random items at a cost of 100 crystals. SQL You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. DAILY CRON You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. CODE (random_items.php) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. LINK You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. NOTE This is untested and wrote "on the fly", so no guarantees of it not having an error, BUT if there is, post here and someone (May be me) should correct it. Quote
Razor42 Posted July 24, 2013 Posted July 24, 2013 Ncie job, quick question... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. What does TRUNCATE TABLE do? Quote
SRB Posted July 24, 2013 Author Posted July 24, 2013 Ncie job, quick question... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. What does TRUNCATE TABLE do? Empties the table and resets auto increment count to 1 Quote
Dominion Posted July 24, 2013 Posted July 24, 2013 Nice contribution. What I would say is if you have you donator packs as items (or any items simply donator only) you should add a way to avoid giving those out. Also I don't like the ORDER BY RAND(), Anyway thanks for helping someone out. :) - You must spread some Reputation around before giving it to Guest again. Quote
SRB Posted July 24, 2013 Author Posted July 24, 2013 I don't particularly like the RAND() either but I'm decorating my house still, so time isn't plentiful right now. Personally, I'd create the array of all items and then random the array. In regards to donator items, I'd assume they aren't buy able, hence the clause for itmbuyable in the query Quote
SRB Posted July 24, 2013 Author Posted July 24, 2013 RAND() removed and used PHP to parse. Also, to limit to 6, use this one (From the other post) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
SRB Posted July 24, 2013 Author Posted July 24, 2013 Updated top post. Thanks to DJKanna for pointing out that I didn't have the query to insert a row, to block them reloading a page. Quote
dnenb Posted October 13, 2013 Posted October 13, 2013 (edited) Thanks! I'm adding this to my game. The code I used: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Edited October 13, 2013 by dnenb Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.