[ function onUse(cid, item, fromPosition, itemEx, toPosition)
local reward = config[item.actionid]
if getPlayerItemCount(cid, 9020) >= reward.cost then
Added = doPlayerAddItem(cid,item.actionid,reward.amount)
doChangeTypeItem(Added, reward.amount)
doPlayerRemoveItem(cid,9020,reward.cost)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought '..getItemArticleById(item.actionid)..' '..getItemNameById(item.actionid)..' for '..reward.cost..' tokens.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you do not have enough tokens.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..reward.cost.." tokens for "..getItemArticleById(item.actionid).." "..getItemNameById(item.actionid)..".")
end
return TRUE
end]
when i have enough tokens, and i right click on the item i want to buy, nothing happens, i just get the msg you cannot use this can anyone see any bugs in this script?
sorry its not tagged or quoted properly x.x
local reward = config[item.actionid]
if getPlayerItemCount(cid, 9020) >= reward.cost then
Added = doPlayerAddItem(cid,item.actionid,reward.amount)
doChangeTypeItem(Added, reward.amount)
doPlayerRemoveItem(cid,9020,reward.cost)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought '..getItemArticleById(item.actionid)..' '..getItemNameById(item.actionid)..' for '..reward.cost..' tokens.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you do not have enough tokens.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..reward.cost.." tokens for "..getItemArticleById(item.actionid).." "..getItemNameById(item.actionid)..".")
end
return TRUE
end]
when i have enough tokens, and i right click on the item i want to buy, nothing happens, i just get the msg you cannot use this can anyone see any bugs in this script?
sorry its not tagged or quoted properly x.x