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

Action Addon System

Here you go...

--[[
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Addon System by Shawak (Maxi)
Version v1.0
~~~ Rememeber ~~~~~~~~~~~~~~~
This script set storagevalues
to save the addons.
Storage = 14000 + actionid of
item.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]--

local config = {

[4039] = {
name = "First Demonhunter Addon",
addon_type = 1,
outfit = {288,289},
cost = 0,
items = {},
},
[4040] = {
name = "Second Demonhunter Addon",
addon_type = 2,
outfit = {288,289},
cost = 0,
items = {},
},

} -------- config end -------
local storage = 14000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local addon, removeItems, removeMoney = config[item.actionid], 0, 0
if getPlayerStorageValue(cid, storage + item.actionid) ~= 1 then
if getPlayerMoney(cid) >= addon.cost then
removeMoney = 1
end
if #addon.items > 0 then
for i = 1, #addon.items do
if getPlayerItemCount(cid, addon.items[1]) >= addon.items[2] then
removeItems = removeItems+1
end
end
end
if removeMoney == 1 and removeItems == #addon.items then
for i = 1, #addon.items do
doPlayerRemoveItem(cid, addon.items[1], addon.items[2])
end
doPlayerRemoveMoney(cid, addon.cost)
doPlayerAddOutfit(cid, addon.outfit[1], addon.addon_type)
doPlayerAddOutfit(cid, addon.outfit[2], addon.addon_type)
setPlayerStorageValue(cid, storage + item.actionid, 1)
doPlayerSendTextMessage(cid, 21, "Now you can wear the full Demonhunter Outfit!")
else
if addon.cost ~= 0 then
msg = "Sorry, not possible."
else
msg = "Sorry, not possible."
end
if #addon.items > 0 then
for i = 1, #addon.items do
msg = msg..""..addon.items[2].."x "..getItemNameById(addon.items[1]).." "
end
end
doPlayerSendTextMessage(cid, 21, msg.."for the "..addon.name..".")
end
else
doPlayerSendTextMessage(cid, 21, "You already have the full Demonhunter Outfit")
end
return TRUE
end
 
ActionID of the item that you're trying to use doesn't exist as an index in table config.
You will either have to change the index numbers, or register this action for correct actionIDs.
 
ActionID of the item that you're trying to use doesn't exist as an index in table config.
You will either have to change the index numbers, or register this action for correct actionIDs.

Ok, Can you explain how to do that ?

no errors left atm.

He already explained what you have to do <_<.
 
It will be work on 0.3.6 version? And how does it work? One lever for one addon?
 
Use:
Code:
for i = 1, #addon.outfits do
	doPlayerAddOutfits(cid, addon.outfits[i][1], addon.outfits[i][2])
end

Instead of:
Code:
                        doPlayerAddOutfit(cid, addon.outfit[1], addon.addon_type)
                        doPlayerAddOutfit(cid, addon.outfit[2], addon.addon_type)

And table:
Code:
outfits = {{126, 3}, {231, 2}}

More configurable :thumbup:
 
Back
Top