• 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 Rebirth Item

TomBartezz

Member
Joined
May 29, 2016
Messages
159
Reaction score
17
This is my code but I would like to add rebirth to players (rebirth storage id 1958) (TFS 0.3.6)
Code:
function setPlayerFromToStorageValues(cid, Reborn, 1)
    for k,v in pairs(storage) do
        if (isNumber(k) and isNumber(v)) == TRUE then
            if k < v then
                if k > 0 then
                    if v > 0 then
                        for a = k,v do
                            setPlayerStorageValue(cid, Reborn, 200)
                        end
                    else
                        error("Table value has to be higher then 0")
                    end
                else
                    error("Table key has to be higher then 0")
                end
            else
                error("Table key has to be lower then Table value")
            end
        else
            error("Table value and key have to be numbers")
        end
    end
    return TRUE
end
I also tried to make my own
Code:
local storage = 1958

function onUse (cid, item, fromPosition, itemEx, toPosition)
doPlayerAddStorage (cid, 4500)
return true
end
 
This is my code but I would like to add rebirth to players (rebirth storage id 1958) (TFS 0.3.6)
Code:
function setPlayerFromToStorageValues(cid, Reborn, 1)
    for k,v in pairs(storage) do
        if (isNumber(k) and isNumber(v)) == TRUE then
            if k < v then
                if k > 0 then
                    if v > 0 then
                        for a = k,v do
                            setPlayerStorageValue(cid, Reborn, 200)
                        end
                    else
                        error("Table value has to be higher then 0")
                    end
                else
                    error("Table key has to be higher then 0")
                end
            else
                error("Table key has to be lower then Table value")
            end
        else
            error("Table value and key have to be numbers")
        end
    end
    return TRUE
end
I also tried to make my own
Code:
local storage = 1958

function onUse (cid, item, fromPosition, itemEx, toPosition)
doPlayerAddStorage (cid, 4500)
return true
end
Can some one help me make a script that adds or sets a player globalstorage (1958) to 200?
 
Error
Code:
[29/05/2016 11:36:14] [Error - Action Interface]
[29/05/2016 11:36:14] data/actions/scripts/upgrade/addprestige.lua:onUse
[29/05/2016 11:36:14] Description:
[29/05/2016 11:36:14] data/actions/scripts/upgrade/addprestige.lua:5: attempt to call global 'doPlayerAddStorage' (a nil value)
[29/05/2016 11:36:14] stack traceback:
[29/05/2016 11:36:14]     data/actions/scripts/upgrade/addprestige.lua:5: in function <data/actions/scripts/upgrade/addprestige.lua:1>

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerLevel(cid) >= 8 then
        doCreatureSay(cid, "You have recieved 1 prestige!", TALKTYPE_ORANGE_1)
doPlayerAddStorage(cid, 1958,1)
            doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
            doRemoveItem(item.uid)
            return TRUE
        else
                    doCreatureSay(cid, "You gotta be lvl 8 dude", TALKTYPE_ORANGE_1)
        end
end
I tried to learn how to do it, but when I use it that error pops up and I don't go up
 
Error
Code:
[29/05/2016 11:36:14] [Error - Action Interface]
[29/05/2016 11:36:14] data/actions/scripts/upgrade/addprestige.lua:onUse
[29/05/2016 11:36:14] Description:
[29/05/2016 11:36:14] data/actions/scripts/upgrade/addprestige.lua:5: attempt to call global 'doPlayerAddStorage' (a nil value)
[29/05/2016 11:36:14] stack traceback:
[29/05/2016 11:36:14]     data/actions/scripts/upgrade/addprestige.lua:5: in function <data/actions/scripts/upgrade/addprestige.lua:1>

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerLevel(cid) >= 8 then
        doCreatureSay(cid, "You have recieved 1 prestige!", TALKTYPE_ORANGE_1)
doPlayerAddStorage(cid, 1958,1)
            doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
            doRemoveItem(item.uid)
            return TRUE
        else
                    doCreatureSay(cid, "You gotta be lvl 8 dude", TALKTYPE_ORANGE_1)
        end
end
I tried to learn how to do it, but when I use it that error pops up and I don't go up
Sorry was really tired I guess
doPlayerSetStorageValue
 
Back
Top