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
- ---------- INÍCIO DAS CONFIGS ------------
- local vocsAgree = {1, 2, 3, 4} -- Voc IDs Permitidas para Promote
- local cost = 20000 -- Custo em Gold Coins
- ----------- FIM DAS CONFIGS ---------------
- function creatureSayCallback(cid, type, msg)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- ------------------ MESSAGENS --------------------------
- local getStoStep = getPlayerStorageValue(cid, strgStep) -- STARTING MISSION
- if (msgcontains(msg, 'promote') or msgcontains(msg, 'promotion')) then
- if isInArray(vocsAgree, getPlayerVocation(cid)) then
- selfSay('I can promote you for 20000 gold coins. Do you want me to promote you?', cid)
- talkState[talkUser] = 1
- else
- selfSay('Sorry, you already was promoted.', cid)
- talkState[talkUser] = 0
- end
- --------- HELP --------
- elseif (msgcontains(msg, 'help') or msgcontains(msg, 'ajuda')) then
- selfSay('Say {promote} or {promotion} to be prometed for '..cost..' gold coins.', cid)
- talkState[talkUser] = 0
- ------ NEGOCIAÇÃO ------
- elseif talkState[talkUser] == 1 then
- if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then
- if doPlayerRemoveMoney(cid, cost) then
- setPlayerPromotionLevel(cid, 1)
- selfSay('Congratulation, now you\'re promoted.', cid)
- talkState[talkUser] = 0
- else
- selfSay('You don\'t have money.', cid)
- talkState[talkUser] = 0
- end
- else
- selfSay('Alright then, come back when you are ready.', cid)
- talkState[talkUser] = 0
- 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