function onUse(cid, item, frompos, item2, topos)
local storage = 2313
local players = getPlayersByAccount(getPlayerAccountId(cid))
for x = 1, #players do
if getHouseByPlayerGUID(players[x]) then
local playerPos = getCreaturePosition(cid)
if exhaustion.check(cid, storage) ~= false then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait ' .. exhaustion.get(cid, storage) .. ' seconds')
end
if getHouseByPlayerGUID(players[x]) then
doTeleportThing(cid, getHouseInfo(getHouseByPlayerGUID(players[x])).entry)
doSendMagicEffect(playerPos, CONST_ME_TELEPORT)
doSendAnimatedText(playerPos, 'Bye!', TEXTCOLOR_GREEN)
exhaustion.set(cid, storage, 10)
return true
end
if isPlayerPzLocked(cid) or getCreatureCondition(cid, CONDITION_INFIGHT) then
doSendAnimatedText(playerPos, 'PZ Locked!', TEXTCOLOR_RED)
exhaustion.set(cid, storage, 10)
end
if getHouseByPlayerGUID(players[x]) ~= nil then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You dont own a house!")
end
return true
end