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
- if (msgcontains(msg, 'aguas') or msgcontains(msg, 'AGUAS')) then
- selfSay('Voce deseja ir para as aguas termais?, digite {yes} irá custar '.. gold..'', cid)
- talkState[talkUser] = 1
- if (msgcontains(msg, 'yes') and talkState[talkUser] == 1) and (getPlayerBalance(cid) >= gold) then
- doPlayerSetBalance(cid, (getPlayerBalance(cid)-gold))
- doTeleportThing(cid, {x = 1012, y = 908, z = 4}) -- localcidade de tp
- selfSay("Você foi parar nas Aguas termais...",cid)
- talkState[talkUser] = 0
- else
- selfSay("Safado, você não tem o "..gold.."",cid)
- talkState[talkUser] = 0
- end
- elseif msg == "no" and talkState[talkUser] >= 1 then
- selfSay("Then not", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(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