Postado Outubro 16, 2015 9 anos 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 pos = {x=1, y=2, z=3} local ppos = getCreaturePosition(cid) if isPremium(cid) then if getPlayerLevel(cid) > 7 then if msgcontains(msg, 'edron') then selfSay('Do you want to Travel to Edron for 110 gold coins?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if not isPlayerPzLocked(cid) then if (doPlayerRemoveMoney(cid, 110)) then selfSay('Set the sails!', cid) doSendMagicEffect(ppos, CONST_ME_TELEPORT) doTeleportThing(cid, pos) doSendMagicEffect(ppos, CONST_ME_TELEPORT) talkState[talkUser] = 0 else selfSay('Sorry, you don\'t have enough gold.', cid) end else selfSay('First get rid of those blood stains! You are not going to ruin my vehicle!', cid) talkState[talkUser] = 0 end elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then talkState[talkUser] = 0 selfSay('Ok then.', cid) end else selfSay('You need to be level 8 up to travel in this boat.', cid) talkState[talkUser] = 0 end else selfSay('You need be premium account to travel with me.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Outubro 16, 2015 9 anos por vankk (veja o histórico de edições) Discord: vankk #7765 Precisando de ajuda? Entre em contato comigo via Discord. Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.