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

Hunting Area bugs

Eryn

Member
Joined
Nov 29, 2015
Messages
82
Reaction score
20
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Raa Hunting Area" version="1.0" author="Rabbcio" contact="raaevo24.pl" enabled="yes">
  <config name="RaaHunting_Area"><![CDATA[
 
    atileaid = 7555
 
    MONSTER_NAME_STORAGE = 31555
    FROM_WAVE_TIME = 20
    MONSTER_COUNT = 2
 
    GOLD_NUGGET_ID = 2157
    GOLD_NUGGET_NAME = 'gold nugget'
    GOLD_NUGGETS_MAX = 6
 
    function cleanArea(pos)
     local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
     local endpos={x=startpos.x+ARENA_LENGHT_X, y=startpos.y+ARENA_LENGHT_Y, z=startpos.z}
     for xx=startpos.x, endpos.x do
       for yy=startpos.y, endpos.y do
          local npos={x=xx, y=yy, z=pos.z}
          if getTopCreature(npos).uid ~= 0 then
            doRemoveCreature(getTopCreature(npos).uid)
          end
       end
     end
     return true
    end
 
    function checkPlayerIsIn(pos)
     local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
     local endpos={x=startpos.x+ARENA_LENGHT_X+1, y=startpos.y+ARENA_LENGHT_Y+1, z=startpos.z}
     for xx=startpos.x, endpos.x do
       for yy=startpos.y, endpos.y do
          local npos={x=xx, y=yy, z=pos.z}
          if getTopCreature(npos).uid ~= 0 then
            if isPlayer(getTopCreature(npos) == true) then
              return true
            end
          end
       end
     end
     return false
    end
 
    function teleportToArea(cid)
      local ppos = getCreaturePosition(cid)
      local npos = {x=ppos.x+CENTER_POS_FROM_PLAYER_X, y=ppos.y+CENTER_POS_FROM_PLAYER_Y, z=ppos.z}
      doTeleportThing(cid, npos, false, false)
    end
 
    function setBackTeleport(cid, count, pos)
      if cid <= 1 then
       return true
      end
      local tpos= getTownTemplePosition(getPlayerTown(cid))
      doTeleportThing(cid, tpos, false, false)
      return true
    end
 
    function getGoldNuggetPos(pos)
      return {x=pos.x, y=pos.y-1, z=pos.z}
    end
 
    function makeWave(cid, count)
      local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)
      for i=1, count do
       if monsterName~= 1 then
        monster = doCreateMonster(monsterName, getPlayerPosition(cid), false)
        registerCreatureEvent(monster.uid, monsterdeath)
       end
      end
    end
  ]]></config>
 
      <config name="huntingConfig">
        <![CDATA[
            huntingConfig = {
                [1] = {
                    fromPos = {x=1044, y=1008, z=7}, -- left top corner of event room
                    toPos = {x=1049, y=1012, z=7},
                    teleportPos = {x=1046, y=1010, z=7},

                    expireTime = 1300, -- w sekundach
                    enteryAid = 7555,
                }
            }

            configHunting = {
                storage = 25050, -- jakies wolne storage
                
                timeStorage = 45648, -- jakies wolne storage
                
                storageExh = 25051, -- jakies wolne storage
                exhaust = 1, -- seckundy

                exhaustStorage = 4546,
                exhaustTime = 10000, -- sekundy

                itemId = 2157
            }
        ]]>
    </config>
    
 
  <talkaction words='/arena' event='script'>
  <![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param, channel)
 local ppos = getCreaturePosition(cid)
 local tile = getTileItemById(ppos, 426)
 local nugget = getTileItemById(getGoldNuggetPos(ppos), GOLD_NUGGET_ID)
 
 local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)
 
 
 doPlayerSendCancel(cid, monsterName)

 if param=='demon' or not getMonsterInfo(param) then
   doPlayerSendCancel(cid, "Invalid params. Say /arena monster_name.")
   return true
 end
 if checkPlayerIsIn(ppos) == true then
   doPlayerSendCancel(cid, "This hunting area is already in use.")
   return true   
 end
 
 if nugget.type > GOLD_NUGGETS_MAX then
   doPlayerSendCancel(cid, "A lot of "..GOLD_NUGGET_NAME.."s. ["..GOLD_NUGGETS_MAX.." max]")
   return true
 end
 
 doRemoveItem(nugget.uid, nugget.type)
 setPlayerStorageValue(cid, MONSTER_NAME_STORAGE, param)
 cleanArea(ppos)
 local time = nugget.type*1000*60*10
 return true
