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

Not adding Storage Value

FabianoBN

l|¬¬"|l
Joined
Jan 23, 2009
Messages
745
Reaction score
22
Location
Goias - Brazil
Please someone help me?
I'm making a command addon doll.
But when I use the command addon, storage is not adding value.
Could anyone help me?

Script:
PHP:
function onSay(cid, words, param)
    local female = { 
    ["citizen"]={136, 10001}, 
    ["hunter"]={137, 10003}, 
    ["mage"]={138, 10007}, 
    ["knight"]={139, 10005}, 
    ["nobleman"]={140, 10015}, 
    ["summoner"]={141, 10009}, 
    ["warrior"]={142, 10019}, 
    ["barbarian"]={147, 10011}, 
    ["druid"]={148, 10013}, 
    ["wizard"]={149, 10021}, 
    ["oriental"]={150, 10017}, 
    ["pirate"]={155, 10027}, 
    ["assassin"]={156, 10023}, 
    ["beggar"]={157, 10025}, 
    ["shaman"]={158, 10029}, 
    ["norsewoman"]={252, 10031}, 
    ["nightmare"]={269, 10037}, 
    ["jester"]={270, 10033}, 
    ["brotherhood"]={279, 10039}, 
    ["demonhunter"]={288, 10035}, 
    ["yalaharian"]={324, 10041} 
    }
    local male = { 
    ["citizen"]={128, 10001}, 
    ["hunter"]={129, 10003}, 
    ["mage"]={130, 10007}, 
    ["knight"]={131, 10005}, 
    ["nobleman"]={132, 10015},
    ["summoner"]={133, 10009}, 
    ["warrior"]={134, 10019}, 
    ["barbarian"]={143, 10011}, 
    ["druid"]={144, 10013}, 
    ["wizard"]={145, 10021}, 
    ["oriental"]={146, 10017}, 
    ["pirate"]={151, 10027}, 
    ["assassin"]={152, 10023}, 
    ["beggar"]={153, 10025}, 
    ["shaman"]={154, 10029}, 
    ["norsewoman"]={251, 10031}, 
    ["nightmare"]={268, 10037}, 
    ["jester"]={273, 10033}, 
    ["brotherhood"]={278, 10039}, 
    ["demonhunter"]={289, 10035}, 
    ["yalaharian"]={325, 10041} 
    }
    local msgs = {
    "Incorrect param!", 
    "You need Addon Doll!", 
    "Incorrect param!", 
    "Addon sucesfully added!",
    "You already have this addon!"
    }
    local param = string.lower(param)  
    if(getPlayerItemCount(cid, 8982) > 0) then                    
        if(param ~= "" and male[param] and female[param]) then
            doPlayerRemoveItem(cid, 8982, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[4])
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)                        
            if(getPlayerSex(cid) == 0) then
              getPlayerStorageValue(cid, female[param][2])
              doPlayerAddOutfit(cid, female[param][1], 1)          
            else
              getPlayerStorageValue(cid, male[param][2])
              doPlayerAddOutfit(cid, male[param][1], 1)           
            end
        else
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[1])
        end
    else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[2])
    end
  end
 
I think it's working now ^^
Lua:
  function onSay(cid, words, param)
    local female = {
    ["citizen"]={136, 10001},
    ["hunter"]={137, 10003},
    ["mage"]={138, 10007},
    ["knight"]={139, 10005},
    ["nobleman"]={140, 10015},
    ["summoner"]={141, 10009},
    ["warrior"]={142, 10019},
    ["barbarian"]={147, 10011},
    ["druid"]={148, 10013},
    ["wizard"]={149, 10021},
    ["oriental"]={150, 10017},
    ["pirate"]={155, 10027},
    ["assassin"]={156, 10023},
    ["beggar"]={157, 10025},
    ["shaman"]={158, 10029},
    ["norsewoman"]={252, 10031},
    ["nightmare"]={269, 10037},
    ["jester"]={270, 10033},
    ["brotherhood"]={279, 10039},
    ["demonhunter"]={288, 10035},
    ["yalaharian"]={324, 10041}
    }
    local male = {
    ["citizen"]={128, 10001},
    ["hunter"]={129, 10003},
    ["mage"]={130, 10007},
    ["knight"]={131, 10005},
    ["nobleman"]={132, 10015},
    ["summoner"]={133, 10009},
    ["warrior"]={134, 10019},
    ["barbarian"]={143, 10011},
    ["druid"]={144, 10013},
    ["wizard"]={145, 10021},
    ["oriental"]={146, 10017},
    ["pirate"]={151, 10027},
    ["assassin"]={152, 10023},
    ["beggar"]={153, 10025},
    ["shaman"]={154, 10029},
    ["norsewoman"]={251, 10031},
    ["nightmare"]={268, 10037},
    ["jester"]={273, 10033},
    ["brotherhood"]={278, 10039},
    ["demonhunter"]={289, 10035},
    ["yalaharian"]={325, 10041}
    }
    local msgs = {
    "Incorrect param!",
    "You need Addon Doll!",
    "Incorrect param!",
    "Addon sucesfully added!",
    "You already have this addon!"
    }
    local param = string.lower(param)  
    if(getPlayerItemCount(cid, 8982) > 0) then                    
        if(param ~= "" and male[param] and female[param]) then
            doPlayerRemoveItem(cid, 8982, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[4])
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)                        
            if(getPlayerSex(cid) == 0) then
				if(getPlayerStorageValue(cid, female[param][2])) <= 0 then
					setPlayerStorageValue(cid, female[param][2], 1)
					doPlayerAddOutfit(cid, female[param][1], 1)
				else
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[5])
				end
            else
				if(getPlayerStorageValue(cid, male[param][2])) <= 0 then
					setPlayerStorageValue(cid, male[param][2], 1)
					doPlayerAddOutfit(cid, male[param][1], 1)   
				else
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[5])
				end
            end
        else
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[1])
        end
    else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[2])
    end
