zbizu
Legendary OT User
Got inspired by viewing one server based on 0.4 so I decided to write something like this for my ot.
What does it do?
If player is outside the house and is neither god nor its owner, he can't move item placed on edge of house(in door spaces or shop tables). This way you may show off containers (players can still use those items, they just can't move them).
If you have my house market system installed already you already use that.
Do not post that script on other forums without my permission
events.xml(just set enabled to 1)
player.lua replace this:
to this:
Prevent stealing using trade with... (newest tfs only):
creaturescripts.xml:
house_tr.lua:
login.lua:
What does it do?
If player is outside the house and is neither god nor its owner, he can't move item placed on edge of house(in door spaces or shop tables). This way you may show off containers (players can still use those items, they just can't move them).
If you have my house market system installed already you already use that.
Do not post that script on other forums without my permission
events.xml(just set enabled to 1)
<event class="Player" method="onMoveItem" enabled="1"/>
player.lua replace this:
Code:
function Player:OnMoveItem(item, count, fromPosition, toPosition)
return true
end
Code:
function Player:OnMoveItem(item, count, fromPosition, toPosition)
function isHousetile(position)
local t = Tile(position)
if t == nil then
return false
end
return t:hasFlag(TILESTATE_HOUSE)
end
if isHousetile(item:getPosition()) then -- yup, it's a housetile
if self:getAccountType() == ACCOUNT_TYPE_GOD and self:getGroup():getAccess() then -- is server admin
return true
end
if Tile(item:getPosition()):getHouse():getOwnerGuid() == self:getGuid() then -- is house owner
return true
end
if isHousetile(self:getPosition()) then -- is inside a house
return true
end
-- random player
self:sendCancelMessage("Sorry, not possible.")
return false
end
return true
end
Prevent stealing using trade with... (newest tfs only):
creaturescripts.xml:
Code:
<event type="traderequest" name="HouseTrade" script="house_tr.lua"/>
Code:
function onTradeRequest(cid,target,item)
local self = Player(cid)
if isHousetile(Item(item.uid):getPosition()) then -- is this a house
if self:getAccountType() == ACCOUNT_TYPE_GOD and self:getGroup():getAccess() then -- is server admin
return true
end
if Tile(Item(item.uid):getPosition()):getHouse():getOwnerGuid() == self:getGuid() then -- is house owner
return true
end
if isHousetile(self:getPosition()) then -- is inside a house
return true
end
-- random player
self:sendCancelMessage("This item doesn't belong to you.")
return false
end
return true
end
login.lua:
Code:
player:registerEvent("HouseTrade")
Last edited: