Thunder Beam
New Member
- Joined
- Apr 23, 2008
- Messages
- 107
- Reaction score
- 0
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