Erikas Kontenis
Excellent OT User
Tfs0.3.5
how to clean house after player buys it?
Like i just said !buyhouse command and house cleans?
thats what i tried but happened nothing...
owner.lua
how to clean house after player buys it?
Like i just said !buyhouse command and house cleans?
thats what i tried but happened nothing...
owner.lua
LUA:
local NO_OWNER_PHRASE = {"none", "nobody", "0"}
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local clean = true
local t = string.explode(param, ",")
if(t[2]) then
clean = getBooleanFromString(t[2])
end
local name = tostring(t[1])
if(not name) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid name specified.")
return true
end
local guid = 0
if(not table.isStrIn(name:lower(), NO_OWNER_PHRASE)) then
guid = getPlayerGUIDByName(name)
end
if(not guid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.")
return true
end
local hid = getHouseFromPos(getCreaturePosition(cid))
if(not hid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not in a house.")
return true
end
setHouseOwner(hid, guid, clean)
local home = getHouseByPlayerGUID(getPlayerGUID(cid))
doCleanHouse(home)
return true
end