dave182
New Member
- Joined
- Jan 23, 2009
- Messages
- 80
- Reaction score
- 3
Hi, I'm requesting a script for the action that u pull a lever and it gives u a backpack with POTS, because the one i have isn't working, I pull a lever and it just gives the backpack without potions inside. Look at this, for example, Great MP:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- by Maxi (Shawak)
local config = {
cost = 1000,
item_id = 7591,
backpack_id = 2001
}
local container = doPlayerAddItem(cid, config.backpack_id, 1)
local itemweight = getItemWeight(config.item_id, 1)
local playerCap = getPlayerFreeCap(cid)
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
if playerCap >= itemweight then
if item.itemid == 1945 then
new_id = 1946
elseif item.itemid == 1946 then
new_id = 1945
end
doTransformItem(item.uid,new_id)
for i = 1, 20 do
doAddContainerItem(container, config_item_id, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You bought 1 "..getItemNameById(config.backpack_id).." of "..getItemNameById(config.item_id).." for "..config.cost.." gp.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need more free cap.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You don't have enough money.")
end
return TRUE
end