How can I get the name of the owner of a house? I have this script below but ownerName return false and houseOwnerId returns the player id. I'm new at lua so I would appreciate a full example. Later I will try to make it a function.
I'm using this inside a action script when a lever is pulled.
I'm using this inside a action script when a lever is pulled.
Code:
function onUse(Player, item, fromPosition, itemEx, toPosition, isHotkey)
if item.itemid == 1945 then
local tile = Tile(Position(1185, 1253, 7))
local houseTile = tile:getHouse()
local houseId = houseTile:getId()
local houseOwnerId = getHouseOwner(houseId)
local ownerName = getPlayerName(houseOwnerId)
Player:sendTextMessage(MESSAGE_EVENT_ORANGE, string.format("House name is %s", ownerName))
item:transform(1946)
elseif item.itemid == 1946 then
item:transform(1945)
end
end
Last edited: