• 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 Get Bp Mana if use Switch

spash

I
Joined
Jul 21, 2007
Messages
182
Reaction score
2
Location
Germany
Hello i need a Script that gives a Backpack Mana if i use the Switch.
Would be great if anyone can help me. :p
 
PHP:
config = {
 cost = 2000, -- cost of potions
 potion_id = 6666, -- id of potion
 potion_type = 7, -- type of potion
 backpack_id = 1988 -- itemid of backpack
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

 if doPlayerRemoveMoney(cid, config.cost) == TRUE then
 local bp = doPlayerAddItem(cid, config.backpack_id, 1)
  for i=1,20 do
   doContainerAddItem(bp, config.potion_id, config.potion_type)
  end
 end
end

:))
 
PHP:
config = {
 cost = 2000, -- cost of potions
 potion_id = 6666, -- id of potion
 potion_type = 7, -- type of potion
 backpack_id = 1988 -- itemid of backpack
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

 if doPlayerRemoveMoney(cid, config.cost) == TRUE then
 local bp = doPlayerAddItem(cid, config.backpack_id, 1)
  for i=1,20 do
   doContainerAddItem(bp, config.potion_id, config.potion_type)
  end
 end
end

:))

Why the "for i".. I can't see you using it anywhere ?
 
can be while or repeat until.. but can be for, i can use anyone but i like for ; )
 
This is the best:
local runemana =
{
[2233] = {8704, 400}, -- bp small health potion
[2234] = {7618, 900}, -- bp health potion
[2235] = {7620, 1000}, -- bp mana potion
[2236] = {7588, 2000}, -- bp strong health potion
[2237] = {7589, 1600}, -- bp strong mana potion
[2238] = {7591, 3800}, -- bp great health potions
[2239] = {7590, 2400}, -- bp great mana potions
[2240] = {8472, 3800}, -- bp great spirit potions
[2241] = {8473, 6200}, -- bp ultimate health potions
[2242] = {8474, 2000}, -- bp antidote potions
[2243] = {2268, 7000}, -- bp sd rune
[2244] = {2313, 5000}, -- bp explosion rune
[2245] = {2304, 3600}, -- bp gfb rune
[2246] = {2311, 2400}, -- bp hmm rune
[2247] = {2273, 3500} -- bp uh rune
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(cid)
if item.itemid == 1945 or item.itemid == 1946 then
local rune = runemana[item.actionid]
if rune then
if doPlayerRemoveMoney(cid, rune[2]) == TRUE then
local container = doPlayerAddItem(cid,1988,1)
for i = 1, 20 do
doAddContainerItem(container, rune[1], i)
doSendAnimatedText(pos, "Thanks", TEXTCOLOR_RED)
end
else
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "You dont have money")
end
end
end
return TRUE
end




Have a nice day, you like me? give me money :D pm me for more infos :D
 
This is the best

This is the best:
data/actions/scripts/leverRunes.lua
PHP:
-- by Keraxel // for otcentrum.pl
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

data/actions/actions.xml
PHP:
<action itemid="3622" script="leverRunes.lua"/>

:)
 
Last edited:
how to use it man i couldnt figure it out
i put the runes on serv and gave them actionid 10000 and nothing
im doin it wrong halp xD
 
I cant get it to work :s noting happends when i press the rock, ive even changed it to an leaver, neither do i get any errors in my console
 
data/actions/actions.xml
PHP:
<action itemid="3622" script="leverRunes.lua"/>

If you don't know how to make it works - don't use it.
 
I dont see why it need to be
<action """""""""""itemid""""""""""""="3622" script="leverRunes.lua"/>
Becouse in your script it dont say anyting about the item id 3622 :s
 
Last edited:
Back
Top