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

Scripters welcome. Lever Script

Eraser

Hoster
Joined
Jul 20, 2007
Messages
29
Reaction score
0
Location
Muntlix (Austria)
Hej to all, i need an Lever script.
If i use a lever, ill get the item which is under the lever, btw. everytime i use the lever i have to pay a prize.

Example1: 1 Lever Use = 800 Gold = Backpack of Manafluid
Example2: 1 Lever Use = 1500 Gold = Backpack of Sudden Death Runes

Could some1 help me with my problems?
Thx 4 now. I hope some1 can help me.
 
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[20000] = { 1500, 2003, 2268, 3, 20 },
	[20001] = { 1000, 2001, 2273, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v.1) == TRUE then
				local container = v.2
				for i = 1, v.5 do
					doAddContainerItem(container, v.3, v.4)
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v.1.." gold.")
			end
		end
	end
	return TRUE
end
 
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[20000] = { 1500, 2003, 2268, 3, 20 },
	[20001] = { 1000, 2001, 2273, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v.1) == TRUE then
				local container = v.2
				for i = 1, v.5 do
					doAddContainerItem(container, v.3, v.4)
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v.1.." gold.")
			end
		end
	end
	return TRUE
end


Gonna test, posting results!

EDIT :
DIDNT WORK :
[06/01/2009 20:06:04] Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/leverrune.lua
[06/01/2009 20:06:04] data/actions/scripts/tools/leverrune.lua:10: ')' expected near '.1'
[06/01/2009 20:06:04] Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/leverrune.lua
[06/01/2009 20:06:04] data/actions/scripts/tools/leverrune.lua:10: ')' expected near '.1'
 
Last edited:
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[20000] = { 1500, 2003, 2268, 3, 20 },
	[20001] = { 1000, 2001, 2273, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
				local container = v[2]
				for i = 1, v.5 do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end
 
=/

Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[20000] = { 1500, 2003, 2268, 3, 20 },
	[20001] = { 1000, 2001, 2273, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
				local container = v[2]
				for i = 1, v.5 do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end
Sorry man :// Thanks for your help,continue, but
Error :

[06/01/2009 20:37:17] Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/leverrune.lua
[06/01/2009 20:37:17] data/actions/scripts/tools/leverrune.lua:12: 'do' expected near '.5'
[06/01/2009 20:37:17] Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/leverrune.lua
[06/01/2009 20:37:17] data/actions/scripts/tools/leverrune.lua:12: 'do' expected near '.5'
 
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[20000] = { 1500, 2003, 2268, 3, 20 },
	[20001] = { 1000, 2001, 2273, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
				local container = v[2]
				for i = 1, v[5] do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end

You could fix it urself :S
 
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[20000] = { 1500, 2003, 2268, 3, 20 },
	[20001] = { 1000, 2001, 2273, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
				local container = v[2]
				for i = 1, v[5] do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end

You could fix it urself :S

Lol i didnt get any error this time. but still does not work :O
my script

Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[21008] = { 1500, 2003, 2268, 3, 20 },
	[21001] = { 1000, 2001, 2298, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
				local container = v[2]
				for i = 1, v[5] do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end
 
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[21008] = { 1500, 2003, 2268, 3, 20 },
	[21001] = { 1000, 2001, 2298, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
	local container = doPlayerAddItem(cid, v[2], 1)
				for i = 1, v[5] do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end

still aint working, no bugs.. aff

btw here is my action.xml

Code:
	<action itemid="21001" script="tools/leverrune.lua"/>
	<action itemid="21008" script="tools/leverrune.lua"/>
 
Code:
local config = {
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }
	[21008] = { 1500, 2003, 2268, 3, 20 },
	[21001] = { 1000, 2001, 2298, 1, 20 }
}

function onUse(cid, item)
	for k, v in pairs(config) do
		if item.actionid == k then
			if doPlayerRemoveMoney(cid, v[1]) == TRUE then
	local container = doPlayerAddItem(cid, v[2], 1)
				for i = 1, v[5] do
					doAddContainerItem(container, v[3], v[4])
				end
			else
				doPlayerSendCancel(cid, "Not enough gold. You need "..v[1].." gold.")
			end
		end
	end
	return TRUE
end

still aint working, no bugs.. aff

btw here is my action.xml

Code:
	<action itemid="21001" script="tools/leverrune.lua"/>
	<action itemid="21008" script="tools/leverrune.lua"/>

itemid?

It is supposed to be an actionid.
 
There is explanatation:
Code:
-- actionID = { price, backpackID, itemID, itemTYPE, itemCount }

Remember to put a comma (,) before the last key ( [xxxx] ).

If you still dont get the thing that is up>

[actionid] = { price in gp, id of the backpcak, id of the rune/item, charges (for runes), how many in backpack }
 
Back
Top