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
i write the code of xml script
endfunction 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