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

luaGetPlayerStorageValue(). Player not found

Status
Not open for further replies.

mpa

Member
Joined
Oct 8, 2008
Messages
319
Reaction score
13
Location
Sweden
What is wrong?

error:
Code:
luaGetPlayerStorageValue(). Player not found
PHP:
local compareTime = 60 * 60 * 1000
local scroll = 1959

local currentValue = getPlayerStorageValue(cid, 9798)
    if currentValue == -1 then
        currentValue = os.time()
    end

function onUse(cid, item)
    if hasCondition(cid, CONDITION_INFIGHT) == TRUE and item.itemid == scroll then
        doPlayerSendCancel(cid, "You may not use this scroll while in-fight!")
        return FALSE
    end

    if (os.time() - currentValue) >= compareTime and hasCondition(cid, CONDITION_INFIGHT) == FALSE and item.itemid == scroll then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        doPlayerSendTextMessage(cid,19,"You have been teleported to your home town!")
        setPlayerStorageValue(cid, 9798, os.time())
    else
        doPlayerSendCancel(cid, "You can only use this scroll once every hour.")
end
return TRUE
end

Edit: When I'm on a regular player, I don't get any errors. Just cancelmessage "You can only use this scroll once every hour."
 
Code:
local currentValue = getPlayerStorageValue(cid, 9798)
    if currentValue == -1 then
        currentValue = os.time()
    end

You have to place this under onUse function
 
Status
Not open for further replies.
Back
Top