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

having issues with this bowled fishing script tfs 1.3

fig niggy

New Member
Joined
Nov 9, 2009
Messages
21
Reaction score
1
it lets me fish up the monster
it lets me bowl the monster
the bowl has the name of the correct monster
no errors
but it wont let me unbowl the monster! any ideas or help would be much appreciated thank you



Lua:
local catchable_monsters = {
    [1] = {name = "Sheep", aid = 15500},
    [2] = {name = "Demon", aid = 15501},
    [3] = {name = "Dragon", aid = 15502}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
        return player:sendCancelMessage("You cannot use bowls inside protection zones.")
    end
  
    if item.itemid == 5928 then
        local MONSTER = {}
        for i = 1, #catchable_monsters do
            if target:getName() == catchable_monsters[i].name then
                MONSTER = catchable_monsters[i]
                break
            end
        end
      
        if not MONSTER then
            return player:sendCancelMessage("This monster cannot be bowled.")
        end
  
        if fishOwners[target:getId()] == nil then
            return player:sendCancelMessage("You cannot catch monsters your did not fish up or unbowl.")
        end
  
        if fishOwners[target:getId()] ~= nil and fishOwners[target:getId()] ~= player:getGuid() then
            return player:sendCancelMessage("This is not your monster to bowl.")
        end
  
    if target:remove() and item:remove() then
        local BOWL = player:addItem(5929, 1, false)
        BOWL:setAttribute('15500', MONSTER.aid)
        BOWL:setAttribute('description', "It contains a " ..MONSTER.name.. ".")
    end
  
    elseif item.itemid == 5929 then
        local MONSTER = {}
        for i = 1, #catchable_monsters do
            if item.actionid == catchable_monsters[i].aid then
                MONSTER = catchable_monsters[i]
                break
            end
        end
      
        if not MONSTER then return false end
      
        local MONS = Game.createMonster(MONSTER.name, player:getPosition())
      
        if MONS then
            if item:remove() then
                fishOwners[target:getId()] = player:getGuid()
          
                local players = Game.getPlayers()
                for k, z in ipairs(players) do
                    local G_Player = Player(z)
              
                    if G_Player and G_Player:getAccountType() >= ACCOUNT_TYPE_GAMEMASTER then
                        G_Player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Player: "..player:getName().." has released a(n) "..MONSTER.name..".")
                    end
                end
            else
                MONS:remove()
            end
        end
    end
return true
end
 
Back
Top