Skip to main content

getRoomAccess

exports["RiP-Hotels"]:getRoomAccess(xPlayer, hotelID, roomID) 

This function checks if a player has access to a certain room. This is the case if the player:

  • owns the business and unlocked the room
  • owns the room as a guest
  • was invited to the room
  • raided the room successfully

Arguments

NameTypeOptionalExplenation
xPlayerESX PlayerNoThe ESX xPlayer object from ESX.GetPlayerFromId
hotelIDIntegerNoHotel id
roomIDIntegerNoHotel room id

Returned Boolean

Returns true if player can access the room, otherwise it'll return false

Example

local xPlayer = ESX.GetPlayerFromId(1)
local xAccess = exports["RiP-Hotels"]:getRoomAccess(xPlayer, 1, 101)

print("player 1 has "..(xAccess and "access" or "no access").." to room 101")