• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Small error. tfs 0.4

Hernest

New Member
Joined
Jul 26, 2010
Messages
152
Reaction score
3
Location
poland
Code:
[20:1:15.947] mysql_real_query(): SELECT COUNT(*) FROM `houses` WHERE `owner` = guid; - MYSQL ERROR: Unknown column 'guid' in 'where clause' (1054)
[20:1:15.947] [Error - Action Interface]
[20:1:15.947] data/actions/scripts/houseRune.lua:onUse
[20:1:15.947] Description:
[20:1:15.947] data/actions/scripts/houseRune.lua:13: attempt to compare number with table
[20:1:15.947] stack traceback:
[20:1:15.947] data/actions/scripts/houseRune.lua:13: in function <data/actions/scripts/houseRune.lua:2>

Any ideas how to fix it ?


Code:
local days = 10
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerStorageValue(cid,61502) > os.time()) then
        doPlayerSendCancel(cid,"Sorry, you have to wait 2 seconds to use House Item again.")
        return true
    end
    doPlayerSetStorageValue(cid,61502,os.time()+2)
    local id =getHouseFromPos(toPosition)
    if id ~= false then
        local playerGUID = getHouseOwner(id)
        local house = db.getResult("SELECT `id` FROM `players` WHERE `lastlogin` < UNIX_TIMESTAMP() - ".. days .. "*24*60*60 AND `id` = ".. playerGUID ..";")
        local dom = db.getResult("SELECT COUNT(*) FROM `houses` WHERE `owner`;")
        if domki >= 3 then
            doPlayerSendCancel(cid,"You have enough (".. dom ..") houses.")
        elseif house:getID() ~= -1 then
            setHouseOwner(id,getPlayerGUID(cid))
            doRemoveItem(item.uid)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Congratulations, the house is yours!")
            doSendMagicEffect(getCreaturePosition(cid), 31)
            doCreatureSay(cid, "House taken!", TALKTYPE_ORANGE_1)
            return true
        end
        doPlayerSendCancel(cid,"You can not get this house. The owner logged from last 10 days.")
                    doSendMagicEffect(getCreaturePosition(cid), 2)
    end
    return true
end
 
Back
Top