help i got this script it works almost everything except teleports based on storages
I suspect that the error is in this part
but I already tried many things and I could not solve it if someone could help me please
this is the complete code of movements
I suspect that the error is in this part
Lua:
local superUpVariavel = SUPERUP.areas[item.actionid]
if not superUpVariavel then
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end
this is the complete code of movements
Lua:
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end
local tempo = SUPERUP.setTime * 60 * 60
local superUpVariavel = SUPERUP.areas[item.actionid]
if not superUpVariavel then
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end
if player:getStorageValue(STORAGEVALUE_SUPERUP_INDEX) == item.actionid then
return true
end
local value = SUPERUP:getCave(item.actionid)
if not value then
return false
end
local playerName = db.storeQuery(string.format("SELECT name FROM players WHERE id = %d", value.dono))
local nome = result.getDataString(playerName, "name")
if value.dono > 0 and value.tempo > 0 then
player:sendCancelMessage(string.format(SUPERUP.msg.naoDisponivel, nome, os.date("%c", value.tempo)))
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
elseif player:getStorageValue(STORAGEVALUE_SUPERUP_INDEX) >= 1 then
player:sendCancelMessage(SUPERUP.msg.possuiCave)
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
else
if player:removeItem(SUPERUP.itemID, 1) then
player:sendCancelMessage(string.format(SUPERUP.msg.disponivel, SUPERUP.setTime, SUPERUP.setTime > 1 and "horas" or "hora"))
player:getPosition():sendMagicEffect(31)
player:setStorageValue(STORAGEVALUE_SUPERUP_TEMPO, (os.time() + tempo))
player:setStorageValue(STORAGEVALUE_SUPERUP_INDEX, item.actionid)
local guid = player:getGuid()
db.query(string.format("UPDATE exclusive_hunts SET `guid_player` = %d, `time` = %s, `to_time` = %s WHERE `hunt_id` = %d", guid, os.time(), (os.time() + tempo), item.actionid))
else
player:sendCancelMessage(string.format(SUPERUP.msg.naoItem, ItemType(SUPERUP.itemID):getName()))
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
end
return true
end