• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action 20 Itens inside a backpack!

Tprocheira

New Member
Joined
Apr 2, 2008
Messages
103
Reaction score
0
Hi there!
You know, sometimes you waste a LONG time buying potions (well, not that much now with that 'Buy with backpack' function), and have to arrange your money to buy the exact amount of potions?
Well, I've made this code, so that you can buy ANYTHING you want within a full backpack!!
Code:
local price = [color=blue]3020[/color] --Backpack+Potions
local addItem = [color=red]7590[/color] --Great Mana Potion

--100% by Tprocheira

function onUse(cid, item, item2, fromPosition, toPosition)
if getPlayerMoney(cid) >= price then
doPlayerRemoveMoney(cid, price)
container = doPlayerAddItem(cid, 2000)
for i = 1, 20 do
doAddContainerItem(container, addItem)
end
else
doPlayerSendCancel(cid, "Sorry, you don't have enough money!")
end
end
And, that's it!
You just have to change the local variables to whatever you want.
First one is the price, second one is item to be added.
(Rep++ :p)

\\
 
:p
Thanks.
The only script that does the same uses lots of repeated lines (doAddContainerItem 20 times).
With loops it is reduced :p
REP++ please :p


\\
 
I think I've seen at least 4 of these scripts, with loops as well.
 
please help with the npc system to make the buying with backpack function on tfs 2.4
 
Back
Top Bottom