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
[Release] Room On Register
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="JayC" data-source="post: 380499" data-attributes="member: 36373"><p>Hey Devbest!</p><p></p><p>So this is a dynamic room system, that is 100% random and you can add as many templates as you want. Go ahead and read each of the spoilers (Alot of information to put, so I am going to divide it up), to explain how it works and how to add them!</p><p></p><p>[SPOILER="First Step: Add It!"]</p><p>Alright, Step 1 is to add it. Here is the client code:</p><p>[CODE]<?php</p><p>// Starter</p><p>$getStats = mysql_query("SELECT null FROM `user_stats` WHERE id = '".$_SESSION['user']['id']."'");</p><p>if(mysql_num_rows($getStats) != 1){</p><p> $getRoomKit = mysql_fetch_assoc(mysql_query("SELECT * FROM room_starterkit ORDER BY RAND() LIMIT 1"));</p><p> $welcomeMessage = "Welcome " . $_SESSION['user']['username'];</p><p> mysql_query("INSERT INTO `rooms` (caption,owner,description,model_name,wallpaper,floor) VALUES ('".$welcomeMessage."', '".$_SESSION['user']['id']."', 'Welcome to Hablore', '".$getRoomKit['room_Model']."', '".$getRoomKit['room_Wallpaper']."', '".$getRoomKit['room_Floor']."') ");</p><p> $theRoomID = mysql_fetch_assoc(mysql_query("SELECT id FROM `rooms` ORDER BY `id` DESC LIMIT 1"));</p><p> mysql_query("UPDATE `users` SET `home_room` = '".$theRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'");</p><p> $getRoomItems = mysql_query("SELECT * FROM room_itemkits WHERE roomKit = '".$getRoomKit['id']."'");</p><p></p><p> while($currItem = mysql_fetch_assoc($getRoomItems)){</p><p> mysql_query("INSERT INTO `items`(user_id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('".$_SESSION['user']['id']."','".$theRoomID['id']."','".$currItem['item_BaseID']."', '".$currItem['extra_data']."', '".$currItem['x']."', '".$currItem['y']."', '".$currItem['z']."','".$currItem['rot']."', '".$currItem['wall_pos']."')");</p><p> }</p><p></p><p>}</p><p>?>[/CODE]</p><p>Explanation:</p><p>- Checks if the user has entered the client before (First login creates the user_stats), and then if the user hasn't it grabs all of the information from my created tables, and then will create the room and set their first homeroom.</p><p></p><p>[CODE]</p><p>DROP TABLE IF EXISTS `room_starterkit`;</p><p>CREATE TABLE `room_starterkit` (</p><p> `id` int(11) unsigned NOT NULL AUTO_INCREMENT,</p><p> `room_Model` varchar(50) NOT NULL,</p><p> `room_Wallpaper` varchar(50) NOT NULL,</p><p> `room_Floor` varchar(50) NOT NULL,</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB DEFAULT CHARSET=utf8;</p><p>[/CODE]</p><p>This table is for adding the layout of the room. Will explain more of this later.</p><p></p><p>[CODE]</p><p>DROP TABLE IF EXISTS `room_itemkits`;</p><p>CREATE TABLE `room_itemkits` (</p><p> `id` int(11) unsigned NOT NULL AUTO_INCREMENT,</p><p> `roomKit` int(11) NOT NULL,</p><p> `item_BaseID` int(11) NOT NULL,</p><p> `x` int(11) NOT NULL,</p><p> `y` int(11) NOT NULL,</p><p> `z` double(11,0) NOT NULL,</p><p> `rot` int(11) NOT NULL,</p><p> `wall_pos` varchar(120) NOT NULL,</p><p> `extra_data` varchar(120) NOT NULL,</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB DEFAULT CHARSET=utf8;</p><p>[/CODE]</p><p>This code will put each of the items in the room, into the new room! Will explain how to add later.</p><p>[/SPOILER]</p><p></p><p>[SPOILER="Step 2: Create The Room"]</p><p>You can build any room you would like, and how you add the information will be explained in step 3. The room should be relatively small however because each item does take up another ID in the items table; and does create more work for you (see step 3 now!)</p><p>[/SPOILER]</p><p></p><p>[SPOILER="Step 3: Putting the room in the database"]</p><p>First of all once you create the room open the room table and get the following information from the room you just created:</p><p>- Model , Wallpaper ID and the Floor ID</p><p>Then go into the table room_starterkit and add the field {ID} {Model} {Wallpaper ID} {Floor ID}</p><p></p><p>Next, go to the items table and get the following information FOR EACH ITEM IN THE ROOM:</p><p>- Item ID, X, Y, Z, ROT, wall_pos, extra_data</p><p>Add this into the room_itemkits by putting the next ID (This ID can be used if you wanted to make a housekeeping attachment to easily add each room <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /> This might come at a later release, and if I do make a nice housekeeping page I will link it on this thread. Pretty much you could have it auto grab all of this stuff from the housekeeping page by just entering the room id and have it insert all this stuff for you.)</p><p>{ID} {RoomKitID} {Item ID} {X} {Y} {Z} {ROT} {WALL_POS} {EXTRA_DATA}</p><p>Now you do not have to guess on any of this. This will all be from the item table and it will tell you exactly , its just a matter of moving it into this table so you can dynamically add this item each and every time the room is selected.</p><p>[/SPOILER]</p><p></p><p>And after you do those 3 simple steps, your room is ready to go! Repeat steps 2 - 3 and you can add more rooms! The number of rooms you can add is endless, and it will give the user a random room from this table EVERY TIME <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p><p></p><p>[SPOILER="Default Room"]</p><p>[CODE]</p><p>INSERT INTO `room_itemkits` VALUES ('1', '1', '65276', '7', '1', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('2', '1', '65313', '0', '0', '0', '0', ':w=4,4 l=24,28 l', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('3', '1', '65277', '10', '1', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('4', '1', '65277', '5', '1', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('5', '1', '65270', '10', '1', '1', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('6', '1', '65265', '5', '1', '1', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('7', '1', '65301', '5', '7', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('8', '1', '65301', '5', '9', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('9', '1', '65301', '7', '7', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('10', '1', '65301', '7', '9', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('11', '1', '906', '8', '10', '0', '6', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('12', '1', '915', '8', '9', '0', '6', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('13', '1', '915', '8', '8', '0', '6', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('14', '1', '933', '8', '7', '0', '6', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('15', '1', '897', '7', '10', '0', '0', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('16', '1', '99969', '5', '8', '0', '2', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('17', '1', '89985', '5', '8', '1', '2', ' ', ' ');</p><p>INSERT INTO `room_itemkits` VALUES ('18', '1', '171', '5', '7', '0', '2', ' ', ' ');</p><p></p><p>[/CODE]</p><p>[CODE]INSERT INTO `room_starterkit` VALUES ('1', 'model_bc_274', '606', '110');[/CODE]</p><p>[/SPOILER]</p><p></p><p>Well hope you guys enjoy the release, leave a like and a comment! I do not have any images because this project was built on something that is no longer opened <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /> Leave your comments below with some screenshots of some amazing rooms you built!</p><p></p><p></p><p>VERSION 2:</p><p></p><p>[CODE]DROP TABLE IF EXISTS `room_starters`;</p><p>CREATE TABLE `room_starters` (</p><p> `id` int(11) unsigned NOT NULL AUTO_INCREMENT,</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB DEFAULT CHARSET=utf8;</p><p></p><p><?php</p><p>// Starter</p><p>$getStats = mysql_query("SELECT null FROM `user_stats` WHERE id = '".$_SESSION['user']['id']."'");</p><p>if(mysql_num_rows($getStats) != 1){</p><p> $randomRoomID = mysql_fetch_assoc(mysql_query("SELECT `id` FROM room_starters ORDER BY RAND() LIMIT 1"));</p><p></p><p> $getRoom = mysql_fetch_assoc(mysql_query("SELECT * FROM `rooms` WHERE id = '".$randomRoomID['id']."' LIMIT 1"));</p><p></p><p> $starterCaption = "Welcome " . $_SESSION['user']['username'];</p><p> mysql_query("INSERT INTO `rooms` (roomtype, caption, owner, description, model_name, wallpaper, floor, wallthick, floorthick, allow_hidewall) VALUES ('public','".$starterCaption."','".$_SESSION['user']['id']."','Welcome to iHabbo','".$getRoom['model_name']."','".$getRoom['wallpaper']."','".$getRoom['floor']."','".$getRoom['wallthick']."','".$getRoom['floorthick']."','".$getRoom['allow_hidewall']."')");</p><p></p><p> $lastRoomID = mysql_fetch_assoc(mysql_query("SELECT id FROM rooms ORDER BY `id` DESC LIMIT 1"));</p><p> mysql_query("UPDATE `users` SET `home_room` = '".$lastRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'");</p><p> $getItems = mysql_query("SELECT * FROM `items` WHERE `room_id` = '".$randomRoomID['id']."'");</p><p></p><p> while($CurItem = mysql_fetch_assoc($getItems)){</p><p> mysql_query("INSERT INTO `items` (user_id, room_id, base_item, extra_data, x, y, z, rot, wall_pos) VALUES ('".$_SESSION['user']['id']."','".$lastRoomID['id']."','".$CurItem['base_item']."','".$CurItem['extra_data']."','".$CurItem['x']."','".$CurItem['y']."','".$CurItem['z']."','".$CurItem['rot']."','".$CurItem['wall_pos']."')");</p><p> }</p><p></p><p>}</p><p></p><p>?>[/CODE]</p><p>- JayCustom</p></blockquote><p></p>
[QUOTE="JayC, post: 380499, member: 36373"] Hey Devbest! So this is a dynamic room system, that is 100% random and you can add as many templates as you want. Go ahead and read each of the spoilers (Alot of information to put, so I am going to divide it up), to explain how it works and how to add them! [SPOILER="First Step: Add It!"] Alright, Step 1 is to add it. Here is the client code: [CODE]<?php // Starter $getStats = mysql_query("SELECT null FROM `user_stats` WHERE id = '".$_SESSION['user']['id']."'"); if(mysql_num_rows($getStats) != 1){ $getRoomKit = mysql_fetch_assoc(mysql_query("SELECT * FROM room_starterkit ORDER BY RAND() LIMIT 1")); $welcomeMessage = "Welcome " . $_SESSION['user']['username']; mysql_query("INSERT INTO `rooms` (caption,owner,description,model_name,wallpaper,floor) VALUES ('".$welcomeMessage."', '".$_SESSION['user']['id']."', 'Welcome to Hablore', '".$getRoomKit['room_Model']."', '".$getRoomKit['room_Wallpaper']."', '".$getRoomKit['room_Floor']."') "); $theRoomID = mysql_fetch_assoc(mysql_query("SELECT id FROM `rooms` ORDER BY `id` DESC LIMIT 1")); mysql_query("UPDATE `users` SET `home_room` = '".$theRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'"); $getRoomItems = mysql_query("SELECT * FROM room_itemkits WHERE roomKit = '".$getRoomKit['id']."'"); while($currItem = mysql_fetch_assoc($getRoomItems)){ mysql_query("INSERT INTO `items`(user_id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('".$_SESSION['user']['id']."','".$theRoomID['id']."','".$currItem['item_BaseID']."', '".$currItem['extra_data']."', '".$currItem['x']."', '".$currItem['y']."', '".$currItem['z']."','".$currItem['rot']."', '".$currItem['wall_pos']."')"); } } ?>[/CODE] Explanation: - Checks if the user has entered the client before (First login creates the user_stats), and then if the user hasn't it grabs all of the information from my created tables, and then will create the room and set their first homeroom. [CODE] DROP TABLE IF EXISTS `room_starterkit`; CREATE TABLE `room_starterkit` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `room_Model` varchar(50) NOT NULL, `room_Wallpaper` varchar(50) NOT NULL, `room_Floor` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; [/CODE] This table is for adding the layout of the room. Will explain more of this later. [CODE] DROP TABLE IF EXISTS `room_itemkits`; CREATE TABLE `room_itemkits` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `roomKit` int(11) NOT NULL, `item_BaseID` int(11) NOT NULL, `x` int(11) NOT NULL, `y` int(11) NOT NULL, `z` double(11,0) NOT NULL, `rot` int(11) NOT NULL, `wall_pos` varchar(120) NOT NULL, `extra_data` varchar(120) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; [/CODE] This code will put each of the items in the room, into the new room! Will explain how to add later. [/SPOILER] [SPOILER="Step 2: Create The Room"] You can build any room you would like, and how you add the information will be explained in step 3. The room should be relatively small however because each item does take up another ID in the items table; and does create more work for you (see step 3 now!) [/SPOILER] [SPOILER="Step 3: Putting the room in the database"] First of all once you create the room open the room table and get the following information from the room you just created: - Model , Wallpaper ID and the Floor ID Then go into the table room_starterkit and add the field {ID} {Model} {Wallpaper ID} {Floor ID} Next, go to the items table and get the following information FOR EACH ITEM IN THE ROOM: - Item ID, X, Y, Z, ROT, wall_pos, extra_data Add this into the room_itemkits by putting the next ID (This ID can be used if you wanted to make a housekeeping attachment to easily add each room :) This might come at a later release, and if I do make a nice housekeeping page I will link it on this thread. Pretty much you could have it auto grab all of this stuff from the housekeeping page by just entering the room id and have it insert all this stuff for you.) {ID} {RoomKitID} {Item ID} {X} {Y} {Z} {ROT} {WALL_POS} {EXTRA_DATA} Now you do not have to guess on any of this. This will all be from the item table and it will tell you exactly , its just a matter of moving it into this table so you can dynamically add this item each and every time the room is selected. [/SPOILER] And after you do those 3 simple steps, your room is ready to go! Repeat steps 2 - 3 and you can add more rooms! The number of rooms you can add is endless, and it will give the user a random room from this table EVERY TIME :) [SPOILER="Default Room"] [CODE] INSERT INTO `room_itemkits` VALUES ('1', '1', '65276', '7', '1', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('2', '1', '65313', '0', '0', '0', '0', ':w=4,4 l=24,28 l', ' '); INSERT INTO `room_itemkits` VALUES ('3', '1', '65277', '10', '1', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('4', '1', '65277', '5', '1', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('5', '1', '65270', '10', '1', '1', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('6', '1', '65265', '5', '1', '1', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('7', '1', '65301', '5', '7', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('8', '1', '65301', '5', '9', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('9', '1', '65301', '7', '7', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('10', '1', '65301', '7', '9', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('11', '1', '906', '8', '10', '0', '6', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('12', '1', '915', '8', '9', '0', '6', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('13', '1', '915', '8', '8', '0', '6', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('14', '1', '933', '8', '7', '0', '6', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('15', '1', '897', '7', '10', '0', '0', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('16', '1', '99969', '5', '8', '0', '2', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('17', '1', '89985', '5', '8', '1', '2', ' ', ' '); INSERT INTO `room_itemkits` VALUES ('18', '1', '171', '5', '7', '0', '2', ' ', ' '); [/CODE] [CODE]INSERT INTO `room_starterkit` VALUES ('1', 'model_bc_274', '606', '110');[/CODE] [/SPOILER] Well hope you guys enjoy the release, leave a like and a comment! I do not have any images because this project was built on something that is no longer opened :) Leave your comments below with some screenshots of some amazing rooms you built! VERSION 2: [CODE]DROP TABLE IF EXISTS `room_starters`; CREATE TABLE `room_starters` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; <?php // Starter $getStats = mysql_query("SELECT null FROM `user_stats` WHERE id = '".$_SESSION['user']['id']."'"); if(mysql_num_rows($getStats) != 1){ $randomRoomID = mysql_fetch_assoc(mysql_query("SELECT `id` FROM room_starters ORDER BY RAND() LIMIT 1")); $getRoom = mysql_fetch_assoc(mysql_query("SELECT * FROM `rooms` WHERE id = '".$randomRoomID['id']."' LIMIT 1")); $starterCaption = "Welcome " . $_SESSION['user']['username']; mysql_query("INSERT INTO `rooms` (roomtype, caption, owner, description, model_name, wallpaper, floor, wallthick, floorthick, allow_hidewall) VALUES ('public','".$starterCaption."','".$_SESSION['user']['id']."','Welcome to iHabbo','".$getRoom['model_name']."','".$getRoom['wallpaper']."','".$getRoom['floor']."','".$getRoom['wallthick']."','".$getRoom['floorthick']."','".$getRoom['allow_hidewall']."')"); $lastRoomID = mysql_fetch_assoc(mysql_query("SELECT id FROM rooms ORDER BY `id` DESC LIMIT 1")); mysql_query("UPDATE `users` SET `home_room` = '".$lastRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'"); $getItems = mysql_query("SELECT * FROM `items` WHERE `room_id` = '".$randomRoomID['id']."'"); while($CurItem = mysql_fetch_assoc($getItems)){ mysql_query("INSERT INTO `items` (user_id, room_id, base_item, extra_data, x, y, z, rot, wall_pos) VALUES ('".$_SESSION['user']['id']."','".$lastRoomID['id']."','".$CurItem['base_item']."','".$CurItem['extra_data']."','".$CurItem['x']."','".$CurItem['y']."','".$CurItem['z']."','".$CurItem['rot']."','".$CurItem['wall_pos']."')"); } } ?>[/CODE] - JayCustom [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[Release] Room On Register
Top