local mp_id = 7590 -- ID da potion
local customp_id = 120 -- Valor de cada potion
local cargasmp_id = 100 -- Cargas se não usar a talkaction
local peso = 1.50 -- Peso da potion
local name = getItemNameById(mp_id)
----- End Config -----
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) >= getPlayerStorageValue(cid, 180257) * customp_id then
if getPlayerStorageValue(cid, 180257) >= 1 then
if getPlayerFreeCap(cid) >= peso * getPlayerStorageValue(cid, 180257) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce comprou ".. getPlayerStorageValue(cid, 180257) .." potions por ".. customp_id * getPlayerStorageValue(cid, 180257) .." gold.")
for i=1,1 do
doPlayerAddItem(cid,mp_id, getPlayerStorageValue(cid, 180257))
doPlayerRemoveMoney(cid, getPlayerStorageValue(cid, 180257) * customp_id)
end
else
doPlayerSendTextMessage(cid,24,"Você não tem cap suficiente.")
end
elseif
getPlayerMoney(cid) >= cargasmp_id * customp_id then
doPlayerAddItem(cid,mp_id, cargasmp_id)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você comprou ".. cargasmp_id .." potions por ".. customp_id * cargasmp_id .." golds.")
doPlayerRemoveMoney(cid, cargasmp_id * customp_id)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você não tem ".. customp_id * cargasmp_id .." golds.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você não tem ".. customp_id * getPlayerStorageValue(cid, 180257) .." golds.")
end
return FALSE
end