I've got this script, which gives me a golden nugg each time I press a lever.
My question is: How can I make it so that whenever I buy a gold nugget it stacks with other gold nuggets. Simple as that.
My question is: How can I make it so that whenever I buy a gold nugget it stacks with other gold nuggets. Simple as that.
Code:
----- Config -----
local config = {
cost = 100, -- Price
item_id = 2157, -- item
}
local name = getItemNameById(2157) -- Same as item_id above
----- End Config -----
function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
local bp = doPlayerAddItem(cid, config.item_id , 1)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doSendAnimatedText(fromPosition, "Exchanged", TEXTCOLOR_RED)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You changed ".. name .."s for ".. config.cost .." gold.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need ".. config.cost .." gold to change coins to ".. name .."s.")
end
return TRUE
end