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

Add uniqueid on this script

Bruce Leal

New Member
Joined
Nov 9, 2017
Messages
77
Reaction score
3
Code:
local levelReward = {
    [30] = 3,
    [50] = 5,
    [100] = 10
}

function onAdvance(cid, skill, oldLevel, newLevel)
    doCreatureAddHealth(cid, getCreatureHealth(cid))
    doCreatureAddMana(cid, getCreatureMana(cid))

    for k, v in pairs(levelReward) do
        if newLevel == k and getPlayerStorageValue(cid, 3746) < k then
            doPlayerAddItem(cid, 2160, v, TRUE)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations, you\'ve received "..v.." crystal coins as a reward for level "..k..".")
     
            setPlayerStorageValue(cid, 3746, k)
        end
    end
    return true
end

Player will receive only 1 item with uniqueid 1980 such as the example 2160 but with uniqueID 1980, somebody can helpme to do?
 
Solution
"21:05 coins como recompensa por adquirir o nivel 9." :D:D

Now it got worse hahahahaha, the chat message continues to appear, it should be in the middle of the screen. (that GOD broadcast red)
zzzzz
just use my original script. don't use whatever your trying to do.
I removed the 'uid' thing that you originally requested.
Lua:
local storage = 45001
local levelReward = {
   [1] = {10, 2160, 1, "crystal coin"},
   [2] = {30, 2160, 3, "crystal coins"}, -- lowest level Must be at top, descending down
   [3] = {50, 2160, 5, "crystal coins"}, -- level, itemID, item_amount, item_name
   [4] = {100, 2160, 10, "crystal coins"}
}

function onAdvance(cid, skill, oldLevel, newLevel)
   if skill ~= SKILL__LEVEL or oldLevel >= newLevel then...
Lua:
local levelReward = {
    [7] = {itemid = 2160, amount = 3, storage = 1},
    [8] = {itemid = 2160, amount = 5, storage = 2},
    [30] = {itemid = 2160, amount = 1, storage = 3},
    [50] = {itemid = 2160, amount = 1, storage = 4}
}
local storage = 10000
function onAdvance(cid, skill, oldLevel, newLevel)
    doCreatureAddHealth(cid, getCreatureHealth(cid))
    doCreatureAddMana(cid, getCreatureMana(cid))
    if skill == SKILL_LEVEL and newLevel > oldLevel then
 
    if getPlayerStorageValue(cid, storage) == nil or getPlayerStorageValue(cid, storage) == -1 then
        setPlayerStorageValue(cid, storage, 0)
    end
 
        for i, v in pairs(levelReward) do
            if newLevel == i and getPlayerStorageValue(cid, storage) < levelReward[v].storage then
                doPlayerAddItem(cid, levelReward[v].itemid, levelReward[v].amount, TRUE)
                doBroadcastMessage("Pelos deuses, " .. getCreatureName(cid) .. " recebeu "..levelReward[v].amount.." "..getItemNameById(levelReward[v].itemid).." como recompensa por adquirir o nivel "..k..".", MSG_STATUS_CONSOLE_ORANGE)
                setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
            end
        end
    end
    return true
end

RIP posted after xikini posted and didnt see it.
 
Back
Top