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

Potion Lever

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
Can someone edit my script to buy bag great spirit potion with 50 charges each

Code:
local config = {
	[6000] = {potion = 8472, cost = 152000, backpack_id = 1996, charges = 50},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = config[item.uid]
	if isInArray({1945, 1946}, item.itemid) ~= TRUE then
		return TRUE
	end
	if doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, 1, potion.charges) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a bag "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a bag "..getItemNameById(potion.potion)..".")
	end
	return TRUE
end
 
LUA:
local config = {
	[6000] = {id = 8472, cost = 152000, backpack_id = 1996, charges = 50},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = config[item.uid]
	if doPlayerBuyItemContainer(cid, v.backpack_id, v.id, 1, v.cost, v.charges) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought ' .. getItemInfo(v.backpack_id).maxItems .. 'x ' .. getItemInfo(v.id).plural .. ' for ' .. v.cost .. ' gold.')
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need ' .. v.cost .. ' gold for ' .. getItemInfo(v.backpack_id).maxItems .. 'x ' .. getItemInfo(v.id).plural .. '.')
	end
	return true
end
 
Last edited:
Back
Top