end
]]>
</talkaction>

    <movement type="StepIn" actionid="7555" event="script">
        <![CDATA[
            domodlib("huntingConfig")

            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
        ]]>
    </movement>           
 
<talkaction words='!spawn' event='script'>
<![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param)
 if exhaustion.make(cid, 5111, FROM_WAVE_TIME) then
   makeWave(cid, MONSTER_COUNT)
 else
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait "..exhaustion.get(cid, 5111).." secs.")
 end
return true
end
]]>
</talkaction>

<event type="death" name="monsterdeath" event="script"><![CDATA[
domodlib('RaaHunting_Area')
function onDeath(cid, corpse, deathList)
doRemoveItem(corpse.uid)
end
]]>
</event>
</mod>

Bug: 36453

TFS 0.4 - did not work, could anyone help?
 
You actually cut out the error message but from what I can see you have to define these variables:
Lua:
LENGHT_FROM_PLAYER_X
LENGHT_FROM_PLAYER_Y
ARENA_LENGHT_X
ARENA_LENGHT_Y

Now what these variables mean:
LENGTH_* variables are the offset from the player to corner of the arena.
ARENA_* variables are the offset from the previous corner to the opposite corner of the arena. Basically width and height.

Combined they form a rectangular area the arena is on. You can put them under GOLD_NUGGETS_MAX.
 
No one can do it for you, we don't know how your arenas look like. Here I put the variables I was talking about and assigned some random values. It won't throw an error but also won't work correctly since the values don't reflect the real arenas. It's literally making a rectangle out of a point + width and height. I think you can manage that :)

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Raa Hunting Area" version="1.0" author="Rabbcio" contact="raaevo24.pl" enabled="yes">
  <config name="RaaHunting_Area"><![CDATA[
 
    atileaid = 7555
 
    MONSTER_NAME_STORAGE = 31555
    FROM_WAVE_TIME = 20
    MONSTER_COUNT = 2
 
    GOLD_NUGGET_ID = 2157
    GOLD_NUGGET_NAME = 'gold nugget'
    GOLD_NUGGETS_MAX = 6

    LENGHT_FROM_PLAYER_X = 3
    LENGHT_FROM_PLAYER_Y = 3
    ARENA_LENGHT_X = 5
    ARENA_LENGHT_Y = 5
 
    function cleanArea(pos)
     local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
     local endpos={x=startpos.x+ARENA_LENGHT_X, y=startpos.y+ARENA_LENGHT_Y, z=startpos.z}
     for xx=startpos.x, endpos.x do
       for yy=startpos.y, endpos.y do
          local npos={x=xx, y=yy, z=pos.z}
          if getTopCreature(npos).uid ~= 0 then
            doRemoveCreature(getTopCreature(npos).uid)
          end
       end
     end
     return true
    end
 
    function checkPlayerIsIn(pos)
     local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
     local endpos={x=startpos.x+ARENA_LENGHT_X+1, y=startpos.y+ARENA_LENGHT_Y+1, z=startpos.z}
     for xx=startpos.x, endpos.x do
       for yy=startpos.y, endpos.y do
          local npos={x=xx, y=yy, z=pos.z}
          if getTopCreature(npos).uid ~= 0 then
            if isPlayer(getTopCreature(npos) == true) then
              return true
            end
          end
       end
     end
     return false
    end
 
    function teleportToArea(cid)
      local ppos = getCreaturePosition(cid)
      local npos = {x=ppos.x+CENTER_POS_FROM_PLAYER_X, y=ppos.y+CENTER_POS_FROM_PLAYER_Y, z=ppos.z}
      doTeleportThing(cid, npos, false, false)
    end
 
    function setBackTeleport(cid, count, pos)
      if cid <= 1 then
       return true
      end
      local tpos= getTownTemplePosition(getPlayerTown(cid))
      doTeleportThing(cid, tpos, false, false)
      return true
    end
 
    function getGoldNuggetPos(pos)
      return {x=pos.x, y=pos.y-1, z=pos.z}
    end
 
    function makeWave(cid, count)
      local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)
      for i=1, count do
       if monsterName~= 1 then
        monster = doCreateMonster(monsterName, getPlayerPosition(cid), false)
        registerCreatureEvent(monster.uid, monsterdeath)
       end
      end
    end
  ]]></config>
 
      <config name="huntingConfig">
        <![CDATA[
            huntingConfig = {
                [1] = {
                    fromPos = {x=1044, y=1008, z=7}, -- left top corner of event room
                    toPos = {x=1049, y=1012, z=7},
                    teleportPos = {x=1046, y=1010, z=7},

                    expireTime = 1300, -- w sekundach
                    enteryAid = 7555,
                }
            }

            configHunting = {
                storage = 25050, -- jakies wolne storage
                
                timeStorage = 45648, -- jakies wolne storage
                
                storageExh = 25051, -- jakies wolne storage
                exhaust = 1, -- seckundy

                exhaustStorage = 4546,
                exhaustTime = 10000, -- sekundy

                itemId = 2157
            }
        ]]>
    </config>
    
 
  <talkaction words='/arena' event='script'>
  <![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param, channel)
 local ppos = getCreaturePosition(cid)
 local tile = getTileItemById(ppos, 426)
 local nugget = getTileItemById(getGoldNuggetPos(ppos), GOLD_NUGGET_ID)
 
 local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)
 
 
 doPlayerSendCancel(cid, monsterName)

 if param=='demon' or not getMonsterInfo(param) then
   doPlayerSendCancel(cid, "Invalid params. Say /arena monster_name.")
   return true
 end
 if checkPlayerIsIn(ppos) == true then
   doPlayerSendCancel(cid, "This hunting area is already in use.")
   return true   
 end
 
 if nugget.type > GOLD_NUGGETS_MAX then
   doPlayerSendCancel(cid, "A lot of "..GOLD_NUGGET_NAME.."s. ["..GOLD_NUGGETS_MAX.." max]")
   return true
 end
 
 doRemoveItem(nugget.uid, nugget.type)
 setPlayerStorageValue(cid, MONSTER_NAME_STORAGE, param)
 cleanArea(ppos)
 local time = nugget.type*1000*60*10
 return true
