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

doPlayerSetStorageValue TFS1.2 problem

Exactly

New Member
Joined
Jul 14, 2014
Messages
117
Reaction score
4
Hello, i have problem on addon system on action

Bug when i use item on map:

Code:
 attempt to call global 'doPlayerSetStorageValue' (a nil value)
stack traceback:
        [C]: in function 'doPlayerSetStorageValue'

My script:

Code:
function onUse(cid, item, fromPos, itemEx, toPos)
    for i = 0, #outfity do
        if item.uid == outfity[i].uniqueid then
            if getPlayerStorageValue(cid, outfity[i].uniqueid) < 1 then
                if getPlayerSex(cid) == 1 then
                    doPlayerAddOutfit(cid, outfity[i].outfitmale, outfity[i].addon)
                    doCreatureSay(cid, 'Zdobyles addon numer ' .. outfity[i].addon .. ' do ' .. outfity[i].nazwamale .. ' outfit.', TALKTYPE_MONSTER)
                    doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)
                else
                    doPlayerAddOutfit(cid, outfity[i].outfitfemale, outfity[i].addon)
                    doCreatureSay(cid, 'Zdobylas addon numer ' .. outfity[i].addon .. ' do ' .. outfity[i].nazwafemale .. ' outfit.', TALKTYPE_MONSTER)
                    doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)               
                end
            else
                    doCreatureSay(cid, 'Posiadasz juz ' .. outfity[i].addon .. ' addon do ' .. outfity[i].nazwamale .. ' outfit.', TALKTYPE_MONSTER)       
            end
        else
         -- ERROR --
        end
    
    end
    
    return true
end

function onUse(cid, item, fromPos, itemEx, toPos)
for i = 0, #outfity do
if item.uid == outfity.uniqueid then
if getPlayerStorageValue(cid, outfity.uniqueid) < 1 then
if getPlayerSex(cid) == 1 then
doPlayerAddOutfit(cid, outfity.outfitmale, outfity.addon)
doCreatureSay(cid, 'Zdobyles addon numer ' .. outfity.addon .. ' do ' .. outfity.nazwamale .. ' outfit.', TALKTYPE_MONSTER)
doPlayerSetStorageValue(cid, outfity.uniqueid, 1)
else
doPlayerAddOutfit(cid, outfity.outfitfemale, outfity.addon)
doCreatureSay(cid, 'Zdobylas addon numer ' .. outfity.addon .. ' do ' .. outfity.nazwafemale .. ' outfit.', TALKTYPE_MONSTER)
doPlayerSetStorageValue(cid, outfity.uniqueid, 1)
end
else
doCreatureSay(cid, 'Posiadasz juz ' .. outfity.addon .. ' addon do ' .. outfity.nazwamale .. ' outfit.', TALKTYPE_MONSTER)
end
else
-- ERROR --
end

end

return true
end


THANKS!!
 
Hello, i have problem on addon system on action

Bug when i use item on map:

Code:
 attempt to call global 'doPlayerSetStorageValue' (a nil value)
stack traceback:
        [C]: in function 'doPlayerSetStorageValue'

My script:

Code:
function onUse(cid, item, fromPos, itemEx, toPos)
    for i = 0, #outfity do
        if item.uid == outfity[i].uniqueid then
            if getPlayerStorageValue(cid, outfity[i].uniqueid) < 1 then
                if getPlayerSex(cid) == 1 then
                    doPlayerAddOutfit(cid, outfity[i].outfitmale, outfity[i].addon)
                    doCreatureSay(cid, 'Zdobyles addon numer ' .. outfity[i].addon .. ' do ' .. outfity[i].nazwamale .. ' outfit.', TALKTYPE_MONSTER)
                    doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)
                else
                    doPlayerAddOutfit(cid, outfity[i].outfitfemale, outfity[i].addon)
                    doCreatureSay(cid, 'Zdobylas addon numer ' .. outfity[i].addon .. ' do ' .. outfity[i].nazwafemale .. ' outfit.', TALKTYPE_MONSTER)
                    doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)              
                end
            else
                    doCreatureSay(cid, 'Posiadasz juz ' .. outfity[i].addon .. ' addon do ' .. outfity[i].nazwamale .. ' outfit.', TALKTYPE_MONSTER)      
            end
        else
         -- ERROR --
        end
   
    end
   
    return true
