findHotelRoom
exports["RiP-Hotels"]:findHotelRoom(hotelID, roomID, extendedData)
This function returns all registered rooms. If the hotel (business) is owned all unlocked rooms are registered, otherwise all booked rooms
Arguments
Name | Type | Optional | Explenation |
---|---|---|---|
hotelID | Integer | No | Hotel id |
roomID | Integer | No | Hotel room id |
extendedData | Boolean | Yes | Returns the whole room data object if enabled (not room config object) |
Returned Object
If the room is not registered it will return the room's config object.
If extendedData
is not enabled it will return the room's table index which is not useful for you since this is an internal table
Name | Type | Explenation |
---|---|---|
price | Integer|Nil | Price per night (nil if business is not owned) |
guest | Table | Nil |
storage | Table | Storage objects (name , count ) |
safe | Table | Safe (money) objects (name , count ) |
rating | Object | Nil |
upgrades | Object | Upgrade table with name as key and level as value |
Example
local roomData = exports["RiP-Hotels"]:findHotelRoom(1, 101, true)
print(json.encode(roomData))
print("room 101 is "..(roomData.upgrades and "registered" or "not registered"))