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

Solved Statue addon

Mera Mero

Guess Who?
Joined
Dec 27, 2014
Messages
417
Reaction score
86
Hello otlanders i've got problem with my addon statue by action id i tried to add more items for it to get the addon but when i tried it only one item from these items which i added to it removed and obtain the outfit may you help me please? i need to make more items to obtain the outfit not only 1 item
Code:
local t = {
--[ACTIONID] = {FEMALEID, MALEID, "OUTFITNAME"}
[8001] = {136, 128, "citizen"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v = t[item.actionid]
    local k = getPlayerSex(cid) == 0 and v[1] or v[2]
    local msg = {"You\'ve already obtained the "..v[3].." addons!", "You don't have any Bufary coins.", "Congratulations, you\'ve obtained the "..v[3].." addons!"}
    if canPlayerWearOutfit(cid, k, 3) then
        return doPlayerSendCancel(cid, msg[1]), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
[LIST]
[*]    if getPlayerItemCount(cid, 9970) < 15 and getPlayerItemCount(cid, 9971) < 30 then
[*]        return doPlayerSendCancel(cid, msg[2]), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
[*]    end
[*]    doPlayerAddOutfit(cid, k, 3)
[*]    doPlayerRemoveItem(cid, 9970, 15)
[*]    doPlayerRemoveItem(cid, 9971, 30)
[/LIST]
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3])
    return true
end
 
Code:
--Edited by Redan, OTLand.net
local t = {
   [8001] = {n="citizen", f=136, m=128, i={
     {5878, 100}, -- 100x minotaur leather
     {5890, 100}, -- 100x chicken feather
     {5902, 50}, -- 50x honeycomb
     {2480, 1} -- 1x legion helmet
   }},
   
   [8002] = {n="hunter", f=137, m=129, i={
     {5947, 1}, -- 1x Elane's crossbow
     {5876, 100}, -- 100x lizard leather
     {5948, 50}, -- 100x red dragon leather
     {5891, 5}, -- 5x enchanted chicken wing
     {5887, 1}, -- 1x piece of royal steel
     {5889, 1}, -- 1x piece of draconian steel
     {5888, 1}, -- 1x piece of hell steel
     {5875, 1} -- 1x sniper gloves
   }}
}

