What is wrong?
error:
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."
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."