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

lever boss

tibera

Active Member
Joined
Nov 9, 2014
Messages
120
Reaction score
43
Location
Governador Valadares - MG
hello, i got this script for lever boss, but is 24 hour.
any help me to edit for use with 2 hour?

LUA:
function onUse(cid, item, pos, itemEx, toPosition)
local actionid = 19006
local valueid = 3007 --store global
local dia_atual, ultimo_dia = tonumber(os.date("%d")), tonumber(getGlobalStorageValue(valueid))

    if(ultimo_dia ~= dia_atual)then
        setGlobalStorageValue(valueid,dia_atual)
        doCreateMonster("Demon Darakan", {x=1547,y=45,z=7}) -- nome do boss e posição
        doPlayerPopupFYI(cid, "O Boss Demon Darakan ressurgiu das cinzas, mate-o!!!")
    else
        doPlayerPopupFYI(cid, "[IMPORTANTE]: O Boss Demon Darakan esta morto, somente daqui 24h, nao entre no covil ou voce perde seus tokens!")
    end   
    return true
end
 
Solution
If the above case doesn't work, test here.

LUA:
function onUse(cid, item, pos, itemEx, toPosition)
    local actionid = 19006
    local valueid = 3007 -- store global
    local cooldown = 7200 -- 2 horas em segundos (2 * 60 * 60)

    local lastRespawnTime = getGlobalStorageValue(valueid)
    local currentTime = os.time()

    if (lastRespawnTime == 0 or currentTime - lastRespawnTime >= cooldown) then
        setGlobalStorageValue(valueid, currentTime)
        doCreateMonster("Demon Darakan", {x = 1547, y = 45, z = 7}) -- nome do boss e posição
        doPlayerPopupFYI(cid, "O Boss Demon Darakan ressurgiu das cinzas, mate-o!!!")
    else
        local timeLeft = cooldown - (currentTime - lastRespawnTime)
        local hoursLeft =...
LUA:
function onUse(cid, item, pos, itemEx, toPosition)
    local valueid = 3007 --store global
    local timer = 2 -- horas
    if (getGlobalStorageValue(valueid) < os.time()) then
        setGlobalStorageValue(valueid, os.time() + timer * 60 * 60)
        doCreateMonster("Demon Darakan", {x = 1547, y = 45, z = 7}) -- nome do boss e posição
        doPlayerPopupFYI(cid, "O Boss Demon Darakan ressurgiu das cinzas, mate-o!!!")
    else
        doPlayerPopupFYI(cid, "[IMPORTANTE]: O Boss Demon Darakan esta morto, somente daqui " .. timer .. "h, nao entre no covil ou voce perde seus tokens!")
    end
    return true
end
 
If the above case doesn't work, test here.

LUA:
function onUse(cid, item, pos, itemEx, toPosition)
    local actionid = 19006
    local valueid = 3007 -- store global
    local cooldown = 7200 -- 2 horas em segundos (2 * 60 * 60)

    local lastRespawnTime = getGlobalStorageValue(valueid)
    local currentTime = os.time()

    if (lastRespawnTime == 0 or currentTime - lastRespawnTime >= cooldown) then
        setGlobalStorageValue(valueid, currentTime)
        doCreateMonster("Demon Darakan", {x = 1547, y = 45, z = 7}) -- nome do boss e posição
        doPlayerPopupFYI(cid, "O Boss Demon Darakan ressurgiu das cinzas, mate-o!!!")
    else
        local timeLeft = cooldown - (currentTime - lastRespawnTime)
        local hoursLeft = math.floor(timeLeft / 3600)
        local minutesLeft = math.floor((timeLeft % 3600) / 60)
        doPlayerPopupFYI(cid, string.format("[IMPORTANTE]: O Boss Demon Darakan está morto. Ressurgirá em %d horas e %d minutos.", hoursLeft, minutesLeft))
    end

    return true
end
 
Solution
If the above case doesn't work, test here.

LUA:
function onUse(cid, item, pos, itemEx, toPosition)
    local actionid = 19006
    local valueid = 3007 -- store global
    local cooldown = 7200 -- 2 horas em segundos (2 * 60 * 60)

    local lastRespawnTime = getGlobalStorageValue(valueid)
    local currentTime = os.time()

    if (lastRespawnTime == 0 or currentTime - lastRespawnTime >= cooldown) then
        setGlobalStorageValue(valueid, currentTime)
        doCreateMonster("Demon Darakan", {x = 1547, y = 45, z = 7}) -- nome do boss e posição
        doPlayerPopupFYI(cid, "O Boss Demon Darakan ressurgiu das cinzas, mate-o!!!")
    else
        local timeLeft = cooldown - (currentTime - lastRespawnTime)
        local hoursLeft = math.floor(timeLeft / 3600)
        local minutesLeft = math.floor((timeLeft % 3600) / 60)
        doPlayerPopupFYI(cid, string.format("[IMPORTANTE]: O Boss Demon Darakan está morto. Ressurgirá em %d horas e %d minutos.", hoursLeft, minutesLeft))
    end

    return true
end
thank you, It worked!
 
Back
Top