function onUse(cid, item, fromPos, item2, toPos)
   s = t[item.actionid]
   o = getPlayerSex(cid) == 0 and s.f or s.m
   
   if canPlayerWearOutfit(cid, o, 3) then
     return doPlayerSendCancel(cid, "You\'ve already obtained the ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
   
   hasItems = true
   for _,i in ipairs(s.i) do
     if(getPlayerItemCount(cid, i[1]) < i[2]) then
       hasItems = false
     end
   end
   
   if(hasItems == true) then
     for _,i in ipairs(s.i) do
       doPlayerRemoveItem(cid, i[1], i[2])
     end
     doPlayerAddOutfit(cid, o, 3)
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you\'ve obtained the ".. string.lower(s.n) .." addons!")
     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
   else
     return doPlayerSendCancel(cid, "You don't have required items with you!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
   
   return true
end

Should be working, not tested though
 
Last edited:
Code:
--Edited by Redan, OTLand.net
local t = {
    [8001] = {n="citizen", f=136, m=128, i={
        {5878, 100}, -- 100x minotaur leather
        {5890, 100}, -- 100x chicken feather
        {5902, 50}, -- 50x honeycomb
        {2480, 1} -- 1x legion helmet
    },
  
    [8002] = {n="hunter", f=137, m=129, i={
        {5947, 1}, -- 1x Elane's crossbow
        {5876, 100}, -- 100x lizard leather
        {5948, 50}, -- 100x red dragon leather
        {5891, 5}, -- 5x enchanted chicken wing
        {5887, 1}, -- 1x piece of royal steel
        {5889, 1}, -- 1x piece of draconian steel
        {5888, 1}, -- 1x piece of hell steel
        {5875, 1} -- 1x sniper gloves
    }
}

function onUse(cid, item, fromPos, item2, toPos)
{
    s = t[item.actionid]
    o = getPlayerSex(cid) == 0 and s.f or s.m
  
    if canPlayerWearOutfit(cid, o, 3) then
        return doPlayerSendCancel(cid, "You\'ve already obtained the ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
  
    hasItems = true
    for _,i in ipairs(s.i) do
        if(getPlayerItemCount(cid, i[1]) < i[2]) then
            hasItems = false
        end
    end
  
    if(hasItems == true) then
        for _,i in ipairs(s.i) do
            doPlayerRemoveItem(cid, i[1], i[2])
        end
        doPlayerAddOutfit(cid, o, 3)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you\'ve obtained the ".. string.lower(s.n) .." addons!")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    else
        return doPlayerSendCancel(cid, "You don't have required items with you!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
  
    return true
}

Should be working, not tested though
Code:
[04/02/2015 16:55:54] [Error - LuaScriptInterface::loadFile] data/actions/scripts/addons.lua:22: '}' expected (to close '{' at line 3) near 'function'
[04/02/2015 16:55:54] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/addons.lua)
[04/02/2015 16:55:54] data/actions/scripts/addons.lua:22: '}' expected (to close '{' at line 3) near 'function'
 
Code:
--Edited by Redan, OTLand.net
local t = {
   [8001] = {n="citizen", f=136, m=128, i={
     {5878, 100}, -- 100x minotaur leather
     {5890, 100}, -- 100x chicken feather
     {5902, 50}, -- 50x honeycomb
     {2480, 1} -- 1x legion helmet
   }},
  
   [8002] = {n="hunter", f=137, m=129, i={
     {5947, 1}, -- 1x Elane's crossbow
     {5876, 100}, -- 100x lizard leather
     {5948, 50}, -- 100x red dragon leather
     {5891, 5}, -- 5x enchanted chicken wing
     {5887, 1}, -- 1x piece of royal steel
     {5889, 1}, -- 1x piece of draconian steel
     {5888, 1}, -- 1x piece of hell steel
     {5875, 1} -- 1x sniper gloves
   }}
}

function onUse(cid, item, fromPos, item2, toPos)
   s = t[item.actionid]
   o = getPlayerSex(cid) == 0 and s.f or s.m
  
   if canPlayerWearOutfit(cid, o, 3) then
     return doPlayerSendCancel(cid, "You\'ve already obtained the ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
  
   hasItems = true
   for _,i in ipairs(s.i) do
     if(getPlayerItemCount(cid, i[1]) < i[2]) then
       hasItems = false
     end
   end
  
   if(hasItems == true) then
     for _,i in ipairs(s.i) do
       doPlayerRemoveItem(cid, i[1], i[2])
     end
     doPlayerAddOutfit(cid, o, 3)
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you\'ve obtained the ".. string.lower(s.n) .." addons!")
     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
   else
     return doPlayerSendCancel(cid, "You don't have required items with you!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
  
   return true
end

Should be working, not tested though
OH Thanks its working good :D but is there way to make Limit level for this addon? i mean only level X can obtain this outfit ? :p
 
sure, gimme a sec

#Edit
Code:
--Edited by Redan, OTLand.net
local t = {
    [8001] = {n="citizen", l=20, f=136, m=128, i={
        {5878, 100}, -- 100x minotaur leather
        {5890, 100}, -- 100x chicken feather
        {5902, 50}, -- 50x honeycomb
        {2480, 1} -- 1x legion helmet
    }},
   
    [8002] = {n="hunter", l=50, f=137, m=129, i={
        {5947, 1}, -- 1x Elane's crossbow
        {5876, 100}, -- 100x lizard leather
        {5948, 50}, -- 100x red dragon leather
        {5891, 5}, -- 5x enchanted chicken wing
        {5887, 1}, -- 1x piece of royal steel
        {5889, 1}, -- 1x piece of draconian steel
        {5888, 1}, -- 1x piece of hell steel
        {5875, 1} -- 1x sniper gloves
    }}
}

function onUse(cid, item, fromPos, item2, toPos)
    s = t[item.actionid]
    o = getPlayerSex(cid) == 0 and s.f or s.m
   
    if canPlayerWearOutfit(cid, o, 3) then
        return doPlayerSendCancel(cid, "You\'ve already obtained the ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
   
    if getPlayerLevel(cid) < s.l then
        return doPlayerSendCancel(cid, "Only players with level ".. s.l .." or above are allowed to obtain ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
   
    hasItems = true
    for _,i in ipairs(s.i) do
        if(getPlayerItemCount(cid, i[1]) < i[2]) then
            hasItems = false
        end
    end
   
    if(hasItems == true) then
        for _,i in ipairs(s.i) do
            doPlayerRemoveItem(cid, i[1], i[2])
        end
        doPlayerAddOutfit(cid, o, 3)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you\'ve obtained the ".. string.lower(s.n) .." addons!")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    else
        return doPlayerSendCancel(cid, "You don't have required items with you!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
   
    return true
end

enjoy
 
sure, gimme a sec

#Edit
Code:
--Edited by Redan, OTLand.net
local t = {
    [8001] = {n="citizen", l=20, f=136, m=128, i={
        {5878, 100}, -- 100x minotaur leather
        {5890, 100}, -- 100x chicken feather
        {5902, 50}, -- 50x honeycomb
        {2480, 1} -- 1x legion helmet
    }},
  
    [8002] = {n="hunter", l=50, f=137, m=129, i={
        {5947, 1}, -- 1x Elane's crossbow
        {5876, 100}, -- 100x lizard leather
        {5948, 50}, -- 100x red dragon leather
        {5891, 5}, -- 5x enchanted chicken wing
        {5887, 1}, -- 1x piece of royal steel
        {5889, 1}, -- 1x piece of draconian steel
        {5888, 1}, -- 1x piece of hell steel
        {5875, 1} -- 1x sniper gloves
    }}
}

function onUse(cid, item, fromPos, item2, toPos)
    s = t[item.actionid]
    o = getPlayerSex(cid) == 0 and s.f or s.m
  
    if canPlayerWearOutfit(cid, o, 3) then
        return doPlayerSendCancel(cid, "You\'ve already obtained the ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
  
    if getPlayerLevel(cid) < s.l then
        return doPlayerSendCancel(cid, "Only players with level ".. s.l .." or above are allowed to obtain ".. string.lower(s.n) .." addons!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
  
    hasItems = true
    for _,i in ipairs(s.i) do
        if(getPlayerItemCount(cid, i[1]) < i[2]) then
            hasItems = false
        end
    end
  
    if(hasItems == true) then
        for _,i in ipairs(s.i) do
            doPlayerRemoveItem(cid, i[1], i[2])
        end
        doPlayerAddOutfit(cid, o, 3)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you\'ve obtained the ".. string.lower(s.n) .." addons!")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    else
        return doPlayerSendCancel(cid, "You don't have required items with you!"), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
  
    return true
end

enjoy
thanks :p
 
if you want to learn you should read the script and -maybe- try to understand it, thats the better way to learn lua here, almost everyone is going to help you but u need to understand what are they doing to make the script work and what are you doing wrong.
 
if you want to learn you should read the script and -maybe- try to understand it, thats the better way to learn lua here, almost everyone is going to help you but u need to understand what are they doing to make the script work and what are you doing wrong.
i'm trying to learn ^_^ don't worry btw i'm nearly done
 

Similar threads

Back
Top