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

Please repair my npc

Nerkoerko

Banned User
Joined
Feb 28, 2009
Messages
402
Reaction score
5
Location
Polska
My code addon :p

keywordHandler = KeywordHandler:new()
npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end


beggar = 40001

newaddon = 'Here you are, enjoy your brand new addon!'
noitems = 'You do not have all the required items.'
noitems2 = 'You do not have all the required items or you do not have the first addon, 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!'



-- BEGGAR START --
function BeggarFirst(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,beggar)
if addon == -1 then
if getPlayerItemCount(cid,5883) >= 100 and player_money >= 20000 then
if doPlayerRemoveItem(cid,5883,100) and doPlayerRemoveMoney(cid,20000) then
selfSay(newaddon)

doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 153, 1)
doPlayerAddOutfit(cid, 157, 1)
setPlayerStorageValue(cid,beggar,1)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end

end

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

if(not npcHandler:isFocused(cid)) then
return false
end

if isPremium(cid) then
addon = getPlayerStorageValue(cid,beggar+1)
if addon == -1 then
if getPlayerItemCount(cid,6107) >= 1 then
if doPlayerRemoveItem(cid,6107,1) then
selfSay(newaddon)

doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 153, 2)
doPlayerAddOutfit(cid, 157, 2)
setPlayerStorageValue(cid,beggar+1,1)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end

end



keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Can give you addon name...."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Moge ci dac addon"})







node27 = keywordHandler:addKeyword({'first beggar addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first

beggar addon you need to give me 100 ape furs and 20,000 gold pieces. Do you have them with you?'})
node27:addChildKeyword({'yes'}, BeggarFirst, {})
node27:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all

neccessary items.', reset = true})

node28 = keywordHandler:addKeyword({'second beggar addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the second

beggar addon you need to give me simon the beggar\'s staff. Do you have it with you?'})
node28:addChildKeyword({'yes'}, BeggarSecond, {})
node28: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())




Please edit npc ;p mmm
npc talk to player only when have StorageValue 4000 :p
please help ;p

It possible?:p
 
Back
Top