Hello,
Well it been a while when i released scripts, so i made this to my server and i thougt about share it aswell. So other could get use of this system. It is self explanatory, meaning that people who is not invited to the house cannot trash the house or people who is just a guest into the house cannot move items.
Go into events/events.xml and enable, by change the 0 to 1:
Then go into events/scripts/player.lua and paste this under the function:
Enjoy!
Well it been a while when i released scripts, so i made this to my server and i thougt about share it aswell. So other could get use of this system. It is self explanatory, meaning that people who is not invited to the house cannot trash the house or people who is just a guest into the house cannot move items.
Go into events/events.xml and enable, by change the 0 to 1:
Code:
<event class="Player" method="onMoveItem" enabled="1" />
Then go into events/scripts/player.lua and paste this under the function:
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
Code:
local antiTrash = true
local antiTheft = true
if antiTrash then
local tile = Tile(toPosition)
if tile and tile:hasFlag(TILESTATE_HOUSE) then
local house = tile:getHouse()
if house then
local accessList = House.getAccessList
local playerName = self:getName():lower()
if house ~= self:getHouse() and (playerName ~= accessList(house, GUEST_LIST):lower() or playerName ~= accessList(house, SUBOWNER_LIST):lower()) 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 self:getName():lower() ~= house:getAccessList(SUBOWNER_LIST):lower() then
self:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot move items from house, which you are only guest to.")
return false
end
end
end
end
Enjoy!
Last edited: