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

NPC NPC Irmana can Exchange itens and give Nobleman Addon

Bulet

Knight of Apocalypse
Joined
Jul 12, 2009
Messages
183
Reaction score
9
Location
Brazil
I put that npc and another on mine addons packet but for who just wanna irmana that are the script ...
Work perfectly on tfs 0.3.5pl1

IF HELP YOU REP++ me

Irmana.lua
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


-- Storage IDs --

fnobleman    = 22009  
snobleman    = 22010 

newaddon    = 'Ah, right! The nobleman addon! Here you go.'
noitems        = 'You do not have all the required items.'
noitems2    = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.'
already        = 'It seems you already have this addon, don\'t you try to mock me son!'

-- NOBLEMAN START --
function NoblemanFirst(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    local player_gold     = getPlayerItemCount(cid,2148)
    local player_plat     = getPlayerItemCount(cid,2152)*100
    local player_crys     = getPlayerItemCount(cid,2160)*10000
    local player_money     = player_gold + player_plat + player_crys

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,fnobleman)
    if addon == -1 then
        if player_money >= 150000 then
        if doPlayerRemoveMoney(cid,150000) then
            npcHandler:say('Ah, right! The nobleman addon! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
			setPlayerStorageValue(cid,fnobleman,1)
			if getPlayerSex(cid) == 1 then 
            doPlayerAddOutfit(cid, 132, 1)
			elseif getPlayerSex(cid) == 0 then
            doPlayerAddOutfit(cid, 140, 1)
        end    
        end
        else
            npcHandler:say(noitems)
        end
    else
        npcHandler:say(already)
    end
    end

end

function NoblemanSecond(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    local player_gold     = getPlayerItemCount(cid,2148)
    local player_plat     = getPlayerItemCount(cid,2152)*100
    local player_crys     = getPlayerItemCount(cid,2160)*10000
    local player_money     = player_gold + player_plat + player_crys

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,snobleman)
    if addon == -1 then
        if player_money >= 150000 then
        if doPlayerRemoveMoney(cid,150000) then
            npcHandler:say('Ah, right! The nobleman addon! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
			setPlayerStorageValue(cid,snobleman,1)
			if getPlayerSex(cid) == 1 then 
            doPlayerAddOutfit(cid, 132, 2)
			elseif getPlayerSex(cid) == 0 then
            doPlayerAddOutfit(cid, 140, 2)
        end    
        end
        else
            npcHandler:say(noitems)
        end
    else
        npcHandler:say(already)
    end
    end

end
-- NOBLEMAN END --

function RedRobe(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    if getPlayerItemCount(cid,2655) >= 1 then
        if doPlayerRemoveItem(cid,2655,1) then
            npcHandler:say('A {Red Robe}! Great. Here, take this red piece of cloth, I don\'t need it anyway.', cid)
            doPlayerAddItem(cid,5911,1)
        end
        else
            npcHandler:say('Are you trying to mess with me?!', cid)
        end
		end
		
function MysticTurban(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    if getPlayerItemCount(cid,2663) >= 1 then
        if doPlayerRemoveItem(cid,2663,1) then
            npcHandler:say('A {Mystic Turban}! Great. Here, take this blue piece of cloth, I don\'t need it anyway.', cid)
            doPlayerAddItem(cid,5912,1)
        end
        else
            npcHandler:say('Are you trying to mess with me?!', cid)
        end
        end

function GreenTunic(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    if getPlayerItemCount(cid,2652) >= 150 then
        if doPlayerRemoveItem(cid,2652,150) then
            npcHandler:say('A 150 {Green Tunic}! Great. Here, take this green piece of cloth, I don\'t need it anyway.', cid)
            doPlayerAddItem(cid,5910,1)
        end
        else
            npcHandler:say('Are you trying to mess with me?!', cid)
        end
		end



node1 = keywordHandler:addKeyword({'coat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get nobleman coat you need give me 150,000 gold pieces. Do you have it with you?'})
node1:addChildKeyword({'yes'}, NoblemanFirst, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node2 = keywordHandler:addKeyword({'dress'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get nobleman dress you need give me 150,000 gold pieces. Do you have it with you?'})
node2:addChildKeyword({'yes'}, NoblemanFirst, {})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node3 = keywordHandler:addKeyword({'hat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get nobleman hat you need give me 150,000 gold pieces. Do you have it with you?'})
node3:addChildKeyword({'yes'}, NoblemanSecond, {})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node4 = keywordHandler:addKeyword({'red robe'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found a {Red Robe} for me?'})
node4:addChildKeyword({'yes'}, RedRobe, {})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node5 = keywordHandler:addKeyword({'mystic turban'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found a {Mystic Turban} for me?'})
node5:addChildKeyword({'yes'}, MysticTurban, {})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node6 = keywordHandler:addKeyword({'green tunic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you found {150 Green Tunic} for me?'})
node6:addChildKeyword({'yes'}, GreenTunic, {})
node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})



npcHandler:addModule(FocusModule:new())
 
Last edited:
just use onCreatureSay callback >,> instead of this sloppy way of making npcs
 
function onCreatureSay(cid, type, msg)

to

onCreatureSay callback?
 
Back
Top