end

function onUse(cid, item, fromPos, itemEx, toPos)
for i = 0, #outfity do
if item.uid == outfity.uniqueid then
if getPlayerStorageValue(cid, outfity.uniqueid) < 1 then
if getPlayerSex(cid) == 1 then
doPlayerAddOutfit(cid, outfity.outfitmale, outfity.addon)
doCreatureSay(cid, 'Zdobyles addon numer ' .. outfity.addon .. ' do ' .. outfity.nazwamale .. ' outfit.', TALKTYPE_MONSTER)
doPlayerSetStorageValue(cid, outfity.uniqueid, 1)
else
doPlayerAddOutfit(cid, outfity.outfitfemale, outfity.addon)
doCreatureSay(cid, 'Zdobylas addon numer ' .. outfity.addon .. ' do ' .. outfity.nazwafemale .. ' outfit.', TALKTYPE_MONSTER)
doPlayerSetStorageValue(cid, outfity.uniqueid, 1)
end
else
doCreatureSay(cid, 'Posiadasz juz ' .. outfity.addon .. ' addon do ' .. outfity.nazwamale .. ' outfit.', TALKTYPE_MONSTER)
end
else
-- ERROR --
end

end

return true
end


THANKS!!
player:setStorageValue(key, value)
 
Don't work

attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'

Script:

