BR

Ajuda Com Um Script De Npc

Por brutpc, 14 de jul. de 2010 em Scripts

script
5
1.2k
brutpcB
14 de julho de 2010 às 20:44

Eaew, galera, eh o seguinte, hj d tarde eu pedi pra q alguem me ajudasse com um script.. mas tpo esse script eu tentei faze uma mudança e nun deu certo, sera que alguem aki consegue faze isso, é pouca coisa...

 

    elseif msgcontains(msg, 'passage') then
      if doPlayerRemoveItem(cid, itemid, 10) then
       selfSay("Go on!.", cid)
    doTeleportThing(cid, pos)

 

nessa parte do script, qnd eu falo pra ele passage, ele remove os itens que precisa e me teleporta direto, eu so queria mudar que, quando eu falar passage, ele perguntasse : "Are you sure?" , dai precisasse fla Yes ou No pra ele te teleporta, axo que deu pra intende.

 

Preciso mtoo vlww.

Editado Julho 14 por brutpc

VodkartV
14 de julho de 2010 às 21:32

edita ai

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local talkState = {}

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=152,y=58,z=7} -------------- Pos para onde o player sera levado
local itemid = 2468 ----------------- Id do item que vai ser removido do player


if msgcontains(msg, "travel") then
selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {passage} se quizer viajar.", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, "passage") then
selfSay("Are you sure? {yes}  ", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, "yes")  then
if doPlayerRemoveItem(cid, itemid, 1) then
selfSay("Boa viagem.", cid)
doTeleportThing(cid, pos)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
else
selfSay('You don\'t have '.. getItemNameById(itemid) ..'', cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
elseif msg == "no" and talkState[talkUser] == 2 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())

Editado Julho 14 por Vodkart

brutpcB
14 de julho de 2010 às 21:59

kraa , vc me ajudo pela segunda vez hj.... Vodkart, vc eh foda... vlww ae [ REP + ]

Editado Julho 16 por brutpc

14 de julho de 2010 às 22:29

Pedido entregue, tópico reportado.

 

Abraços.

15 de julho de 2010 às 13:14

Tópico Movido para a seção Pedidos Atendidos.