- Joined
- Jun 19, 2009
- Messages
- 1,852
- Reaction score
- 5
@up
Code:
local shop = {
["aol"] = { id = 2173, count = 1, cost = 10000 },
["backpack"] = { id = 1988, count = 1, cost = 50 },
["bag"] = { id = <id of bag>, count = 1, cost = 20 }
}
function onSay(cid, words, param, channel)
local cfg = shop[param]
if(param == "") then
doPlayerSendCancel(cid, "Command requires param.")
elseif(getPlayerMoney(cid) < cfg.cost) then
doPlayerSendCancel(cid, "You do not have enough money.")
else
doPlayerRemoveMoney(cid, cfg.cost)
doPlayerAddItem(cid, cfg.id, cfg.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased " .. getItemNameById(cfg.id) .. ".")
end
return true
end