• 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!

Solved Problem with TFS 1.0 function.

dominique120

Science & Reason
Senator
Premium User
Joined
Jun 16, 2013
Messages
3,881
Solutions
3
Reaction score
1,043
Location
Númenor
I get this:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/vip/vipdoor.lua:onUse
data/global.lua:745: attempt to call field 'getResult' (a nil value)
stack traceback:
        [C]: in function 'getResult'
        data/global.lua:745: in function 'getPlayerVipDays'
        data/actions/scripts/vip/vipdoor.lua:2: in function <data/actions/script
s/vip/vipdoor.lua:1>

With this function:

Code:
function getPlayerVipDays(cid)
    local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
    if Info:getID() ~= LUA_ERROR then
    local days= Info:getDataInt("vipdays")
    Info:free()
        return days
    end
        return LUA_ERROR
end

The database has all it needs but I cant find an equivalent function that get the players accid
 
Test this
Code:
function getPlayerVipDays(cid)
    local resultId = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid))
    if resultId ~= false then
        local days = result.getDataInt(resultId, "vipdays")
        result.free(resultId)
        return days
    end
    return 0
end
 
Test this

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/vip/vipdoor.lua:onUse
data/global.lua:756: attempt to call global 'getPlayerAccountId' (a nil value)
stack traceback:
        [C]: in function 'getPlayerAccountId'
        data/global.lua:756: in function 'getPlayerVipDays'
        data/actions/scripts/vip/vipdoor.lua:2: in function <data/actions/script
s/vip/vipdoor.lua:1>

VIP door:
Code:
function onUse(cid, item, frompos, item2, topos)
if getPlayerVipDays(cid) >= 1 then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
return true
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,'Only VIP Account can go there.')
end
return true
end
 
Change 22 to MESSAGE_EVENT_ADVANCE in the textmessages.

You are just amazing, you just saved me a major headache, I replaced 68 instances of ",22," with ",MESSAGE_EVENT_ADVANCE," in notepad++ and that fixed the many debugs I was getting.

@Ninja problem solved, thanks a ton pal :)
 
Back
Top