Code:
outfity = {
    [0] = {outfitmale = 128, outfitfemale = 136, addon = 1, nazwamale = "citizen", nazwafemale = "citizen", uniqueid = 14550},  -- dragony zwykle
    [1] = {outfitmale = 128, outfitfemale = 136, addon = 2, nazwamale = "citizen", nazwafemale = "citizen", uniqueid = 14551},  -- zolwie
    [2] = {outfitmale = 129, outfitfemale = 137, addon = 1, nazwamale = "hunter", nazwafemale = "hunter", uniqueid = 14552}, -- q dla low lvl
    [3] = {outfitmale = 129, outfitfemale = 137, addon = 2, nazwamale = "hunter", nazwafemale = "hunter", uniqueid = 14553}, -- roty pod miastem
    [4] = {outfitmale = 130, outfitfemale = 138, addon = 1, nazwamale = "mage", nazwafemale = "mage", uniqueid = 14554}, -- wschod miasta
    [5] = {outfitmale = 130, outfitfemale = 138, addon = 2, nazwamale = "mage", nazwafemale = "mage", uniqueid = 14555}, -- demon oak obok drzewa
    [6] = {outfitmale = 131, outfitfemale = 139, addon = 1, nazwamale = "knight", nazwafemale = "knight", uniqueid = 14556}, -- banshee quest
    [7] = {outfitmale = 131, outfitfemale = 139, addon = 2, nazwamale = "knight", nazwafemale = "knight", uniqueid = 14557}, -- hydry pod miastem
    [8] = {outfitmale = 132, outfitfemale = 140, addon = 1, nazwamale = "nobleman", nazwafemale = "noblewoman", uniqueid = 14558}, -- port w miescie, 1 pietro
    [9] = {outfitmale = 132, outfitfemale = 140, addon = 2, nazwamale = "nobleman", nazwafemale = "noblewoman", uniqueid = 14559}, -- miasto z forgotten houses
    [10] = {outfitmale = 133, outfitfemale = 141, addon = 1, nazwamale = "summoner", nazwafemale = "summoner", uniqueid = 14560}, -- quest demonowy
    [11] = {outfitmale = 133, outfitfemale = 141, addon = 2, nazwamale = "summoner", nazwafemale = "summoner", uniqueid = 14561}, -- anni
    [12] = {outfitmale = 134, outfitfemale = 142, addon = 1, nazwamale = "warrior", nazwafemale = "warrior", uniqueid = 14562}, -- dhq
    [13] = {outfitmale = 134, outfitfemale = 142, addon = 2, nazwamale = "warrior", nazwafemale = "warrior", uniqueid = 14563}, -- necro quest
    [14] = {outfitmale = 143, outfitfemale = 147, addon = 1, nazwamale = "barbarian", nazwafemale = "barbarian", uniqueid = 14564}, -- mage quest
    [15] = {outfitmale = 143, outfitfemale = 147, addon = 2, nazwamale = "barbarian", nazwafemale = "barbarian", uniqueid = 14565}, -- expowisko z hero
    [16] = {outfitmale = 144, outfitfemale = 148, addon = 1, nazwamale = "druid", nazwafemale = "druid", uniqueid = 14566}, -- golden armor quest
    [17] = {outfitmale = 144, outfitfemale = 148, addon = 2, nazwamale = "druid", nazwafemale = "druid", uniqueid = 14567}, -- mpa quest
    [18] = {outfitmale = 145, outfitfemale = 149, addon = 1, nazwamale = "wizard", nazwafemale = "wizard", uniqueid = 14568}, -- expowisko z dlami, free tp room 0
    [19] = {outfitmale = 145, outfitfemale = 149, addon = 2, nazwamale = "wizard", nazwafemale = "wizard", uniqueid = 14569}, -- elf city
    [20] = {outfitmale = 146, outfitfemale = 150, addon = 1, nazwamale = "oriental", nazwafemale = "oriental", uniqueid = 14570}, -- expowisko z gsami na poludnie od miasta
    [21] = {outfitmale = 146, outfitfemale = 150, addon = 2, nazwamale = "oriental", nazwafemale = "oriental", uniqueid = 14571}, -- dragony obok GSow
    [22] = {outfitmale = 151, outfitfemale = 155, addon = 1, nazwamale = "pirate", nazwafemale = "pirate", uniqueid = 14572}, -- dzwignie z runkami
    [23] = {outfitmale = 151, outfitfemale = 155, addon = 2, nazwamale = "pirate", nazwafemale = "pirate", uniqueid = 14573}, -- kopalnia
    
    [24] = {outfitmale = 152, outfitfemale = 156, addon = 1, nazwamale = "assassin", nazwafemale = "assassin", uniqueid = 14574}, -- mix quest
    [25] = {outfitmale = 152, outfitfemale = 156, addon = 2, nazwamale = "assassin", nazwafemale = "assassin", uniqueid = 14575}, -- mix quest, room z nagrodami
    
    [26] = {outfitmale = 151, outfitfemale = 155, addon = 1, nazwamale = "beggar", nazwafemale = "beggar", uniqueid = 14576}, -- cmentarz z ghoulami na poludnie od miasta
    [27] = {outfitmale = 151, outfitfemale = 155, addon = 2, nazwamale = "beggar", nazwafemale = "beggar", uniqueid = 14577}, -- dragony zwykle
    [28] = {outfitmale = 154, outfitfemale = 158, addon = 1, nazwamale = "shaman", nazwafemale = "shaman", uniqueid = 14578}, -- helle na vip
    [29] = {outfitmale = 154, outfitfemale = 158, addon = 2, nazwamale = "shaman", nazwafemale = "shaman", uniqueid = 14579}, -- archdemon quest
    [30] = {outfitmale = 251, outfitfemale = 252, addon = 1, nazwamale = "norseman", nazwafemale = "norsewoman", uniqueid = 14580}, -- ice witche
    [31] = {outfitmale = 251, outfitfemale = 252, addon = 2, nazwamale = "norseman", nazwafemale = "norsewoman", uniqueid = 14581}, -- frost dragony
    [32] = {outfitmale = 268, outfitfemale = 269, addon = 1, nazwamale = "nightmare", nazwafemale = "nightmare", uniqueid = 14582}, -- quest na yalahari armor
    [33] = {outfitmale = 268, outfitfemale = 269, addon = 2, nazwamale = "nightmare", nazwafemale = "nightmare", uniqueid = 14583}, -- orshabaalator
    [34] = {outfitmale = 273, outfitfemale = 270, addon = 1, nazwamale = "jester", nazwafemale = "jester", uniqueid = 14584}, -- zoo
    [35] = {outfitmale = 273, outfitfemale = 270, addon = 2, nazwamale = "jester", nazwafemale = "jester", uniqueid = 14585}, -- ogrod
    [36] = {outfitmale = 278, outfitfemale = 279, addon = 1, nazwamale = "brotherhood", nazwafemale = "brotherhood", uniqueid = 14586}, -- knowledge quest
    [37] = {outfitmale = 278, outfitfemale = 279, addon = 2, nazwamale = "brotherhood", nazwafemale = "brotherhood", uniqueid = 14587}, -- 64 rooms quest
    [38] = {outfitmale = 289, outfitfemale = 288, addon = 1, nazwamale = "demonhunter", nazwafemale = "demonhunter", uniqueid = 14588}, -- quest z pytaniami 2
    [39] = {outfitmale = 289, outfitfemale = 288, addon = 2, nazwamale = "demonhunter", nazwafemale = "demonhunter", uniqueid = 14589}, -- sea house w enigmie
    
    [40] = {outfitmale = 324, outfitfemale = 325, addon = 1, nazwamale = "yalaharian", nazwafemale = "yalaharian", uniqueid = 14590}, -- pieklo
    [41] = {outfitmale = 324, outfitfemale = 325, addon = 2, nazwamale = "yalaharian", nazwafemale = "yalaharian", uniqueid = 14591}, -- pieklo
    
    [42] = {outfitmale = 335, outfitfemale = 336, addon = 1, nazwamale = "warmaster", nazwafemale = "warmaster", uniqueid = 14592}, -- illusion
    [43] = {outfitmale = 335, outfitfemale = 336, addon = 2, nazwamale = "warmaster", nazwafemale = "warmaster", uniqueid = 14593} -- culty na poludniu miasta
    -- [44] = {outfitmale = 367, outfitfemale = 366, addon = 1, nazwamale = "warfrayer", nazwafemale = "warfrayer", uniqueid = 14594},
    -- [45] = {outfitmale = 367, outfitfemale = 366, addon = 2, nazwamale = "warfrayer", nazwafemale = "warfrayer", uniqueid = 14595}
    
}
function onUse(cid, item, fromPos, itemEx, toPos)
    for i = 0, #outfity do
        if item.uid == outfity[i].uniqueid then
            if getPlayerStorageValue(cid, outfity[i].uniqueid) < 1 then
                if getPlayerSex(cid) == 1 then
                    doPlayerAddOutfit(cid, outfity[i].outfitmale, outfity[i].addon)
                    doCreatureSay(cid, 'Zdobyles addon numer ' .. outfity[i].addon .. ' do ' .. outfity[i].nazwamale .. ' outfit.', TALKTYPE_MONSTER)
                    doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)
                else
                    doPlayerAddOutfit(cid, outfity[i].outfitfemale, outfity[i].addon)
                    doCreatureSay(cid, 'Zdobylas addon numer ' .. outfity[i].addon .. ' do ' .. outfity[i].nazwafemale .. ' outfit.', TALKTYPE_MONSTER)
                    doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)               
                end
            else
                    doCreatureSay(cid, 'Posiadasz juz ' .. outfity[i].addon .. ' addon do ' .. outfity[i].nazwamale .. ' outfit.', TALKTYPE_MONSTER)       
            end
        else
         -- ERROR --
        end
    
    end
    
    return true
end
 
Last edited:
Doesn't work

Lua Script Error: [Action Interface]
data/actions/scripts/moje/addonsystem.lua:eek:nUse
data/actions/scripts/moje/addonsystem.lua:65: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/actions/scripts/moje/addonsystem.lua:65: in function <data/actions/scripts/moje/addonsystem.lua:54>
 
rewrite
Code:
function onUse(cid, item, fromPos, itemEx, toPos)

for
Code:
function onUse(cid, item, fromPos, itemEx, toPos)
    local player = Player(cid)

this

Code:
doPlayerSetStorageValue(cid, outfity[i].uniqueid, 1)

for

Code:
player:setStorageValue( outfity[i].uniqueid, 1 )


Or create this function:

Code:
    function doPlayerSetStorageValue(cid, key, value)
        local p = Player(cid)
        return p:setStorageValue(key, value)
    end
 
this is what happens when you dont post your tfs version
its so simple to read the rules yet people still refuse to
 
Back
Top