Hermes
dziwki kola gramy w lola
Hi there!
I know that there are many released scripts for this action, but I noticed that every sucks, because when player does not have money he receives empty backpack.
I have modified it a bit (took me 5 seconds lmao) and I have decided to release it, someone might need it xd:
also you can use more advanced version aswell (thanks to josejunior23):
It's working for me like a charm ;>
Regards,
Hermes
@updated, 22.04, bugfix
I know that there are many released scripts for this action, but I noticed that every sucks, because when player does not have money he receives empty backpack.
I have modified it a bit (took me 5 seconds lmao) and I have decided to release it, someone might need it xd:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local container = 0
local cost = 6200
local potion_id = 8473
local backpack_id = 2000
if(item.itemid == 1945) then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
doTransformItem(item.uid, item.itemid+1)
container = doPlayerAddItem(cid, backpack_id, 1)
for i = 1, 20 do
doAddContainerItem(container, potion_id)
end
else
doPlayerSendCancel(cid,"Sorry, you don't have enough money.")
end
elseif(item.itemid == 1946) then
doTransformItem(item.uid, item.itemid-1)
end
return TRUE
end
also you can use more advanced version aswell (thanks to josejunior23):
Code:
local config = {
--[actionid] = {backpack_id = ID OF BACKPACK, potion_id = ID OF POTION, cost = COST OF BP WITH POTIONS
[1522] = {backpack_id = 2000, potion_id = 8473, cost = 6000}, -- example with ultimate health potion
[1517] = {backpack_id = 2001, potion_id = 7590, cost = 4000} -- example with great mana potion
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local container = 0
if(item.itemid == 1945) then
if(doPlayerRemoveMoney(cid, CONFIG[item.actionid].cost) == TRUE) then
doTransformItem(item.uid, item.itemid+1)
container = doPlayerAddItem(cid, CONFIG[item.actionid].backpack_id, 1)
for i = 1, 20 do
doAddContainerItem(container, CONFIG[item.actionid].potion_id)
end
else
doPlayerSendCancel(cid, "Sorry, you don't have enough money.")
end
elseif(item.itemid == 1946) then
doTransformItem(item.uid, item.itemid-1)
end
return TRUE
end
It's working for me like a charm ;>
Regards,
Hermes
@updated, 22.04, bugfix
Last edited: