local function getHighestPlayer()
local result = db.getResult("SELECT `name` FROM `players` ORDER BY `level` DESC, `experience` DESC LIMIT 1")
return result.getDataString(result, "name")
end
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then
return true
end
if getPlayerName(cid) == getHighestPlayer() then
doPlayerSendCancel(cid, "You are the player with the highest level at the moment and can sit on the chair.")
doSendMagicEffect(position, CONST_ME_FIREWORK_YELLOW)
else
doTeleportThing(cid, fromPosition)
doPlayerSendCancel(cid, "Only the player with highest level can sit here. The player with the highest level is "..getHighestPlayer()..".")
end
return true
end