return true
end
 
Last edited:
No errors friend and I used what you said!

Now changed the setStorageValue you changed it to:
elseif (getPlayerStorageValue (cid, female [param] [2]) ~ = -1) then

Now you are adding, so that a different numbering of the NPC that is!

Like this:
PHP:
function onSay(cid, words, param)
    local female = { 
    ["citizen"]={136, 10001}, 
    ["hunter"]={137, 10003}, 
    ["mage"]={138, 10007}, 
    ["knight"]={139, 10005}, 
    ["nobleman"]={140, 10015}, 
    ["summoner"]={141, 10009}, 
    ["warrior"]={142, 10019}, 
    ["barbarian"]={147, 10011}, 
    ["druid"]={148, 10013}, 
    ["wizard"]={149, 10021}, 
    ["oriental"]={150, 10017}, 
    ["pirate"]={155, 10027}, 
    ["assassin"]={156, 10023}, 
    ["beggar"]={157, 10025}, 
    ["shaman"]={158, 10029}, 
    ["norsewoman"]={252, 10031}, 
    ["nightmare"]={269, 10037}, 
    ["jester"]={270, 10033}, 
    ["brotherhood"]={279, 10039}, 
    ["demonhunter"]={288, 10035}, 
    ["yalaharian"]={324, 10041} 
    }
    local male = { 
    ["citizen"]={128, 10001}, 
    ["hunter"]={129, 10003}, 
    ["mage"]={130, 10007}, 
    ["knight"]={131, 10005}, 
    ["nobleman"]={132, 10015},
    ["summoner"]={133, 10009}, 
    ["warrior"]={134, 10019}, 
    ["barbarian"]={143, 10011}, 
    ["druid"]={144, 10013}, 
    ["wizard"]={145, 10021}, 
    ["oriental"]={146, 10017}, 
    ["pirate"]={151, 10027}, 
    ["assassin"]={152, 10023}, 
    ["beggar"]={153, 10025}, 
    ["shaman"]={154, 10029}, 
    ["norsewoman"]={251, 10031}, 
    ["nightmare"]={268, 10037}, 
    ["jester"]={273, 10033}, 
    ["brotherhood"]={278, 10039}, 
    ["demonhunter"]={289, 10035}, 
    ["yalaharian"]={325, 10041} 
    }
    local msgs = {
    "Incorrect param!", 
    "You need Addon Doll!", 
    "Incorrect param!", 
    "Addon sucesfully added!",
    "You already have this addon!"
    }
    local param = string.lower(param)  
    if(getPlayerItemCount(cid, 8982) > 0) then                    
        if(param ~= "" and male[param] and female[param]) then
            doPlayerRemoveItem(cid, 8982, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[4])
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)                        
            if(getPlayerSex(cid) == 0) then
              elseif {getPlayerStorageValue(cid, female[param][2]) ~= -1} then
              doPlayerAddOutfit(cid, female[param][1], 1)          
            else
              elseif {getPlayerStorageValue(cid, male[param][2]) ~= -1} then
              doPlayerAddOutfit(cid, male[param][1], 1)           
            end
        else
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[1])
        end
    else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgs[2])
    end
  end

He gave up this error in exe:

[Error - LuaScriptInterface::loadFile] data/talkactions/scripts/addondoll2.lua:65: 'end' expected (to close 'if' at line 61) near 'elseif'
[Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/addondoll2.lua)
data/talkactions/scripts/addondoll2.lua:65: 'end' expected (to close 'if' at line 61) near 'elseif'
 
It's that type of NPC has the addon and I also want to the Addon doll.
I just want the storage for the same, because if the player has done with the NPC and try to make the Addon doll can not for sure?
And the same with the NPC!

More ok, thank you for your help!
 
You want the addon doll storages to be the same as your npc addoner storages?
I didn't change the storage, just the value of it.
You are changing it back to do nothing when you're using:
getPlayerStorageValue(cid, ...)
You're just checking the storage, to change the storage, use:
setPlayerStorageValue(cid, ...)

and what did you do here:
if(getPlayerSex(cid) == 0) then
elseif {getPlayerStorageValue(cid, female[param][2]) ~= -1} then
doPlayerAddOutfit(cid, female[param][1], 1)

???
 
Back
Top