primate
Member
It is possible to avoid the use of trade?
What?It is possible to avoid the use of trade?
What?
I was also having trouble with a list with multiple names:
For me it was only working with one player on the list and that's because if you print(#accessList) you'll receive the number of characters/spaces in each name.
For examples the 2 names below are on the accessList --> #accessList = 22
jack in the box
godric
To fix that I replaced this line and used string.find:
Code:if house ~= self:getHouse() and self:getName():lower() ~= house:getAccessList(SUBOWNER_LIST):lower() then
with:
Code:if (house ~= self:getHouse() and not string.find(house:getAccessList(SUBOWNER_LIST):lower(), self:getName():lower())) then
You'll have to replace the other line that performs the same function.
local antiTrash = true
local antiTheft = true
if antiTrash then
local tile = Tile(toPosition)
print(title)
print(tile:hasFlag(TILESTATE_HOUSE))
if tile and tile:hasFlag(TILESTATE_HOUSE) then
local house = tile:getHouse()
print(house)
if house then
print(house)
local accessList = House.getAccessList
local playerName = self:getName():lower()
print(accessList)
print(house:getAccessList(SUBOWNER_LIST))
if (house ~= self:getHouse() and not string.find(house:getAccessList(SUBOWNER_LIST):lower(), "%f[%a]" .. self:getName():lower() .. "%f[%A]")) then
self:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot throw items into players houses, which you are not invited to.")
return false
end
end
end
end
if antiTheft then
local tile = Tile(fromPosition)
if tile and tile:hasFlag(TILESTATE_HOUSE) then
local house = tile:getHouse()
if house then
if (house ~= self:getHouse() and not string.find(house:getAccessList(SUBOWNER_LIST):lower(), "%f[%a]" .. self:getName():lower() .. "%f[%A]")) then
self:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot move items from house, which you are only guest to.")
return false
end
end
end
end