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

Leverscript ( Done but a little help)

Dalale

GX
Joined
Jun 13, 2008
Messages
718
Reaction score
2
Location
Sweden
Code:
local config = {
	[21008] = { 20020, 2003, 2273, 100, 20 },
	[21007] = { 20020, 2003, 2293, 45, 20 },
	[21010] = { 300020, 2003, 2305, 35, 20 },
	[21000] = { 40020, 2003, 2268, 100, 20 },
	[21002] = { 200020, 2003, 2278, 2, 20 },
	[21001] = { 20020, 2001, 2298, 50, 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

Wondring if somone could fix this percetly since it works now but sometimes it poop up a big error like this
Code:
[10/02/2009  17:45:56] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:56] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:56] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:56] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:56] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:56] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:56] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:56] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:57] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:57] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:57] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:57] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:57] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:57] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:58] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:58] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:58] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:58] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:58] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:58] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:58] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:59] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:59] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:59] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:59] Lua Script Error: [Action Interface] 
[10/02/2009  17:45:59] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:45:59] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:45:59] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:00] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:00] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:00] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:00] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:00] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:00] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:01] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:01] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:01] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:01] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:01] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:01] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:01] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:02] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:02] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:02] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:02] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:02] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:02] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:03] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:03] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:03] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:03] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:03] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:03] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:04] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:04] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:04] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:04] luaDoAddContainerItem(). Could not add item

[10/02/2009  17:46:04] Lua Script Error: [Action Interface] 
[10/02/2009  17:46:04] data/actions/scripts/tools/leverrune.lua:onUse

[10/02/2009  17:46:04] luaDoAddContainerItem(). Could not add item

Also if you can fix so you cannot spam when you buying:thumbup:
 
PHP:
local config = { 
effect = 39, 
aolPrice = 4000 
} 
local prices = { 
--[runeId] = {cost, charges, backpackColor, count}, 
--POTIONS-- 
[7618] = {800, 1, "red", 1}, --health potion 
[7620] = {900, 1, "purple", 1}, --mana potion 
[7588] = {1800, 1, "red", 1}, --strong health potion 
[7589] = {1500, 1, "purple", 1}, --strong mana potion 
[7591] = {3500, 1, "red", 1}, --great health potion 
[7590] = {2200, 1, "purple", 1}, --great mana potion 
[8472] = {3500, 1, "yellow", 1}, --great spirit potion 
[8473] = {5800, 1, "red", 1}, --ultimate health potion 
--RUNES-- 
[2273] = {3300, 1, "blue", 1}, --UH 
[2268] = {6600, 3, "grey", 1}, --SD 
[2313] = {4700, 6, "purple", 1}, --explosion 
[2287] = {600, 10, "green", 1}, --light magic missile 
[2311] = {2200, 10, "purple", 1}, --heavy magic missile 
[2304] = {3400, 4, "red", 1}, --great fireball 
[2302] = {1800, 5, "red", 1}, --fireball 
[2265] = {1800, 1, "grey", 1}, --IH 
[2261] = {800, 3, "grey", 1}, --destroy field 
[2316] = {7300, 1, "purple", 1}, --animate dead 
[2262] = {6500, 2, "grey", 1}, --energy bomb 
[2277] = {2200, 3, "blue", 1}, --energy field 
[2315] = {2800, 4, "purple", 1}, --thunderstorm 
[2274] = {3400, 4, "blue", 1}, --avalanche 
[2271] = {2900, 5, "blue", 1}, --icile 
[2308] = {4000, 3, "red", 1}, --soulfire 
[2285] = {1200, 3, "green", 1}, --poison field 
[2286] = {3200, 2, "green", 1}, --poison bomb 
[2289] = {4000, 4, "green", 1}, --poison wall 
[2290] = {1500, 1, "green", 1}, --convince creature 
[2291] = {4000, 1, "green", 1}, --chameleon 
[2292] = {2200, 10, "green", 1}, --stalagmite 
[2288] = {2800, 4, "green", 1}, --stone shower 
[2301] = {1600, 3, "red", 1}, --fire field 
[2305] = {4400, 2, "red", 1}, --firebomb 
[2303] = {4600, 4, "red", 1} --fire wall 
} 
----- 
function onUse(cid, item, fromPosition, itemEx, toPosition) 

local function backpackIdByName(name) 
local backpacksId = {["green"]=1998, ["yellow"]=1999, ["red"]=2000, ["purple"]=2001, ["blue"]=2002, ["grey"]=2003, ["golden"]=2004} 
    return backpacksId[name] or LUA_ERROR 

end 

