samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 447
- Solutions
- 3
- Reaction score
- 49
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
@Mateus Robeerto
BR: @Mateus Robeerto Não funciono não aparece a contagem regressiva o player da use no jornal dourado tem acesso e não é kikado ele desloga antes depois loga e fica com acesso permanente e da esse erro console e da erro no console não funciona local storageValue = 13741local itemID = 8981local teleportPosition = {x = 1 - Pastebin.com (https://pastebin.com/R0pnj7KF)
Lua:
[12/06/2023 16:35:47] [Error - Action Interface]
[12/06/2023 16:35:47] data/actions/scripts/access.lua:onUse
[12/06/2023 16:35:47] Description:
[12/06/2023 16:35:47] data/actions/scripts/access.lua:71: attempt to call global 'temporaryStorageIncrease' (a nil value)
[12/06/2023 16:35:47] stack traceback:
[12/06/2023 16:35:47] data/actions/scripts/access.lua:71: in function <data/actions/scripts/access.lua:34>
[12/06/2023 16:35:48] [Error - Action Interface]
[12/06/2023 16:35:48] In a timer event called from:
[12/06/2023 16:35:48] data/actions/scripts/access.lua:onUse
[12/06/2023 16:35:48] Description:
[12/06/2023 16:35:48] data/actions/scripts/access.lua:68: attempt to call global 'handleLogin' (a nil value)
[12/06/2023 16:35:48] stack traceback:
[12/06/2023 16:35:48] data/actions/scripts/access.lua:68: in function <data/actions/scripts/access.lua:67>
Lua:
local storageValue = 13741
local itemID = 8981
local teleportPosition = {x = 154, y = 51, z = 7}
local cooldownTime = 30 * 60
local animetextEffect = 67
local animetextEffectInterval = 5
local function sendBuffActiveText(cid, remainingTime)
local minutes = math.floor(remainingTime / 60)
local seconds = remainingTime % 60
doSendAnimatedText(getPlayerPosition(cid), minutes .. "m " .. seconds .. "s", animetextEffect)
if remainingTime > 0 then
addEvent(sendBuffActiveText, animetextEffectInterval * 1000, cid, remainingTime - animetextEffectInterval)
end
end
local function sendCountdownText(cid, remainingTime)
local minutes = math.floor(remainingTime / 60)
local seconds = remainingTime % 60
doSendAnimatedText(getPlayerPosition(cid), "Aguarde mais " .. minutes .. " minutos e " .. seconds .. " segundos", countdownTextEffect)
end
local function removeAccess(cid)
if isPlayer(cid) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu tempo de acesso expirou.")
doTeleportThing(cid, teleportPosition)
setPlayerStorageValue(cid, storageValue, -1)
end
end
function onUse(cid, item, frompos, item2, topos)
local lastUsageTime = getPlayerStorageValue(cid, "lastUsageTime")
local currentTime = os.time()
if lastUsageTime ~= -1 and currentTime < lastUsageTime + cooldownTime then
local remainingTime = (lastUsageTime + cooldownTime) - currentTime
sendCountdownText(cid, remainingTime)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Aguarde mais " .. math.floor(remainingTime / 60) .. " minutos e " .. remainingTime % 60 .. " segundos antes de usar novamente.")
return true
end
if getPlayerStorageValue(cid, storageValue) ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já tem acesso a essa funcionalidade.")
return true
end
local hasUnlimitedCharges = getPlayerStorageValue(cid, "hasUnlimitedCharges") == 1
if not hasUnlimitedCharges and not doPlayerRemoveItem(cid, itemID, 1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa ter o item necessário para usar essa funcionalidade.")
return true
end
local expirationTime = currentTime + (30 * 60)
setPlayerStorageValue(cid, storageValue, expirationTime)
setPlayerStorageValue(cid, "lastUsageTime", currentTime)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você ganhou acesso a essa funcionalidade por 30 minutos.")
sendCountdownText(cid, 30 * 60)
addEvent(removeAccess, cooldownTime * 1000, cid)
addEvent(function()
handleLogin(cid)
end, 1000)
temporaryStorageIncrease(cid, storageValue, 30 * 60, cooldownTime * 1000)
sendBuffActiveText(cid, 30 * 60) -- Adicionado para exibir o texto de contagem regressiva ativa
return true
end
BR: @Mateus Robeerto Não funciono não aparece a contagem regressiva o player da use no jornal dourado tem acesso e não é kikado ele desloga antes depois loga e fica com acesso permanente e da esse erro console e da erro no console não funciona local storageValue = 13741local itemID = 8981local teleportPosition = {x = 1 - Pastebin.com (https://pastebin.com/R0pnj7KF)
Last edited: