• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

onlook func

Cotizado

Member
Joined
May 12, 2008
Messages
320
Reaction score
7
hello is there anyone that can tell me how to get or make a script that show who is the owner of a house and/or the guild that is owning when you look at it?
 
no .. but this won't work.
Code:
local function getGuildName(id)
	local ret = false
	local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")
	if(query:getID() ~= -1) then
		ret = query:getDataString("name")
		query:free()
	end
	return ret
end

local function getPlayerGuildByGUID(guid)
	local ret = 0
	local query = db.getResult("SELECT `guild_ranks`.`guild_id` FROM `players`, `guild_ranks` WHERE `players`.`id` = " .. guid .. " AND `guild_ranks`.`id` = `players`.`rank_id` LIMIT 1;")
	if(query:getID() ~= -1) then
		ret = query:getDataInt("guild_id")
		query:free()
	end
	return ret
end

function onLook(cid, thing, position, lookDistance)
	if isItemDoor(thing.itemid) then
		local house, ret = getHouseFromPos(position), ""
		if(house) then
			local guildHall = getHouseInfo(house).guildHall
			if(house > 0) then
				ret = "It belongs to " .. (guildHall and "hall" or "house") .. " " .. getHouseInfo(house).name .. ". " .. (guildHall and "Guild " .. getGuildName(getPlayerGuildByGUID(getHouseInfo(house).owner)) or getPlayerNameByGUID(getHouseInfo(house).owner)) .. " owns this this " .. (guildHall and "hall" or "house") .. "."
			else
				ret = "It belongs to " .. (guildHall and "hall" or "house") .. " " .. getHouseInfo(house).name .. ". Nobody owns this this " .. (guildHall and "hall" or "house") .. ". It costs " .. getHouseInfo(house).price .. " gold coins."
			end		
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ret)
		end
	end
	return true
end
 
Back
Top Bottom