local aid = item.actionid - 10000 

    if aid == 2173 then 
        if (doPlayerBuyItem(cid, 2173, 1, config.aolPrice, 1)) ~= LUA_ERROR then 
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've bought an amulet of loss.") 
            doSendMagicEffect(getCreaturePosition(cid), config.effect) 
        else 
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..config.aolPrice.." gold pieces.") 
        end 

    else 

                if (doPlayerBuyItemContainer(cid, backpackIdByName(prices[aid][3]), aid, 1, prices[aid][1], prices[aid][2])) == LUA_NO_ERROR then 
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've bought a backpack of "..getItemNameById(aid)..".") 
                    doSendMagicEffect(getCreaturePosition(cid), config.effect) 
                else 
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..prices[aid][1].." gold pieces.") 
                end 
    end 
    return TRUE 
end
 
PHP:
local config = { 
effect = 39, 
aolPrice = 4000 
} 
local prices = { 
--[runeId] = {cost, charges, backpackColor, count}, 
--POTIONS-- 
[7618] = {800, 1, "red", 1}, --health potion 
[7620] = {900, 1, "purple", 1}, --mana potion 
[7588] = {1800, 1, "red", 1}, --strong health potion 
[7589] = {1500, 1, "purple", 1}, --strong mana potion 
[7591] = {3500, 1, "red", 1}, --great health potion 
[7590] = {2200, 1, "purple", 1}, --great mana potion 
[8472] = {3500, 1, "yellow", 1}, --great spirit potion 
[8473] = {5800, 1, "red", 1}, --ultimate health potion 
--RUNES-- 
[2273] = {3300, 1, "blue", 1}, --UH 
[2268] = {6600, 3, "grey", 1}, --SD 
[2313] = {4700, 6, "purple", 1}, --explosion 
[2287] = {600, 10, "green", 1}, --light magic missile 
[2311] = {2200, 10, "purple", 1}, --heavy magic missile 
[2304] = {3400, 4, "red", 1}, --great fireball 
[2302] = {1800, 5, "red", 1}, --fireball 
[2265] = {1800, 1, "grey", 1}, --IH 
[2261] = {800, 3, "grey", 1}, --destroy field 
[2316] = {7300, 1, "purple", 1}, --animate dead 
[2262] = {6500, 2, "grey", 1}, --energy bomb 
[2277] = {2200, 3, "blue", 1}, --energy field 
[2315] = {2800, 4, "purple", 1}, --thunderstorm 
[2274] = {3400, 4, "blue", 1}, --avalanche 
[2271] = {2900, 5, "blue", 1}, --icile 
[2308] = {4000, 3, "red", 1}, --soulfire 
[2285] = {1200, 3, "green", 1}, --poison field 
[2286] = {3200, 2, "green", 1}, --poison bomb 
[2289] = {4000, 4, "green", 1}, --poison wall 
[2290] = {1500, 1, "green", 1}, --convince creature 
[2291] = {4000, 1, "green", 1}, --chameleon 
[2292] = {2200, 10, "green", 1}, --stalagmite 
[2288] = {2800, 4, "green", 1}, --stone shower 
[2301] = {1600, 3, "red", 1}, --fire field 
[2305] = {4400, 2, "red", 1}, --firebomb 
[2303] = {4600, 4, "red", 1} --fire wall 
} 
----- 
function onUse(cid, item, fromPosition, itemEx, toPosition) 

local function backpackIdByName(name) 
local backpacksId = {["green"]=1998, ["yellow"]=1999, ["red"]=2000, ["purple"]=2001, ["blue"]=2002, ["grey"]=2003, ["golden"]=2004} 
    return backpacksId[name] or LUA_ERROR 

end 

local aid = item.actionid - 10000 

    if aid == 2173 then 
        if (doPlayerBuyItem(cid, 2173, 1, config.aolPrice, 1)) ~= LUA_ERROR then 
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've bought an amulet of loss.") 
            doSendMagicEffect(getCreaturePosition(cid), config.effect) 
        else 
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..config.aolPrice.." gold pieces.") 
        end 

    else 

                if (doPlayerBuyItemContainer(cid, backpackIdByName(prices[aid][3]), aid, 1, prices[aid][1], prices[aid][2])) == LUA_NO_ERROR then 
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've bought a backpack of "..getItemNameById(aid)..".") 
                    doSendMagicEffect(getCreaturePosition(cid), config.effect) 
                else 
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..prices[aid][1].." gold pieces.") 
                end 
    end 
    return TRUE 
end

Its hard Config :p ty anyway still searching for help
 
Back
Top