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

[Action] Shop lever

XouruS

Active Member
Joined
Dec 29, 2009
Messages
941
Reaction score
36
Location
Canada
as the title says, i need a action when u pull a lever/ remove x $/ adds x item to bp

i rep++

ty in advance.
 
http://otland.net/f81/lever-rune-s-system-50808/

Search next time. You can find a lot here.

LUA:
local config = {
	[100] = {item, count, price},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = config[item.actionid]
	if v then
		if getPlayerMoney(cid) >= v[3] then
			local id = doCreateItemEx(v[1], v[2] or 1)
			if(doPlayerAddItemEx(cid, id, true) ~= RETURNVALUE_NOERROR) then
				return doPlayerSendCancel(cid, "Sorry, you cannot carry this."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
			end
			
			doPlayerRemoveMoney(cid, v[3])
			doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(cid, "You have bought a " .. getItemInfo(v[1]).name .. "!")
		else
			return doPlayerSendCancel(cid, "Sorry, you don't have enough money."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		end
	end
	
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Last edited:
Back
Top