• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua addon click all

ADM24horas

New Member
Joined
Oct 4, 2015
Messages
70
Reaction score
0
Anyone know me know if there is a script, which for example addon doll by clicking on it you get all server addon in just one click.
 
someone could explain to me happens to improve this script, since I do not know much about, .lua

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

    if item.itemid == 11138 then
   
        if getPlayerStorageValue(cid,525250) <= 0 then
   
            doPlayerSetStorageValue(cid,525250,1)
       
local pPos = getPlayerPosition(cid)

            if getPlayerSex(cid) == 1 then
   
                doSendMagicEffect(pPos, 37)
                doPlayerAddOutfit(cid,128,3)
                doPlayerAddOutfit(cid,129,3)
                doPlayerAddOutfit(cid,130,3)
                doPlayerAddOutfit(cid,131,3)
                doPlayerAddOutfit(cid,132,3)
                doPlayerAddOutfit(cid,133,3)
                doPlayerAddOutfit(cid,134,3)
                doPlayerAddOutfit(cid,143,3)
                doPlayerAddOutfit(cid,144,3)
                doPlayerAddOutfit(cid,145,3)
                doPlayerAddOutfit(cid,146,3)
                doPlayerAddOutfit(cid,151,3)
                doPlayerAddOutfit(cid,152,3)
                doPlayerAddOutfit(cid,153,3)
                doPlayerAddOutfit(cid,154,3)
                doPlayerAddOutfit(cid,251,3)
                doPlayerAddOutfit(cid,268,3)
                doPlayerAddOutfit(cid,273,3)
                doPlayerAddOutfit(cid,278,3)
                doPlayerAddOutfit(cid,289,3)
                doPlayerAddOutfit(cid,325,3)
                doPlayerAddOutfit(cid,328,3)
                doPlayerAddOutfit(cid,335,3)
                doPlayerAddOutfit(cid,367,3)

        elseif getPlayerSex(cid) == 0 then
   
                doSendMagicEffect(pPos, 37)
                doPlayerAddOutfit(cid,136,3)
                doPlayerAddOutfit(cid,137,3)
                doPlayerAddOutfit(cid,138,3)
                doPlayerAddOutfit(cid,139,3)
                doPlayerAddOutfit(cid,140,3)
                doPlayerAddOutfit(cid,141,3)
                doPlayerAddOutfit(cid,142,3)
                doPlayerAddOutfit(cid,147,3)
                doPlayerAddOutfit(cid,148,3)
                doPlayerAddOutfit(cid,149,3)
                doPlayerAddOutfit(cid,150,3)
                doPlayerAddOutfit(cid,155,3)
                doPlayerAddOutfit(cid,156,3)
                doPlayerAddOutfit(cid,157,3)
                doPlayerAddOutfit(cid,158,3)
                doPlayerAddOutfit(cid,252,3)
                doPlayerAddOutfit(cid,269,3)
                doPlayerAddOutfit(cid,270,3)
                doPlayerAddOutfit(cid,279,3)
                doPlayerAddOutfit(cid,288,3)
                doPlayerAddOutfit(cid,324,3)
                doPlayerAddOutfit(cid,329,3)
                doPlayerAddOutfit(cid,336,3)
                doPlayerAddOutfit(cid,366,3)
       
        doCreatureSay(cid,"You received all the addons!",19)
        doSendMagicEffect(getPlayerPosition(cid), 37)
        doRemoveItem(item.uid,item.type)
       
        else
       
        doCreatureSay(cid,"You have already got all the addons.",19)
        doPlayerAddItem(cid,6527,1)
       
    end
   
    local config={
        removeOnUse = "yes" -- remover quando usar ("yes" or "no")
    }
   
    if (config.removeOnUse == "yes") then
        doRemoveItem(item.uid, 1)
    end
        end
       
            end
           
        return true
       
end
 
Last edited:
I would done a loop:
Code:
local config = {
    [0] = {136, 137, 138, 139},
    [1] = {128, 129, 130}
}

local outfit = config[getPlayerSex(cid)]
for i = 1, #outfit do
    doPlayerAddOutfit(cid, i)
end
 
Code:
local outfits = {
  [0] = {136, 137, ...},
  [1] = {128, 129, ...}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  local outfit = outfits[getPlayerSex(cid)]
  for i = 1, #outfit do
    doPlayerAddOutfit(cid, outfit[i], 3)
  end

  doSendMagicEffect(getPlayerPosition(cid), 37)
  doRemoveItem(item.uid, 1)
  return true
end
 
u can use
Code:
 doPlayerAddOutfitId(cid, outfit id, addon number)
example:
doPlayerAddOutfitId(cid, 10, 3)  -- with this will add full Wizard outfit for male and female
 
So Put more simply... (Because i think you need it )


Code:
local outfits = {
  [0] = {136, 137, ADD MORE NUMBERS, ADD MORE NUMBERS}, ----- Finish putting in the rest of the numbers here for male.
  [1] = {128, 129, ADD MORE NUMBERS, ADD MORE NUMBERS} ----- Finish putting in the rest of the numbers here for female
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  local outfit = outfits[getPlayerSex(cid)]
  for i = 1, #outfit do
    doPlayerAddOutfit(cid, outfit[i], 3)
  end

  doSendMagicEffect(getPlayerPosition(cid), 37)
  doRemoveItem(item.uid, 1)
  return true
end

Then in your actions.xml put in this line
<action actionid="PUT ID OF ITEM HERE" script="NAME OF SCRIPT.lua" />

Then put the script into your scripts folder.
 
Code:
local config = {
 -- [UID]  = {{Male Outfit ID, Addon ID}, {Female Outfit ID, Addon ID}}
    [3000] = {{128, 3}, {136, 3}},  ---citizen, highest floor dp
    [3001] = {{129, 3}, {137, 3}},    ---hunter, boat
    [3002] = {{130, 3}, {138, 3}},  ---mage, hydras
    [3003] = {{131, 3}, {139, 3}},  ---knight, wyvern mountain highest floor
    [3004] = {{132, 3}, {140, 3}},  --- nobleman, poi reward room
    [3005] = {{133, 3}, {141, 3}},  ---summoner, quaras (pirates)
    [3006] = {{134, 3}, {142, 3}},    ---warrior, anni
    [3007] = {{143, 3}, {147, 3}},  ---barbarian, outlaws
    [3008] = {{144, 3}, {148, 3}},  ---druid, underground enigma (n-e)
    [3009] = {{145, 3}, {149, 3}},  ---wizard, okolnir
    [3010] = {{146, 3}, {150, 3}},  ---oriental, near wyrm mountain (z:8)
    [3011] = {{151, 3}, {155, 3}},  ---pirate,
    [3012] = {{152, 3}, {156, 3}},  ---assassin, giant spider + dragons (weird place)
    [3013] = {{153, 3}, {157, 3}},  ---begger, dragons
    [3014] = {{154, 3}, {158, 3}},  ---shaman, necromancer~ 1 floor up from tp
    [3015] = {{273, 3}, {270, 3}},  ---jester, challenger quest
    }
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local n = config[item.uid]
    if(n) then
        local v = getPlayerSex(cid) == 0 and n[2] or n[1]
        doPlayerAddOutfit(cid, v[1], v[2])
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
    end
    return true
end
 
Back
Top