Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
Loot Crate System Optimized
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Queso" data-source="post: 439951" data-attributes="member: 72618"><p>Hello <strong>DevBest</strong>, today I will be re-releasing a small addon which I made for my old hotel a couple months ago, in this version, you can select which items you want to be in the loot crates via the database and also it has logs for you to check.</p><p>This script is basically just a system that allows a player to buy a crate which can contain items that have the value set to 1 in the database.</p><p>Add this where ever you want the crates to be bought at:</p><p>[PHP]<center></p><p> <b>Loot Crates</b> are boxes that you can purchase, and they can contain various items, such as rares, diamonds, and even badges!<br></p><p> Loot crates cost <b>50</b> diamonds!<br></p><p> <img src="{url}/assets/images/loot_crate.png"><br></p><p> <?php</p><p> $lootcrate = mysql_fetch_assoc(mysql_query("SELECT `vip_points`,`lootcrates_bought` FROM `users` WHERE `id` = '".$_SESSION['user']['id']."'"));</p><p> ?></p><p> <?php</p><p> $userstuff = mysql_query("SELECT * FROM `users` WHERE id='".$_SESSION['user']['id']."'");</p><p> $crate = mysql_query("SELECT id FROM furniture WHERE loot_crate = '1' ORDER BY RAND() LIMIT 1");</p><p> while ($selectcrate= mysql_fetch_array($crate)){</p><p> while ($onlineuser= mysql_fetch_array($userstuff)){</p><p> if ($onlineuser['online'] == 0){</p><p> if(isset($_POST['lootCrate'])){</p><p> if($lootcrate['vip_points'] >= 50){</p><p> $iDs = rand(0,9594553674);</p><p> mysql_query("INSERT INTO `crate_logs` (`username`, `userid`, `item_id`) VALUES ('".$_SESSION['user']['username']."', '".$_SESSION['user']['id']."', '".$selectcrate['id']."')");</p><p> mysql_query("INSERT INTO `items` (`id`, `user_id`, `base_item`, `extra_data`) VALUES ('".$iDs."', '".$_SESSION['user']['id']."', '920020', 'quesoThank you for purchasing a loot crate!1154337249')");</p><p> mysql_query("UPDATE users SET `vip_points` = `vip_points` - 50 WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");</p><p> mysql_query("INSERT INTO `user_presents` (`item_id`, `base_id`, `extra_data`) VALUES ('".$iDs."', '".$selectcrate['id']."', '0')");</p><p> mysql_query("UPDATE `users` SET `lootcrates_bought` = `lootcrates_bought` +1 WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");</p><p> echo "You bought a <b>loot crate</b>, check your inventory to open your crate!<br>";</p><p> }</p><p> else{</p><p> echo "You do not have 50 diamonds to redeem for a Loot Crate!<br>";</p><p> }</p><p> }</p><p> }</p><p> else{</p><p> echo "You must log out of the client!<br>";</p><p> }</p><p> }</p><p> }</p><p> ?><br></p><p> <form method="post"></p><p> <input type="submit" name="lootCrate" value="Buy a Loot Crate"></p><p> </form></p><p> </center>[/PHP]</p><p>Next, run these queries:</p><p>[CODE]CREATE TABLE `crate_logs` (</p><p> `id` int(11) NOT NULL AUTO_INCREMENT,</p><p> `username` varchar(255) DEFAULT 'None',</p><p> `userid` int(11) DEFAULT 0,</p><p> `item_id` int(11) DEFAULT 0,</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;[/CODE]</p><p>[CODE]ALTER TABLE furniture ADD loot_crate enum('1','0') DEFAULT '0';</p><p>ALTER TABLE users ADD lootcrates_bought INT DEFAULT '0';</p><p>[/CODE]</p><p>Lastly, to make this work, you need to send yourself a gift, then go into your 'items' table and take the extra_data from the present, and change:</p><p>[PHP]quesoThank you for purchasing a loot crate!1154337249[/PHP]</p><p>to whatever was in your extra data is, and then done, loot crates should then work. To add items to lootcrates, go into the furniture table, and set the column 'loot_crate' to 1.</p></blockquote><p></p>
[QUOTE="Queso, post: 439951, member: 72618"] Hello [B]DevBest[/B], today I will be re-releasing a small addon which I made for my old hotel a couple months ago, in this version, you can select which items you want to be in the loot crates via the database and also it has logs for you to check. This script is basically just a system that allows a player to buy a crate which can contain items that have the value set to 1 in the database. Add this where ever you want the crates to be bought at: [PHP]<center> <b>Loot Crates</b> are boxes that you can purchase, and they can contain various items, such as rares, diamonds, and even badges!<br> Loot crates cost <b>50</b> diamonds!<br> <img src="{url}/assets/images/loot_crate.png"><br> <?php $lootcrate = mysql_fetch_assoc(mysql_query("SELECT `vip_points`,`lootcrates_bought` FROM `users` WHERE `id` = '".$_SESSION['user']['id']."'")); ?> <?php $userstuff = mysql_query("SELECT * FROM `users` WHERE id='".$_SESSION['user']['id']."'"); $crate = mysql_query("SELECT id FROM furniture WHERE loot_crate = '1' ORDER BY RAND() LIMIT 1"); while ($selectcrate= mysql_fetch_array($crate)){ while ($onlineuser= mysql_fetch_array($userstuff)){ if ($onlineuser['online'] == 0){ if(isset($_POST['lootCrate'])){ if($lootcrate['vip_points'] >= 50){ $iDs = rand(0,9594553674); mysql_query("INSERT INTO `crate_logs` (`username`, `userid`, `item_id`) VALUES ('".$_SESSION['user']['username']."', '".$_SESSION['user']['id']."', '".$selectcrate['id']."')"); mysql_query("INSERT INTO `items` (`id`, `user_id`, `base_item`, `extra_data`) VALUES ('".$iDs."', '".$_SESSION['user']['id']."', '920020', 'quesoThank you for purchasing a loot crate!1154337249')"); mysql_query("UPDATE users SET `vip_points` = `vip_points` - 50 WHERE username = '".$_SESSION['user']['username']."' LIMIT 1"); mysql_query("INSERT INTO `user_presents` (`item_id`, `base_id`, `extra_data`) VALUES ('".$iDs."', '".$selectcrate['id']."', '0')"); mysql_query("UPDATE `users` SET `lootcrates_bought` = `lootcrates_bought` +1 WHERE username = '".$_SESSION['user']['username']."' LIMIT 1"); echo "You bought a <b>loot crate</b>, check your inventory to open your crate!<br>"; } else{ echo "You do not have 50 diamonds to redeem for a Loot Crate!<br>"; } } } else{ echo "You must log out of the client!<br>"; } } } ?><br> <form method="post"> <input type="submit" name="lootCrate" value="Buy a Loot Crate"> </form> </center>[/PHP] Next, run these queries: [CODE]CREATE TABLE `crate_logs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT 'None', `userid` int(11) DEFAULT 0, `item_id` int(11) DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;[/CODE] [CODE]ALTER TABLE furniture ADD loot_crate enum('1','0') DEFAULT '0'; ALTER TABLE users ADD lootcrates_bought INT DEFAULT '0'; [/CODE] Lastly, to make this work, you need to send yourself a gift, then go into your 'items' table and take the extra_data from the present, and change: [PHP]quesoThank you for purchasing a loot crate!1154337249[/PHP] to whatever was in your extra data is, and then done, loot crates should then work. To add items to lootcrates, go into the furniture table, and set the column 'loot_crate' to 1. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
Loot Crate System Optimized
Top