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
- npcHandler:setMessage(MESSAGE_GREET, "Ola |PLAYERNAME| , eu posso cuidar de seu {ovo} por 50k voce quer? Digite {egg system}")
- local sky =
- {
- preco = 50000,
- tempo = 5*60,
- storage = 5050
- }
- function creatureSayCallback(cid, type, msg)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 and 2 or cid
- if(msgcontains(msg, 'egg') or (msgcontains (msg, 'cuidar')) and talkState[talkUser] == 0) then
- selfSay('Irei cuidar do seu ovo por um tempo, voce quer?', cid)
- end
- talkState[talkUser] = 1
- if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
- if(getPlayerStorageValue(cid, sky.storage) < os.time()) then
- if(doPlayerRemoveMoney(cid, sky.preco)) == true then
- doRemoveItem(4850,1)
- setPlayerStorageValue(cid, sky.storage, (os.time()+sky.tempo))
- sendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
- selfSay('Volte em breve para pega-lo.', cid)
- talkState[talkUser] = 0
- else
- selfSay('Voce precissa de '..sky.preco - getPlayerMoney(cid)..' de dinheiro', cid)
- end
- elseif(msgcontains(msg, 'checar') or (msgcontains (msg, 'checar o ovo')) and talkState[talkUser] == 0) then
- selfSay('Voce quer saber quanto tempo voce pode pegar o ovo?', cid)
- talkState[talkUser] = 2
- elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
- if(getPlayerStorageValue(cid, sky.storage) < os.time()) then
- selfSay('Volte em breve para pega-lo.', cid)
- talkState[talkUser] = 0
- else
- selfSay('Você só pode pegar o ovo daqui '.. math.floor((getPlayerStorageValue(cid, sky.storage) - os.time())/60) ..' minutos e '.. getPlayerStorageValue(cid, sky.storage) % 60 ..' segundos.', cid)
- end
- end
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment