• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Searching for golden nugget npc, or lever system!

beybus

New Member
Joined
Oct 2, 2010
Messages
110
Reaction score
2
Hi, im wondering how to make npc which will sell items for nuggets or lever system.
Any1 seen smth like this?
 
to get it to work properly with trade window you'll need to source edit. suggest finding some lever script and using doPlayerRemoveItem instead of money
 
Cyko always on watch! :)
I found levers that sells runes for money, but script looks like that:


Code:
local config = {
        [1248] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = 3}, -- sudden death rune
        [1249] = {potion = 2269, cost = 6400, backpack_id = 2002, charges = 2}, -- wild growth rune
        [1250] = {potion = 2298, cost = 3600, backpack_id = 2002, charges = 1}, -- manarune rune
                
		[1251] = {potion = 2305, cost = 7000, backpack_id = 2000, charges = 2}, -- fire bomb rune
               
        [1252] = {potion = 2308, cost = 4200, backpack_id = 2000, charges = 3}, -- soulfire rune
        [1253] = {potion = 2278, cost = 14000, backpack_id = 5949, charges = 1}, -- paralyze rune
        [1254] = {potion = 2273, cost = 3500, backpack_id = 2002, charges = 1}, -- ultimate healing rune
                [1255] = {potion = 2261, cost = 900, backpack_id = 2003, charges = 3}, -- destroy field rune
               
                [1256] = {potion = 2293, cost = 7000, backpack_id = 2004, charges = 3}, -- magic wall rune
} -- config end --

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, potion.charges) == TRUE then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
        else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a backpack "..getItemNameById(potion.potion)..".")
        end
        return TRUE
end
I have no idea how to customize it, im not good in lua.
 
LUA:
local t = {
	[1001] = {item = {2268, 100}, cost = 5},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local f = t[item.uid]
	if f then
		if doPlayerRemoveItem(cid, 2157, f.cost) then
			doPlayerAddItem(cid, unpack(f.item))
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought '.. f.item[2] ..'x '.. getItemInfo(f.item[1]).plural ..' for '.. f.cost ..' gold nuggets.')
			doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need '.. f.cost ..' gold nuggets for '.. f.item[2] ..'x '.. getItemInfo(f.item[1]).plural ..'.')
		end
		return true
	end
end
 
If you need help with that, post information about your problem.
Like which server you use, how did you added it, do you get errors, what happens when you use it etc.
 
Back
Top