AD
tfs 1.0

Max itens por tile

Por Administrador, 17 de nov. de 2015 em Actions e Talkactions

max
itens
tile
1
1.3k
AdministradorA
17 de novembro de 2015 às 14:48

Script feito por Narko

Define um número máximo de itens em um tile.

function Player:onMoveItem(item, count, fromPosition, toPosition)
local tile = toPosition:getTile()
    if tile then -- checks if tile
        if Tile(toPosition):getItemCount() >= 6 then
            self:sendCancelMessage("Sorry, not possible.")
            return false
        end
    end
    return true
end

Se por um acaso a função getTile() não funcionar em seu servidor, utilize este:

function Player:onMoveItem(item, count, fromPosition, toPosition)
  if toPosition ~= nil
        if Tile(toPosition):getItemCount() >= 6 then
            self:sendCancelMessage("Sorry, not possible.")
            return false
        end
    end
    return true
end