Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- local buff_str = 211100 -- Storage da missao dos buffs
- local buff = {
- health = 100, -- Vida
- mana = 100, -- Mana
- req_lvl = 10, -- Level necessário
- req_item = 2160, -- Item necessário
- storage = 23123123 -- Storage do buff
- }
- if (msgcontains(msg, "buff")) then
- if getPlayerStorageValue(cid, buff_str) >= 1 then
- if getPlayerStorageValue(cid, buff.storage) <= 0 then
- if getPlayerItemCount(cid, buff.req_item) >= 1 then
- if getPlayerLevel(cid) >= buff.req_lvl then
- setCreatureMaxHealth(cid, buffbuff.health)
- setCreatureMaxMana(cid, buffbuff.mana)
- doPlayerRemoveItem(cid, buffbuff.req_item, 1)
- setPlayerStorageValue(cid, buffbuff.storage, 1)
- selfSay("Voce recebeu o buff um.", cid)
- else
- selfSay("Voce precisa de no minimo level "..buff.req_lvl..".", cid)
- end
- else
- selfSay("Voce nao possui 1 "..getItemNameById(buff.req_item)..".", cid)
- end
- else
- selfSay("Voce ja adquiriu este buff uma vez.", cid)
- end
- else
- selfSay("Voce precisa completar a missao dos buffs.", cid)
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement