• 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!

Click and buy system

Aardappel

Learning LUA
Joined
Dec 24, 2007
Messages
145
Reaction score
0
Hi,,

I have a question
how i make a click and buy system

example: that u click on a manafluid and get one bp of it;)



greetings,, Aardappel
 
i have a scipt for that im not going too realease it but it is like this i have a switch so when somone drag it they get 1sd and pay for it and if i will i can get 1bp sd health fluid and meny more
 
Code:
function onUse(cid, item, frompos, item2, topos)

container = doPlayerAddItem(cid, 2003, 1)
-- doPlayerAddItem(cid, 2003, 1) 2003 i the BACKPACK ID, can be changed to whatever you want.
-- doPlayerRemoveMoney(cid,5000) 5000 is how much money it should cost.
-- doAddContainerItem(container, 2268, 3) 2268 - The rune ID. 3 - The charges of the rune.

if item.itemid == 1945 and doPlayerRemoveMoney(cid,5000) == 1 then
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doTransformItem(item.uid,item.itemid+1)
 
elseif item.itemid == 1946 and doPlayerRemoveMoney(cid,5000) == 1 then
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doAddContainerItem(container, 2268, 3)
doTransformItem(item.uid,item.itemid-1)
 
else
doPlayerSendCancel(cid,"A backpack of sudden death runes costs 5000 gps.")
end

return 1
end

Just make a lever with an unique id.
When they click the lever they'll get a backpack of SD with 3 charges for 5k.
Just change the ID's to whatever you want. :)

Hope it helped!
 
Last edited:
so if i just put an lever on a sudden death rune and u click on the lever i got an bp sd? but what unique id i need to give the lever?
 
You need to have an unique ID on the lever, else nothing will happen.
The ID number doesn't matter just write some number and don't forget to add it in ACTIONS also.
 
a bit smaller:)
Code:
function onUse(cid, item, frompos, item2, topos)

container = doPlayerAddItem(cid, 2003, 1)
-- doPlayerAddItem(cid, 2003, 1) 2003 i the BACKPACK ID, can be changed to whatever you want.
-- doPlayerRemoveMoney(cid,5000) 5000 is how much money it should cost.
-- doAddContainerItem(container, 2268, 3) 2268 - The rune ID. 3 - The charges of the rune.

if item.itemid == 1945 and doPlayerRemoveMoney(cid,5000) == 1 then
	for i = 1,20 do
	doAddContainerItem(container, 2268, 3)
	end
	doTransformItem(item.uid,item.itemid+1)
 
elseif item.itemid == 1946 and doPlayerRemoveMoney(cid,5000) == 1 then
	for i = 1,20 do
	doAddContainerItem(container, 2268, 3)
	end
	doTransformItem(item.uid,item.itemid-1)
 
else
doPlayerSendCancel(cid,"A backpack of sudden death runes costs 5000 gps.")
end

return 1
end
 
You put this script in data/actions/scripts
then in mapeditor you can give any lever the unique id you want.
then in data/actions/actions.xml you make a new line.
then you write that unique id you did in mapeditor and change the location of the script.
 
Back
Top