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

Help with soft boots repair npc

Xerez

New Member
Joined
Mar 6, 2008
Messages
45
Reaction score
0
Code:
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerItemCount(cid,6530) >= 1 and player_money > repair_price then
                if doPlayerTakeItem(cid,6530,1) == 0 then
                    if pay(cid,repair_price) then
                        selfSay('Here you are.')
                        doPlayerAddItem(cid,6132,1)
                    else
                        selfSay('Sorry, you don\'t have enough money.')
                    end
                else
                    selfSay('Sorry, you don\'t have the worn soft boots.')
                end
            else
            end


how come this script doesn't give me a new pair of soft boots? the npc just takes the "worn soft boots (6530)" but he doesn't take the money and he doesn't give me a pair of soft boots "6132" and he doesn't say anything.

here is the whole script:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)			npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)		npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)	npcHandler:onCreatureSay(cid, type, msg)	end
function onThink()						npcHandler:onThink()						end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

        player_gold = getPlayerItemCount(cid,2148)
        player_plat = getPlayerItemCount(cid,2152)*100
        player_crys = getPlayerItemCount(cid,2160)*10000
        player_money = player_gold + player_plat + player_crys
        repair_price = 40000

        if msgcontains(msg, 'soft boots') or msgcontains(msg, 'magic boots') then
            selfSay('Whoa! Those are really rare boots, Do you want me to repair them for '..repair_price..' gold?')
            talk_state = 1
		elseif msgcontains(msg, 'obsidian knifeeee') or msgcontains(msg, 'obsidianeeee') or msgcontains(msg, 'knifeeeee') then
             selfSay('Do you want to trade a piece of draconian steel and an obsidian lance for an obsidian knife?')
            talk_state = 2
        elseif msgcontains(msg, 'green') or msgcontains(msg, 'tunic') or msgcontains(msg, 'green tunic') or msgcontains(msg, 'green piece of cloth') then
            selfSay('Do you want trade 20 green tunics for a green piece of cloth?')
            talk_state = 3
        elseif msgcontains(msg, 'red') or msgcontains(msg, 'robe') or msgcontains(msg, 'red robe') or msgcontains(msg, 'red piece of cloth') then
            selfSay('Do you want trade a red robe for a red piece of cloth?')
            talk_state = 4
        elseif msgcontains(msg, 'blue') or msgcontains(msg, 'turban') or msgcontains(msg, 'mystic turban') or msgcontains(msg, 'blue piece of cloth') then
            selfSay('Do you want trade a mystic turban for a blue piece of cloth?')
            talk_state = 5
