[Release] Room On Register

Mikey

mmm Hi
May 26, 2012
278
60
If the room is created and black: you have to add the room model.
If it's creating new rooms: you need to change how it tests if they are a new user by assigning a variable on the session when they register and taking that variable away first time entering the client
im using a preregistered account and now when reload everything in room just doubles
 

Joe

Well-Known Member
Jun 10, 2012
4,088
1,915
It created another room for me but stopped when I kept restarting, so that's a bit weird
 

Legend

https://habda.sh/
Jun 17, 2015
86
20
If the room is created and black: you have to add the room model.
If it's creating new rooms: you need to change how it tests if they are a new user by assigning a variable on the session when they register and taking that variable away first time entering the client
Do you have the heightmap and door position?
 

MadMonsterMan

Member
Mar 25, 2016
202
13
If the room is created and black: you have to add the room model.
If it's creating new rooms: you need to change how it tests if they are a new user by assigning a variable on the session when they register and taking that variable away first time entering the client
room loads, but theres no furniture in it?
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Another version added:

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
$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"));
$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']."','".$getItems['base_item']."','".$getItems['extra_data']."','".$getItems['x']."','".$getItems['y']."','".$getItems['z']."','".$getItems['rot']."','".$getItems['wall_pos']."')");
}

?>
Add the table, put the room ID into the table, put the php code into the client and it will just grab directly from the room!
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Thanks JayCustom! Just what I needed.


Sent from my iPhone using Tapatalk
Yeah the 2nd code was not tested though, I just coded it in notepad.
 
OH ON THE 2ND CODE THERE ISN'T A TEST TO SEE IF THERE IS A NEW USER OR NOT! TAKE THAT FROM EXAMPLE #1 OTHERWISE IT WILL MAKE A NEW ROOM EVERYTIME :)
 
Fixed The Code:

Code:
// 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']."')");
    }

}
 

OMRetros

Member
Sep 25, 2014
86
5
Yeah the 2nd code was not tested though, I just coded it in notepad.
 
OH ON THE 2ND CODE THERE ISN'T A TEST TO SEE IF THERE IS A NEW USER OR NOT! TAKE THAT FROM EXAMPLE #1 OTHERWISE IT WILL MAKE A NEW ROOM EVERYTIME :)
 
Fixed The Code:

Code:
// 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']."')");
    }

}
Hey, So I am like really confused. I tried adding in Version 2 but for some reason it doesn't work. I just put in room id of a room i previously made. Is that all I do or am i suppose to add room_itemkits aswell? A detailed answer would be appreciated!
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Hey, So I am like really confused. I tried adding in Version 2 but for some reason it doesn't work. I just put in room id of a room i previously made. Is that all I do or am i suppose to add room_itemkits aswell? A detailed answer would be appreciated!
The version one has its own shit and the version 2 has its own shit, so obviously you only add one table in version 2..
 

OMRetros

Member
Sep 25, 2014
86
5
The version one has its own shit and the version 2 has its own shit, so obviously you only add one table in version 2..
Version 2 didn't work then bro. I put in the room id I wanted to appear for all users but when i registered as new user, it still went to hotel view..
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Version 2 didn't work then bro. I put in the room id I wanted to appear for all users but when i registered as new user, it still went to hotel view..
Dude. You have to put the code to set their home room. Don't just copy and paste shit read what it's doing, you have no idea if I put a truncate line in there -_- I mean seriously.

Verify this is in there
Code:
mysql_query("UPDATE `users` SET `home_room` = '".$lastRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'");
 
Last edited:

OMRetros

Member
Sep 25, 2014
86
5
Dude. You have to put the code to set their home room. Don't just copy and paste shit read what it's doing, you have no idea if I put a truncate line in there -_- I mean seriously.

Verify this is in there
Code:
mysql_query("UPDATE `users` SET `home_room` = '".$lastRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'");
Well dude I trust you haha. Seen you release many things over time. Also tried running that but it said something about having an error in SQL syntax.
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Well dude I trust you haha. Seen you release many things over time. Also tried running that but it said something about having an error in SQL syntax.
“We always hope for the easy fix: the one simple change that will erase a problem in a stroke. But few things in life work this way. Instead, success requires making a hundred small steps go right - one after the other, no slipups, no goofs, everyone pitching in.”
,

I can only give you the tools and the basics, this is exact code copy and paste after I reworked it and it worked 100% on my hotel. Maybe you're using a different CMS that requires this to be slightly changed, or you applied the homeroom code outside of the { } or before the declaration of the variable. I can only help you so much, before you have to help yourself. If you're not willing to learn and problem solve on your own, your hotel will never make it. Guaranteed. It's time to step out of the baby shoes, and start to try to figure things out yourself. It's your hotel, fix it. All the tools are in this thread and on google.

“Solving a problem for which you know there’s an answer is like climbing a mountain with a guide, along a trail someone else has laid."
,
 

OMRetros

Member
Sep 25, 2014
86
5
“We always hope for the easy fix: the one simple change that will erase a problem in a stroke. But few things in life work this way. Instead, success requires making a hundred small steps go right - one after the other, no slipups, no goofs, everyone pitching in.”
,

I can only give you the tools and the basics, this is exact code copy and paste after I reworked it and it worked 100% on my hotel. Maybe you're using a different CMS that requires this to be slightly changed, or you applied the homeroom code outside of the { } or before the declaration of the variable. I can only help you so much, before you have to help yourself. If you're not willing to learn and problem solve on your own, your hotel will never make it. Guaranteed. It's time to step out of the baby shoes, and start to try to figure things out yourself. It's your hotel, fix it. All the tools are in this thread and on google.

“Solving a problem for which you know there’s an answer is like climbing a mountain with a guide, along a trail someone else has laid."
,
Yeah bro I guess you can only do so much to help.. I appreciate your help and effort.
 

Synapse

PogChamp
Mar 3, 2012
164
59
Great work as always @JayCustom thanks! I'm definitely going to use this. I thought of doing something similar but you beat me to it, and you probably set it up better than I would have. I modified this a bit to create a row in a table I created that stores user settings such as client pins and other settings, which prevents it from creating more than 1 room. Cheers!
 

Rebel

Spilling the tea, can't you read?🍵
Dec 24, 2015
186
161
Thank you for the release Jay. I am currently using it and I'm loving it. The only downside to me was if you're already registered before you added this code to your client, it doesn't make you a room only new users who don't have a room or a homeroom set. Is there possibly another way to make it so every user without a home room can have one made automatically? Or example if I was to set homeroom in database in the 'users' table to 0 it would read the users don't have a homeroom set and make them a starters room when they click on the client to go onto the hotel? Instead of if they don't have a room? Then of course it will update the homeroom in the database so it doesn't make a duplication of the room. [emoji848] but then of course if a user sets thing to hotelview it will make it over and over :/ damn.... Just thought of that. I will just write a script so for example if user starter_room equals 0 in the "users" table it will make them a room. So when it makes them a room it updates the starter_room in the " users" table to be 1 as in room as been made and won't duplicate. [emoji16]


Sent from my iPhone using Tapatalk
 
Last edited:

Users who are viewing this thread

Top