Ir para conteúdo

Featured Replies

Postado

Ola a todos. Criei um NPC no meu servidor que vai vender alguns outfits especificos. Usei como base um script que já existe no servidor, o outfitseller.lua (Clássico dos PDA's) porem este novo NPC não está funcionando. Quando fala Hi, ele responde normalmente e quando você pede pra comprar um dos outfits que ele vende, ele não responde nada. Será que alguem poderia me ajudar a achar o erro? Obrigado desde já

 

novo outfitseller:

Spoiler

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 outs = {
["Thunder"] = {60},
["Leaf"] = {61},
["Water"] = {62},
["Flame"] = {63},
["Ghost"] = {64},
}
local tab = {
item = {14291, 1}, -- {itemID, count}
}

msg = string.lower(msg)


if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("Eu posso disponibilizar alguns outfits roboticos:{Thunder, Leaf, Water, Flame, Ghost}. Basta me trazer elemental orb e mais 1kk", cid)
talkState[talkUser] = 2
elseif outs[msg] and talkState[talkUser] == 2 then
selfSay("Tem certeza de que quer comprar essa roupa ?", cid)
outfit = outs[tostring(msg)]
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, outfit[1]) <= 0 then
if getPlayerPremiumDays(cid) >= 0 then
if getPlayerMoney(cid) >= 1000000 then
if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2]) then
doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
doPlayerRemoveMoney(cid, 1000000)
setPlayerStorageValue(cid, outfit[1], 1)
else
talkState[talkUser] = 0
selfSay('Voce precisa de uma elemental orb!.', cid)
end
else
selfSay("Voce nao tem 1kk!", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Precisa ser premium para comprar esta roupa.", cid)
talkState[talkUser] = 0
return false
end
selfSay("Aqui está.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("Por favor, escolha outra roupa..", cid)
talkState[talkUser] = 0
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

No signature.

 

 

 

Postado
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,msg = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid, msg:lower()
local outs, item, money = {
["thunder"] = 60,
["leaf"] = 61,
["water"] = 62,
["flame"] = 63,
["ghost"] = 64
},{14291, 1}, 1000000  

if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("Eu posso disponibilizar alguns outfits roboticos:{Thunder}, {Leaf}, {Water}, {Flame}, {Ghost}. Basta me trazer elemental orb e mais 1kk", cid)
talkState[talkUser] = 2
elseif not outs[msg] and talkState[talkUser] == 2 then
selfSay("digite o nome correto da sua roupa!", cid) 
elseif outs[msg] and talkState[talkUser] == 2 then 
var_out = outs[msg]
selfSay("Tem certeza de que quer comprar essa roupa? {yes}", cid)
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, var_out) <= 0 then
if isPremium(cid) then
if getPlayerMoney(cid) >= money then
if getPlayerItemCount(cid, item[1]) >= item[2] then
doPlayerRemoveItem(cid, item[1], item[2])
doPlayerRemoveMoney(cid, money)
setPlayerStorageValue(cid, var_out, 1)
selfSay('aqui está sua '..msg..' roupa!', cid)
talkState[talkUser] = 0
else
talkState[talkUser] = 0
selfSay('Voce precisa de uma elemental orb!.', cid)
end
else
selfSay("Voce nao tem 1kk!", cid)
talkState[talkUser] = 0
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
end
else
selfSay("Precisa ser premium para comprar esta roupa.", cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("Por favor, escolha outra roupa..", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
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,msg = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid, msg:lower()
local outs, item, money = {
["thunder"] = 60,
["leaf"] = 61,
["water"] = 62,
["flame"] = 63,
["ghost"] = 64
},{14291, 1}, 1000000  
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("Eu posso disponibilizar alguns outfits roboticos:{Thunder}, {Leaf}, {Water}, {Flame}, {Ghost}. Basta me trazer elemental orb e mais 1kk", cid)
talkState[talkUser] = 2
elseif talkState[talkUser] == 2 then
if outs[msg] then 
var_out = outs[msg]
selfSay("Tem certeza de que quer comprar a roupa "..msg.."? {yes}", cid)
talkState[talkUser] = 3
else
selfSay("digite o nome correto da sua roupa!", cid)
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, var_out) <= 0 then
if isPremium(cid) then
if getPlayerMoney(cid) >= money then
if getPlayerItemCount(cid, item[1]) >= item[2] then
doPlayerRemoveItem(cid, item[1], item[2])
doPlayerRemoveMoney(cid, money)
setPlayerStorageValue(cid, var_out, 1)
selfSay('aqui está sua '..msg..' roupa!', cid)
talkState[talkUser] = 0
else
talkState[talkUser] = 0
selfSay('Voce precisa de uma elemental orb!.', cid)
end
else
selfSay("Voce nao tem 1kk!", cid)
talkState[talkUser] = 0
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
end
else
selfSay("você já possui está roupa.", cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("Por favor, escolha outra roupa..", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

sabe que ele só está entregando a storage né?

não tem função de dar outfit, não botei porquei achei que vc configurou pelo oufits.xml

'doPlayerAddOutfit'

Editado por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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 520k

Informação Importante

Confirmação de Termo