------------------------------------------------ confirm yes ------------------------------------------------
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerItemCount(cid,6530) >= 1 and player_money > repair_price then
                if doPlayerTakeItem(cid,6530,1) == 0 then
                    if pay(cid,repair_price) then
                        selfSay('Here you are.')
                        doPlayerAddItem(cid,6132,1)
                    else
                        selfSay('Sorry, you don\'t have enough money.')
                    end
                else
                    selfSay('Sorry, you don\'t have the worn soft boots.')
                end
            else
            end
            talk_state = 0
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
            if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
                if doPlayerTakeItem(cid,5889,1) == 0 and doPlayerTakeItem(cid,2425,1) == 0 then
                    selfSay('Here you are.')
                    doPlayerAddItem(cid,5908,1)
                end
            else
                selfSay('Sorry, you don\'t have the items.')
            end
            talk_state = 0 
			        elseif msgcontains(msg, 'yes') and talk_state == 3 then
            if getPlayerItemCount(cid,2652) >= 20 then
                if doPlayerTakeItem(cid,2652,20) == 0 then
                    selfSay('Here you are.')
                    doPlayerAddItem(cid,5910,1)
                end
            else
                selfSay('Sorry, you don\'t have the items.')
            end
            talk_state = 0
        elseif msgcontains(msg, 'yes') and talk_state == 4 then
            if getPlayerItemCount(cid,2655) >= 1 then
                if doPlayerTakeItem(cid,2655,1) == 0 then
                    selfSay('Here you are.')
                    doPlayerAddItem(cid,5911,1)
                end
            else
                selfSay('Sorry, you don\'t have the item.')
            end
            talk_state = 0
        elseif msgcontains(msg, 'yes') and talk_state == 5 then
            if getPlayerItemCount(cid,2663) >= 1 then
                if doPlayerTakeItem(cid,2663,1) == 0 then
                    selfSay('Here you are.')
                    doPlayerAddItem(cid,5912,1)
                end
            else
                selfSay('Sorry, you don\'t have the item.')
            end
            talk_state = 0 
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and talk_state >= 1 and talk_state <= 5 then
            selfSay('Not good enough, is it?.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) 

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I own this shop. I know how to repair boots too, and I exchange cloths.'})
keywordHandler:addKeyword({'cloth'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I exchange mystic turbans for blue pieces of cloths, 20 green tunics for green pieces of cloth and red robes for red pieces of clothes.'})
keywordHandler:addKeyword({'bags'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I have brown, blue, jungle, golden, green, grey, purple, red, seastar, fur and yellow bags for 5gps.'})
keywordHandler:addKeyword({'backpacks'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I have brown, blue, jungle, golden, green, grey, purple, red, seastar, fur and yellow backpacks for 10gps.'})
keywordHandler:addKeyword({'tools'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell picks(100gps), fishing rods(150gps), torches(2gps), lamps(8gps), candles(2gps), ropes(50gps), scythes(50gps), sickles(50gps) and fire bugs(100gps).'})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell bags and backpacks(in all colors), worms(5gp per sixpack), tools, watches(50gp), footballs(111gp). I also exchange cloths and repair boots.'})

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

--bags
shopModule:addBuyableItem({'blue bag'}, 1995, 5, 'blue bag')
shopModule:addBuyableItem({'jungle bag'}, 3939, 5, 'jungle bag')
shopModule:addBuyableItem({'golden bag'}, 1997, 5, 'golden bag')
shopModule:addBuyableItem({'green bag'}, 1991, 5, 'green bag')
shopModule:addBuyableItem({'grey bag', 'gray back'}, 1996, 5, 'grey bag')
shopModule:addBuyableItem({'purple bag'}, 1994, 5, 'purple bag')
shopModule:addBuyableItem({'red bag'}, 1993, 5, 'red bag')
shopModule:addBuyableItem({'seastar bag'}, 5950, 5, 'seastar bag')
shopModule:addBuyableItem({'yellow bag'}, 1992, 5, 'yellow bag')
shopModule:addBuyableItem({'fur bag'}, 7343, 5, 'fur bag')
shopModule:addBuyableItem({'brown bag', 'bag'}, 1987, 5, 'brown bag')
--backpacks
shopModule:addBuyableItem({'blue backpack'}, 2002, 10, 'blue backpack')
shopModule:addBuyableItem({'jungle backpack'}, 3940, 10, 'jungle backpack')
shopModule:addBuyableItem({'golden backpack'}, 2004, 10, 'golden backpack')
shopModule:addBuyableItem({'green backpack'}, 1998, 10, 'green backpack')
shopModule:addBuyableItem({'grey backpack', 'gray backpack'}, 2003, 10, 'grey backpack')
shopModule:addBuyableItem({'purple backpack'}, 2001, 10, 'purple backpack')
shopModule:addBuyableItem({'red backpack'}, 2000, 10, 'red backpack')
shopModule:addBuyableItem({'seastar backpack'}, 5949, 10, 'seastar backpack')
shopModule:addBuyableItem({'yellow backpack'}, 1999, 10, 'yellow backpack')
shopModule:addBuyableItem({'fur backpack'}, 7342, 10, 'fur backpack')
shopModule:addBuyableItem({'brown backpack', 'backpack'}, 1988, 10, 'brown backpack')
--tools
shopModule:addBuyableItem({'pick'}, 2553, 100, 'pick')
shopModule:addBuyableItem({'fishing rod'}, 2580, 150, 'fishing rod')
shopModule:addBuyableItem({'torch'}, 2050, 2, 'torch')
shopModule:addBuyableItem({'candle'}, 2047, 2, 'candle')
shopModule:addBuyableItem({'lamp'}, 2044, 8, 'lamp')
shopModule:addBuyableItem({'oil'}, 2006, 20, 11, 'vial of oil')
shopModule:addBuyableItem({'scythe'}, 2550, 50, 'scythe')
shopModule:addBuyableItem({'sickle'}, 2405, 50, 'sickle')
shopModule:addBuyableItem({'fire bug'}, 5468, 100, 'fire bug')
shopModule:addBuyableItem({'machete'}, 2420, 35, 'machete')
shopModule:addBuyableItem({'watch'}, 2036, 50, 'watch')
shopModule:addBuyableItem({'football'}, 2109, 111, 'football')
shopModule:addBuyableItem({'worm'}, 3976, 5, 1, 'worm')
npcHandler:addModule(FocusModule:new())
 
That didn't help, he just takes my worn softboots now..



17:20 GM Hilding [23]: soft boots
17:20 Merlin: Whoa! Those are really rare boots, Do you want me to repair them for 40000 gold?
17:20 GM Hilding [23]: yes
17:20 Merlin: Sorry, you don't have the worn soft boots.

code is same as above except I changed this:
if doPlayerTakeItem(cid,6530,1) == 0 then
to this:
if doPlayerTakeItem(cid,6530,1) == 1 then

like you said?
 
Omg, this script is messier than anything I've ever seen... >.< What server are you using? I'll see if I can help you.
 
Try this

Code:
------------------------------------------------ confirm yes ------------------------------------------------
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerItemCount(cid,6530) >= 1 and player_money > repair_price then
                if doPlayerTakeItem(cid,6530,1) == TRUE then
					doPlayerRemoveMoney(cid, repair_price)
					doPlayerAddItem(cid,6132,1)
                        selfSay('Here you are.')
                    else
 
Back
Top