end
]]>
</talkaction>

    <movement type="StepIn" actionid="7555" event="script">
        <![CDATA[
            domodlib("huntingConfig")

            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
        ]]>
    </movement>           
 
<talkaction words='!spawn' event='script'>
<![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param)
 if exhaustion.make(cid, 5111, FROM_WAVE_TIME) then
   makeWave(cid, MONSTER_COUNT)
 else
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait "..exhaustion.get(cid, 5111).." secs.")
 end
return true
end
]]>
</talkaction>

<event type="death" name="monsterdeath" event="script"><![CDATA[
domodlib('RaaHunting_Area')
function onDeath(cid, corpse, deathList)
doRemoveItem(corpse.uid)
end
]]>
</event>
</mod>
 
No one can do it for you, we don't know how your arenas look like. Here I put the variables I was talking about and assigned some random values. It won't throw an error but also won't work correctly since the values don't reflect the real arenas. It's literally making a rectangle out of a point + width and height. I think you can manage that :)

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Raa Hunting Area" version="1.0" author="Rabbcio" contact="raaevo24.pl" enabled="yes">
  <config name="RaaHunting_Area"><![CDATA[

    atileaid = 7555

    MONSTER_NAME_STORAGE = 31555
    FROM_WAVE_TIME = 20
    MONSTER_COUNT = 2

    GOLD_NUGGET_ID = 2157
    GOLD_NUGGET_NAME = 'gold nugget'
    GOLD_NUGGETS_MAX = 6

    LENGHT_FROM_PLAYER_X = 3
    LENGHT_FROM_PLAYER_Y = 3
    ARENA_LENGHT_X = 5
    ARENA_LENGHT_Y = 5

    function cleanArea(pos)
     local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
     local endpos={x=startpos.x+ARENA_LENGHT_X, y=startpos.y+ARENA_LENGHT_Y, z=startpos.z}
     for xx=startpos.x, endpos.x do
       for yy=startpos.y, endpos.y do
          local npos={x=xx, y=yy, z=pos.z}
          if getTopCreature(npos).uid ~= 0 then
            doRemoveCreature(getTopCreature(npos).uid)
          end
       end
     end
     return true
    end

    function checkPlayerIsIn(pos)
     local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
     local endpos={x=startpos.x+ARENA_LENGHT_X+1, y=startpos.y+ARENA_LENGHT_Y+1, z=startpos.z}
     for xx=startpos.x, endpos.x do
       for yy=startpos.y, endpos.y do
          local npos={x=xx, y=yy, z=pos.z}
          if getTopCreature(npos).uid ~= 0 then
            if isPlayer(getTopCreature(npos) == true) then
              return true
            end
          end
       end
     end
     return false
    end

    function teleportToArea(cid)
      local ppos = getCreaturePosition(cid)
      local npos = {x=ppos.x+CENTER_POS_FROM_PLAYER_X, y=ppos.y+CENTER_POS_FROM_PLAYER_Y, z=ppos.z}
      doTeleportThing(cid, npos, false, false)
    end

    function setBackTeleport(cid, count, pos)
      if cid <= 1 then
       return true
      end
      local tpos= getTownTemplePosition(getPlayerTown(cid))
      doTeleportThing(cid, tpos, false, false)
      return true
    end

    function getGoldNuggetPos(pos)
      return {x=pos.x, y=pos.y-1, z=pos.z}
    end

    function makeWave(cid, count)
      local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)
      for i=1, count do
       if monsterName~= 1 then
        monster = doCreateMonster(monsterName, getPlayerPosition(cid), false)
        registerCreatureEvent(monster.uid, monsterdeath)
       end
      end
    end
  ]]></config>

      <config name="huntingConfig">
        <![CDATA[
            huntingConfig = {
                [1] = {
                    fromPos = {x=1044, y=1008, z=7}, -- left top corner of event room
                    toPos = {x=1049, y=1012, z=7},
                    teleportPos = {x=1046, y=1010, z=7},

                    expireTime = 1300, -- w sekundach
                    enteryAid = 7555,
                }
            }

            configHunting = {
                storage = 25050, -- jakies wolne storage
               
                timeStorage = 45648, -- jakies wolne storage
               
                storageExh = 25051, -- jakies wolne storage
                exhaust = 1, -- seckundy

                exhaustStorage = 4546,
                exhaustTime = 10000, -- sekundy

                itemId = 2157
            }
        ]]>
    </config>
   

  <talkaction words='/arena' event='script'>
  <![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param, channel)
