as I can do to make this script more than one function?
i reppe who helps in this theard =)
Lua:
local t = {
container = 5926,
itemid = 2268,
subType = 3,
price = 7500
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerMoney(cid) >= t.price) then
local container = doCreateItemEx(t.container, 1)
for i = 1, getContainerCap(container) do
doAddContainerItem(container, t.itemid, t.subType)
end
if(doPlayerAddItemEx(cid, container, false) == RETURNVALUE_NOERROR) then
doPlayerRemoveMoney(cid, t.price)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bought " .. getContainerCap(container) .. "x " .. getItemDescriptionsById(t.itemid).plural .." for " .. price .." gold.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enough " .. (getPlayerFreeCap(cid) < getItemWeight(container, true) and "capacity." or "free space."))
end
else
doPlayerSendCancel(cid, "You don't have enough money.")
end
return true
end
i reppe who helps in this theard =)