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

HALP! AJUDA! Script doesnt work D:

StreamSide

Joseluis Gonzalez
Staff member
Support Team
Joined
Aug 31, 2007
Messages
3,608
Solutions
51
Reaction score
1,224
Location
Arica - Chile
Code:
local runemana = 
{ 
	["2233"] = {{8704}, {2152}, {4} },  -- bp small health potion
	["2234"] = {{7618}, {2152}, {9} },  -- bp health potion
	["2235"] = {{7620}, {2152}, {10} },  -- bp mana potion
	["2236"] = {{7588}, {2152}, {20} },  -- bp strong health potion
	["2237"] = {{7589}, {2152}, {16} },  -- bp strong mana potion
	["2238"] = {{7591}, {2152}, {38} },  -- bp great health potions
	["2239"] = {{7590}, {2152}, {24} },  -- bp great mana potions
	["2240"] = {{8472}, {2152}, {38} },  -- bp great spirit potions
	["2241"] = {{8473}, {2152}, {62} },  -- bp ultimate health potions
	["2242"] = {{8474}, {2152}, {20} },  -- bp antidote potions
	["2243"] = {{2268}, {2152}, {70} },  -- bp sd rune
	["2244"] = {{2313}, {2152}, {50} },  -- bp explosion rune
	["2245"] = {{2304}, {2152}, {36} },  -- bp gfb rune
	["2246"] = {{2311}, {2152}, {24} },  -- bp hmm rune
	["2247"] = {{2273}, {2152}, {35} }  -- bp uh rune
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for action, item in pairs(runemana) do
			if item.actionid == action then
				local container = doPlayerAddItem(cid,1988,1)
					doAddContainerItem(container, item[1], 20)
					doRemoveItem(cid, item[2], item[3])
				end
			end

	return TRUE
end

And i dont know why :D
 
PHP:
local runemana = 
{ 
    [2233] = {8704, 2152, 4},  -- bp small health potion
    [2234] = {7618, 2152, 9},  -- bp health potion
    [2235] = {7620, 2152, 10},  -- bp mana potion
    [2236] = {7588, 2152, 20},  -- bp strong health potion
    [2237] = {7589, 2152, 16},  -- bp strong mana potion
    [2238] = {7591, 2152, 38},  -- bp great health potions
    [2239] = {7590, 2152, 24},  -- bp great mana potions
    [2240] = {8472, 2152, 38},  -- bp great spirit potions
    [2241] = {8473, 2152, 62},  -- bp ultimate health potions
    [2242] = {8474, 2152, 20},  -- bp antidote potions
    [2243] = {2268, 2152, 70},  -- bp sd rune
    [2244] = {2313, 2152, 50},  -- bp explosion rune
    [2245] = {2304, 2152, 36},  -- bp gfb rune
    [2246] = {2311, 2152, 24},  -- bp hmm rune
    [2247] = {2273, 2152, 35}  -- bp uh rune
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local rune = runemana[item.actionid]
    if rune then
        local container = doPlayerAddItem(cid,1988,1)
        for i = 1, 20 do
            doAddContainerItem(container, rune[1], 1)
            doRemoveItem(cid, rune[2], rune[3])
        end
    end
    return TRUE
end

BTW it still have many issues
 
This will give you a backpack and fill it with runes until you can't pay...

e.g. 1 mana potion cost 1000gp and you have 12k then it will give you 12 mana potions...
PHP:
local runemana = 
{
    [2233] = {itemid = 8704, price = 400}, -- bp small health potion
    [2234] = {itemid = 7618, price = 900}, -- bp health potion
    [2235] = {itemid = 7620, price = 1000},  -- bp mana potion
    [2236] = {itemid = 7588, price = 2000}, -- bp strong health potion
    [2237] = {itemid = 7589, price = 1600}, -- bp strong mana potion
    [2238] = {itemid = 7591, price = 3800}, -- bp great health potions
    [2239] = {itemid = 7590, price = 2400}, -- bp great mana potions
    [2240] = {itemid = 8472, price = 3800}, -- bp great spirit potions
    [2241] = {itemid = 8473, price = 6200}, -- bp ultimate health potions
    [2242] = {itemid = 8474, price = 2000}, -- bp antidote potions
    [2243] = {itemid = 2268, price = 7000}, -- bp sd rune
    [2244] = {itemid = 2313, price = 5000}, -- bp explosion rune
    [2245] = {itemid = 2304, price = 3600}, -- bp gfb rune
    [2246] = {itemid = 2311, price = 2400}, -- bp hmm rune
    [2247] = {itemid = 2273, price = 3500}  -- bp uh rune
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local rune = runemana[item.actionid]
    if rune then
        local container = doPlayerAddItem(cid, 1988, 1)
        for _ = 1, 20 do
            if doPlayerRemoveMoney(cid, rune.price) == TRUE then
                doAddContainerItem(container, rune.itemid, 1)
            else
                -- you cant buy more
                break
            end
        end
    end
    return TRUE
end

But this one will give you all 20 and if you can't pay 1000*20 then you cant buy...
PHP:
local runemana = 
{
    [2233] = {itemid = 8704, price = 400}, -- bp small health potion
    [2234] = {itemid = 7618, price = 900}, -- bp health potion
    [2235] = {itemid = 7620, price = 1000},  -- bp mana potion
    [2236] = {itemid = 7588, price = 2000}, -- bp strong health potion
    [2237] = {itemid = 7589, price = 1600}, -- bp strong mana potion
    [2238] = {itemid = 7591, price = 3800}, -- bp great health potions
    [2239] = {itemid = 7590, price = 2400}, -- bp great mana potions
    [2240] = {itemid = 8472, price = 3800}, -- bp great spirit potions
    [2241] = {itemid = 8473, price = 6200}, -- bp ultimate health potions
    [2242] = {itemid = 8474, price = 2000}, -- bp antidote potions
    [2243] = {itemid = 2268, price = 7000}, -- bp sd rune
    [2244] = {itemid = 2313, price = 5000}, -- bp explosion rune
    [2245] = {itemid = 2304, price = 3600}, -- bp gfb rune
    [2246] = {itemid = 2311, price = 2400}, -- bp hmm rune
    [2247] = {itemid = 2273, price = 3500}  -- bp uh rune
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local rune = runemana[item.actionid]
    if rune then
        local price = rune.price * 20
        if doPlayerRemoveMoney(cid, price) == TRUE then
            local container = doPlayerAddItem(cid, 1988, 1)
            for _ = 1, 20 do
                doAddContainerItem(container, rune.itemid, 1)
            end
        else
            -- not enough money
        end
    end
    return TRUE
end

But this one has absolute price, so if you write 1000 it will mean whole bp of mana potions cost 1k not a single one ^.-
PHP:
local runemana = 
{
    [2233] = {itemid = 8704, price = 400}, -- bp small health potion
    [2234] = {itemid = 7618, price = 900}, -- bp health potion
    [2235] = {itemid = 7620, price = 1000},  -- bp mana potion
    [2236] = {itemid = 7588, price = 2000}, -- bp strong health potion
    [2237] = {itemid = 7589, price = 1600}, -- bp strong mana potion
    [2238] = {itemid = 7591, price = 3800}, -- bp great health potions
    [2239] = {itemid = 7590, price = 2400}, -- bp great mana potions
    [2240] = {itemid = 8472, price = 3800}, -- bp great spirit potions
    [2241] = {itemid = 8473, price = 6200}, -- bp ultimate health potions
    [2242] = {itemid = 8474, price = 2000}, -- bp antidote potions
    [2243] = {itemid = 2268, price = 7000}, -- bp sd rune
    [2244] = {itemid = 2313, price = 5000}, -- bp explosion rune
    [2245] = {itemid = 2304, price = 3600}, -- bp gfb rune
    [2246] = {itemid = 2311, price = 2400}, -- bp hmm rune
    [2247] = {itemid = 2273, price = 3500}  -- bp uh rune
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local rune = runemana[item.actionid]
    if rune then
        if doPlayerRemoveMoney(cid, rune.price) == TRUE then
            local container = doPlayerAddItem(cid, 1988, 1)
            for _ = 1, 20 do
                doAddContainerItem(container, rune.itemid, 1)
            end
        else
            -- not enough money
        end
    end
    return TRUE
end
 
Here is my old script which I've created for other forum :p
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-----
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
}
-----

local function backpackIdByName(name)
backpacksId = {["green"]=1998, ["yellow"]=1999, ["red"]=2000, ["purple"]=2001, ["blue"]=2002, ["grey"]=2003, ["golden"]=2004}
	for a, b in pairs(backpacksId) do
		if name == a then
			return b
		end
	end
return LUA_ERROR
end


	if (item.actionid - 10000) == 2173 then
		if (doPlayerBuyItem(cid, 2173, 1, config.aolPrice, 1)) ~= LUA_ERROR then
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You was 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 40000 gold pieces.")	
		end

	else
		for k, v in pairs(prices) do
			if (item.actionid - 10000) == k then
				if (doPlayerBuyItemContainer(cid, backpackIdByName(v[3]), k, 1, v[1], v[2])) == LUA_NO_ERROR then
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You was bought a backpack of "..getItemNameById(k)..".")
					doSendMagicEffect(getCreaturePosition(cid), config.effect)
				else
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..v[1].." gold pieces.")
				end
				break
			end	
		end
	end
	return TRUE
end
 
Back
Top