• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

check room

theduck

Member
Joined
Dec 6, 2018
Messages
246
Reaction score
20
Code:
local function checkPlayers(centerroom, rangeX, rangeY)
    local spectators = Game.getSpectators(centerroom, false, false, rangeX, rangeX, rangeY, rangeY)
    for _, spec in ipairs(spectators) do
        if spec:isPlayer() then
            return true
        end
    end
    return false
end
    
       if   checkPlayers(config.centerroom, config.rangeX, config.rangeY)  then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'There is someone in the room.')
            return true
        end

I would like to have a limit on the function up to 5 players in the room he lets in more than 5 he informs that the room is full[/code]
 
Last edited:
Solution
Lua:
local pos = Position(31869, 32335, 10)
local spectators = Game.getSpectators(pos, false, false, 15, 15, 15, 15)
for i = 1, #spectators do
    local spectator = spectators[i]
    if spectator:isMonster() then
        player:sendCancelMessage('yh')
    end
end
Code:
    local spectators = Game.getSpectators(Position(31869, 32335, 10), false, false, 15,15)
    for _, spec in ipairs(spectators) do
        if spec:isMonster() then
                     
            player:sendCancelMessage('mob in roon')
            else
            player:sendCancelMessage('no mob')
  return true
    
end    
end
end
even with 1 monster in the middle of the room as x says he has no mob as x says he has[/code]
 
Last edited:
Lua:
local pos = Position(31869, 32335, 10)
local spectators = Game.getSpectators(pos, false, false, 15, 15, 15, 15)
for i = 1, #spectators do
    local spectator = spectators[i]
    if spectator:isMonster() then
        player:sendCancelMessage('yh')
    end
end
 
Solution
Back
Top