psilocibe
Member
- Joined
- Jul 9, 2007
- Messages
- 479
- Reaction score
- 8
Hello guys,
I have an action where simply click the item to buy it. Here is the code.
How do I buy a random item by changing this code ?
I have an action where simply click the item to buy it. Here is the code.
Code:
local config = {
cost = 25000,
rune_id = 8472
}
function onUse(cid, item, frompos, fromPosition, itemEx, toPosition, topos)
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
local name = getItemName(8472)
local bp = doPlayerAddItem(cid, config.rune_id, 100)
doSendMagicEffect({x=380,y=343,z=7}, CONST_ME_STUN)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You buy 100x ".. name .."s por ".. config.cost .." golds.")
for i=1,1 do
end
else
doPlayerSendCancel(cid, "Voce nao tem ".. config.cost .." golds.")
end
return TRUE
end
How do I buy a random item by changing this code ?