All configs in script - for items and/or money! : )
You must add all addon's - i haven't many time. ; )
talkactions.xml
and in scripts - addons.lua:
You must add all addon's - i haven't many time. ; )
talkactions.xml
PHP:
<talkaction words="!buyaddon" script="addons.lua"/>
PHP:
ADDONS = {
["first citizen"] = { -- outfit name between quoteless
outfit = {128,136} -- outfit ids (for male and female)
addonId = 1, -- outfit id (like 1 for addon number 1)
pay = 0, -- cost of addons (can be items and money)
pacc = 1, -- need pacc for addon? 1 - yes, 0 - no
level = 50, -- level requipment for addon
promotion = 0, -- need promotion for addon? 1 - yes, 0 - no
items = { -- items for addon
{5878, 100} -- { itemid, count }
}
},
["second citizen"] = {
outfit = {128,136}
addonId = 2,
pay = 0,
pacc = 1,
level = 50,
promotion = 0,
items = {
{5902, 50},
{5890, 100},
{2480, 1}
}
},
["first nobleman"] = {
outfit = {140,132}
addonId = 1,
pay = 150000,
pacc = 1,
level = 150,
promotion = 1,
items = {} -- only for money, empty items table!!!
},
["second nobleman"] = {
outfit = {140,132}
addonId = 2,
pay = 300000,
pacc = 1,
level = 200,
promotion = 1,
items = {}
}
}
function onSay(cid, words, param)
local addon = ADDONS[string.lower(param)
local addAddon = 1
local outfit = addon.outfit
local getAddon = 0
if addon then
if(getPlayerLevel(cid) >= addon.level)then
if isPremium(cid) == addon.pacc then
if getPlayerPromotionLevel(cid) >= addon.promotion then
if getPlayerMoney(cid) >= addon.pay then
local items = addon.items
for i=1,#items do
if addAddon ~= 0 then
if getPlayerItemCount(cid, items[i][1]) < items[i][2] then
addAddon = 0
i = #items
end
end
for i=1, #outfit do
if getPlayerAddOutfit(cid,outfit[i]) == addon.addonId then
getAddon = 1
end
end
if getAddon ~= 1 then
if addAddon == 1 then
for i=1,#items do
doPlayerRemoveItem(cid, items[i][1], items[i][2])
end
doPlayerRemoveMoney(cid, addon.pay)
for i=1, #outfit do
doPlayerAddOutfit(cid,outfit[i], addon.addonId)
end
else
doPlayerSendCancel(cid, "You don't have required items for this addon.")
end
else
doPlayerSendCancel(cid, "You already have this addon.")
end
end
else
doPlayerSendCancel(cid, "You must pay " .. addon.pay .. " gp for this addon.")
end
else
doPlayerSendCancel(cid, "You need Promotion to buy this addon.")
end
else
doPlayerSendCancel(cid, "You need Premium Account to buy this addon.")
end
else
doPlayerSendCancel(cid, "You need " .. addon.level .. " for this addon.")
end
end
end