Ir para conteúdo

Featured Replies

Postado

Estou aprendendo a mexer em um sv antigo xml, e queria um script que o npc da uma storage,para passar em tal porta, que nesse cita obviamente do storage dado pelo npc, alguém pode me ajudar?

Postado

@raffizlindo09

 

tenta assim:

 

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, 'storage') or msgcontains(msg, 'STORAGE')) then
selfSay("Voce quer receber uma storage para passar pela porta?")
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
setPlayerStorageValue(cid, AQUI STORAGE Q O NPC VAI DA, 1)
selfSay("Parabéns, você ganhou a storage.",cid)
talkState[talkUser] = 0 
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Bye", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Postado

Veja se é útil para você:

 

 

Depois disso, é só colocar o storage no actionid daquelas portas de quest ou colocar um actionid em uma porta qualquer e adicionar o script abaixo:

 

Em actions/scripts, crie um arquivo.lua:

 

local storage = 4151
local newPos = {x = 1, y = 1, z = 1}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, storage) == -1 then
    return doPlayerSendCancel(cid, "You are not allowed to enter.") and true
end
doTeleportThing(cid, newPos)
doSendMagicEffect(newPos, CONST_ME_TELEPORT)
return true
end

Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DA_PORTA" script="NOMEDOARQUIVO.lua" />

  • 2 weeks later...
Postado
  • Autor
Em 18/11/2017 em 16:21, igorcano1 disse:

@raffizlindo09

 

tenta assim:

 

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, 'storage') or msgcontains(msg, 'STORAGE')) then
selfSay("Voce quer receber uma storage para passar pela porta?")
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
setPlayerStorageValue(cid, AQUI STORAGE Q O NPC VAI DA, 1)
selfSay("Parabéns, você ganhou a storage.",cid)
talkState[talkUser] = 0 
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Bye", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

mas e na porta eu coloco o storage a onde?

 

Em 19/11/2017 em 10:37, Dwarfer disse:

Veja se é útil para você:

 

 

Depois disso, é só colocar o storage no actionid daquelas portas de quest ou colocar um actionid em uma porta qualquer e adicionar o script abaixo:

 

Em actions/scripts, crie um arquivo.lua:

 


local storage = 4151
local newPos = {x = 1, y = 1, z = 1}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, storage) == -1 then
    return doPlayerSendCancel(cid, "You are not allowed to enter.") and true
end
doTeleportThing(cid, newPos)
doSendMagicEffect(newPos, CONST_ME_TELEPORT)
return true
end

Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DA_PORTA" script="NOMEDOARQUIVO.lua" />

cara não esta lendo o arquivo o meu exe, por que será? diz que esses users que vc tem no seu não é suportado, ( OBS: a versão que estou mexendo é a 7.92)

Em 18/11/2017 em 16:21, igorcano1 disse:

@raffizlindo09

 

tenta assim:

 

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, 'storage') or msgcontains(msg, 'STORAGE')) then
selfSay("Voce quer receber uma storage para passar pela porta?")
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
setPlayerStorageValue(cid, AQUI STORAGE Q O NPC VAI DA, 1)
selfSay("Parabéns, você ganhou a storage.",cid)
talkState[talkUser] = 0 
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Bye", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

meu a versão que mexo é a 7.92 e está dizendo que não é compativel help me

Em 19/11/2017 em 10:37, Dwarfer disse:

Veja se é útil para você:

 

 

Depois disso, é só colocar o storage no actionid daquelas portas de quest ou colocar um actionid em uma porta qualquer e adicionar o script abaixo:

 

Em actions/scripts, crie um arquivo.lua:

 


local storage = 4151
local newPos = {x = 1, y = 1, z = 1}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, storage) == -1 then
    return doPlayerSendCancel(cid, "You are not allowed to enter.") and true
end
doTeleportThing(cid, newPos)
doSendMagicEffect(newPos, CONST_ME_TELEPORT)
return true
end

Em actions.xml, adicione a tag: <action actionid="ACTION_ID_DA_PORTA" script="NOMEDOARQUIVO.lua" />

a versão que estou mexendo é a 7.92 e não está dando certo, por favor se poder me ajudar wahts 011 94994 8216

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo