Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- items = {{itemid = 2225, count = 30}, {itemid = 2033, count = 20}, {itemid = 2363, count = 1}, {itemid = 2350, count = 1}},
- storage = 74561, -- Não mudar
- add_item = 2160, -- Item que vai ganhar
- }
- local keywordHandler = KeywordHandler:new()
- local npcHandler = NpcHandler:new(keywordHandler)
- NpcSystem.parseParameters(npcHandler)
- local talkState = {}
- 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)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- if getPlayerStorageValue(cid, config.storage) >= 1 then
- selfSay('você já me ajudou!!', cid)
- return false
- end
- if msgcontains(msg:lower(), 'pedido') then
- selfSay('Estou precisando de uns itens e se tu me trouxer eu lhe recompensarei... \nlista de Itens:\n-30 Piece of Iron\n-20 Golden Mug\n-1 Blood Orb\n-1 Sword Hilt.', cid)
- end
- if msgcontains(msg:lower(), 'entrega') then
- item = 0
- for i = 1, #config.items do
- if getPlayerItemCount(cid, config.items[i].itemid) >= config.items[i].count then
- item = item + 1
- end
- end
- if item == #config.items then
- for x = 1, #config.items do
- doPlayerRemoveItem(cid, config.items[x].itemid, config.items[x].count)
- end
- selfSay('Aqui está sua recompensa', cid)
- doPlayerAddItem(cid, config.add_item, 1)
- setPlayerStorageValue(cid, config.storage, 1)
- else
- selfSay('Verifique se você tem todos os items...', cid)
- end
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement