Hi, I trying to script a talkaction script for my server.
I want players on my server shold be able to buy addons any were.
So i want a talkaction script that makes it able to buy addons with money using the command
!addon "OutfitName
This is what i have done using the current addon.lua in TFS 1.0.
I want players on my server shold be able to buy addons any were.
So i want a talkaction script that makes it able to buy addons with money using the command
!addon "OutfitName
This is what i have done using the current addon.lua in TFS 1.0.
Code:
local text = '--Addon List--\n!addon "citizen\n!addon "hunter\n!addon "mage\n!addon "knight\n!addon "summoner\n!addon "warrior\n!addon "barbarian\n!addon "druid\n!addon "wizard\n!addon "oriental\n!addon "pirate\n!addon "assassin\n!addon "beggar\n!addon "beggar\n!addon "shaman\n!addon "norseman\n!addon "nightmare\n!addon "jester\n!addon "brotherhood\n!addon "warmaster\n--Addon List End--'
function onSay(cid, worlds, param)
local cfg = {
["citizen"] = {
outfit = {
male = 128,
female = 136,
addon = 3,
storage = 10032
},
cost = {
price = 60000
}
},
}
local v, removeItems = cfg[param], 0, 0
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Please type !addon "outfit')
doShowTextDialog(cid, 5914, text)
return false
end
if(v == nil) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is no such as outfit named "..param..", here is the list of available outfit.")
doShowTextDialog(cid, 5914, text)
return false
end
if(getPlayerStorageValue(cid, v.outfit.storage) < 1) then
if(doPlayerRemoveMoney(cid, v.cost.price) == TRUE) then
if(getPlayerSex(cid) == 1) then
doPlayerAddOutfit(cid, v.outfit.male, v.outfit.addon)
elseif(getPlayerSex(cid) == 0) then
doPlayerAddOutfit(cid, v.outfit.female, v.outfit.addon)
end
end
else
doPlayerSendCancel(cid, "You dont have enoght money. You need "..v.outfit.price.." to buy that addon.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end