• 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!

Hunt Arena problem

Fiester

New Member
Joined
Aug 30, 2022
Messages
22
Reaction score
2
Hey i got problem with hunt arena :) all time when i can join it ,, This Room is Full. Come Later "
i write the code of xml script :)

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if isPlayer(cid) then
if getPlayerItemCount(cid, configHunting.itemId) < 20 then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You don\'t have required item. [' .. getItemInfo(configHunting.itemId).name .. ']'), doTeleportThing(cid, fromPosition)
end

if exhaustion.check(cid, configHunting.exhaustStorage) ~= false then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must to wait a ' .. exhaustion.get(cid, configHunting.exhaustStorage) .. ' sec.'), doTeleportThing(cid, fromPosition)
end

local monsters, player = {}, false
for k, v in pairs(huntingConfig) do
if v.enteryAid == item.actionid then
for x = v.fromPos.x, v.toPos.x do
for y = v.fromPos.y, v.toPos.y do
doCleanTile({x=x, y=y, z=v.toPos.z})
local t = getTopCreature({x=x, y=y, z=v.toPos.z}).uid
if t ~= 0 then
if isMonster(t) then
table.insert(monsters, t)
else
if isPlayer(t) then
player = true
end
end
end
end
end

if not player then
doTeleportThing(cid, v.teleportPos, true)
doPlayerRemoveItem(cid, configHunting.itemId, 20)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You entered into room.')

local x = addEvent(removePlayerFromRoom, v.expireTime * 1000, cid, configHunting, huntingConfig)
doCreatureSetStorage(cid, configHunting.storage, x)
doCreatureSetStorage(cid, configHunting.timeStorage, os.time()+v.expireTime)

for _, v in ipairs(monsters) do
if isCreature(v) then
doRemoveCreature(v)
end
end
else
doTeleportThing(cid, fromPosition, true)
doPlayerSendCancel(cid, 'This room is full. Come later.')
end
break
end
end

exhaustion.set(cid, configHunting.exhaustStorage, configHunting.exhaustTime)
end
return true
end

function removePlayerFromRoom(pid, configHunting, huntingConfig)
if isPlayer(pid) then
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
doCreatureSetStorage(pid, configHunting.storage, -1)
end
end
 
In ur code at line 30 "if not player then". You aren't declaring player except for in your for loop which states that player = true.
i try it make a true but still dont work
 
Last edited:
i try it make a true but still dont work
To enter the teleport you want it to not be true, but there is nowhere you are setting it false nor nil.
That means once its true, it will always be true.

"If not player then" == "if player ~= true"
 
Back
Top