local ppos = getCreaturePosition(cid)
local tile = getTileItemById(ppos, 426)
local nugget = getTileItemById(getGoldNuggetPos(ppos), GOLD_NUGGET_ID)

local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)


doPlayerSendCancel(cid, monsterName)

if param=='demon' or not getMonsterInfo(param) then
   doPlayerSendCancel(cid, "Invalid params. Say /arena monster_name.")
   return true
end
if checkPlayerIsIn(ppos) == true then
   doPlayerSendCancel(cid, "This hunting area is already in use.")
   return true  
end

if nugget.type > GOLD_NUGGETS_MAX then
   doPlayerSendCancel(cid, "A lot of "..GOLD_NUGGET_NAME.."s. ["..GOLD_NUGGETS_MAX.." max]")
   return true
end

doRemoveItem(nugget.uid, nugget.type)
setPlayerStorageValue(cid, MONSTER_NAME_STORAGE, param)
cleanArea(ppos)
local time = nugget.type*1000*60*10
return true
end
]]>
</talkaction>

    <movement type="StepIn" actionid="7555" event="script">
        <![CDATA[
            domodlib("huntingConfig")

            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
        ]]>
    </movement>          

<talkaction words='!spawn' event='script'>
<![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param)
if exhaustion.make(cid, 5111, FROM_WAVE_TIME) then
   makeWave(cid, MONSTER_COUNT)
else
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait "..exhaustion.get(cid, 5111).." secs.")
end
return true
end
]]>
</talkaction>

<event type="death" name="monsterdeath" event="script"><![CDATA[
domodlib('RaaHunting_Area')
function onDeath(cid, corpse, deathList)
doRemoveItem(corpse.uid)
end
]]>
</event>
</mod>

Look - Next bug
36594
 
Back
Top