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

RevScripts Exp eggs is bug

Joker Man

Active Member
Joined
Nov 7, 2021
Messages
106
Reaction score
27
Time runs out, the value is there, what to do guys
players can get full Double exp 100000X
Time is running out effect is present
Lua:
local potions = {
    [6542] = {needLevel = 100, rate = 0.2, duration = 1800},
    [6543] = {needLevel = 100, rate = 0.3, duration = 1800},
    [6544] = {needLevel = 100, rate = 0.4, duration = 1800},
    [6545] = {needLevel = 100, rate = 0.5, duration = 1800},
    [2328] = {needLevel = 1000, rate = 0.6, duration = 1800},
    [6541] = {needLevel = 1000, rate = 0.7, duration = 1800},
    [12599] = {needLevel = 1000, rate = 0.8, duration = 1800},
    [8300] = {needLevel = 1000, rate = 0.10, duration = 1800},
}

if not expPotions then
    expPotions = {playerData = {}}
end

function expPotions:onUse(cid, item, fromPosition, itemEx, toPosition)
    local itemId = item.itemid
    local potion = potions[itemId]
    if not potion then
        return false
    end

    if getPlayerLevel(cid) < potion.needLevel then
        doPlayerSendCancel(cid, ('Você precisa ser level %d+ para usar esta potion.'):format(potion.needLevel))
        return true
    end
    
    local guid = getPlayerGUID(cid)
    local expData = self.playerData[guid][itemId]
    if not expData then
        -- caso alguma nova exp potion seja adicionada às configuraçُes em tempo real
        -- alguns jogadores online que tentarem usar, precisarمo relogar.
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'ة necessلrio relogar para atualizar.')
        return true
    end

    local now = os.time()
    if expData.duration > now then
        doCreatureSay(cid, 'Aguarde o bônus atual acabar para usar novamente.', TALKTYPE_ORANGE_1, false, cid)
        return true
    end

    expData.rate = expData.rate + potion.rate
    expData.duration = potion.duration + now

    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ('Agora você tem +%d%% de experiência por %s.'):format(
        potion.rate * 100, string.diff(potion.duration, true)
    ))

    doRemoveItem(item.uid, 1)
    return true
end

function expPotions:onLogin(cid)
    local guid = getPlayerGUID(cid)

    self.playerData[guid] = {}
    for itemId in pairs(potions) do
        self.playerData[guid][itemId] = {rate = 0, duration = 0}
    end
    return true
end

function expPotions:getCombo(cid)
    local playerData = self.playerData[getPlayerGUID(cid)]
    local potionsCombo = 1

    if playerData then
        for itemId, expData in pairs(playerData) do
            potionsCombo = potionsCombo + expData.rate
        end
    end
    return potionsCombo
end

function expPotions:onSay(cid, words, param)
    local str = 'Experience Potion Combos:\n'

    local playerData = self.playerData[getPlayerGUID(cid)]
    if playerData then
        for itemId, expData in pairs(playerData) do
            str = str .. ('\n%s - %d%%'):format(getItemInfo(itemId).name, expData.rate * 100)
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return true
end
 
Time runs out, the value is there, what to do guys
players can get full Double exp 100000X
Time is running out effect is present
Lua:
local potions = {
    [6542] = {needLevel = 100, rate = 0.2, duration = 1800},
    [6543] = {needLevel = 100, rate = 0.3, duration = 1800},
    [6544] = {needLevel = 100, rate = 0.4, duration = 1800},
    [6545] = {needLevel = 100, rate = 0.5, duration = 1800},
    [2328] = {needLevel = 1000, rate = 0.6, duration = 1800},
    [6541] = {needLevel = 1000, rate = 0.7, duration = 1800},
    [12599] = {needLevel = 1000, rate = 0.8, duration = 1800},
    [8300] = {needLevel = 1000, rate = 0.10, duration = 1800},
}

if not expPotions then
    expPotions = {playerData = {}}
end

function expPotions:onUse(cid, item, fromPosition, itemEx, toPosition)
    local itemId = item.itemid
    local potion = potions[itemId]
    if not potion then
        return false
    end

    if getPlayerLevel(cid) < potion.needLevel then
        doPlayerSendCancel(cid, ('Você precisa ser level %d+ para usar esta potion.'):format(potion.needLevel))
        return true
    end
   
    local guid = getPlayerGUID(cid)
    local expData = self.playerData[guid][itemId]
    if not expData then
        -- caso alguma nova exp potion seja adicionada às configuraçُes em tempo real
        -- alguns jogadores online que tentarem usar, precisarمo relogar.
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'ة necessلrio relogar para atualizar.')
        return true
    end

    local now = os.time()
    if expData.duration > now then
        doCreatureSay(cid, 'Aguarde o bônus atual acabar para usar novamente.', TALKTYPE_ORANGE_1, false, cid)
        return true
    end

    expData.rate = expData.rate + potion.rate
    expData.duration = potion.duration + now

    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ('Agora você tem +%d%% de experiência por %s.'):format(
        potion.rate * 100, string.diff(potion.duration, true)
    ))

    doRemoveItem(item.uid, 1)
    return true
end

function expPotions:onLogin(cid)
    local guid = getPlayerGUID(cid)

    self.playerData[guid] = {}
    for itemId in pairs(potions) do
        self.playerData[guid][itemId] = {rate = 0, duration = 0}
    end
    return true
end

function expPotions:getCombo(cid)
    local playerData = self.playerData[getPlayerGUID(cid)]
    local potionsCombo = 1

    if playerData then
        for itemId, expData in pairs(playerData) do
            potionsCombo = potionsCombo + expData.rate
        end
    end
    return potionsCombo
end

function expPotions:onSay(cid, words, param)
    local str = 'Experience Potion Combos:\n'

    local playerData = self.playerData[getPlayerGUID(cid)]
    if playerData then
        for itemId, expData in pairs(playerData) do
            str = str .. ('\n%s - %d%%'):format(getItemInfo(itemId).name, expData.rate * 100)
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return true
end
The code you posted seems to be fine, the problem you have must be in other scripts where you make use of these functions.
 
Back
Top