Ir para conteúdo

Pergunta

oigente queria que um de vcs podessem arruma esse script que eu tenho

 

 

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 onCreatureSayCallback(cid, type, msg)

local config = {

price = 50000,

delay = 5 * 60,

control = {12304, 12305, 12306, 12307, 12308, 12309, 12311, 12312, 12313, 12314, 12315, 12316, 12317, 12318, 12319, 12320, 12321, 12322, 12323, 12324, 12960, 12961, 12962, 12963, 12964, 12965, 12966, 12967, 12968, 12969, 12970, 12971},

eggn = 12972

}

if not npcHandler:isFocused(cid) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

if msgcontains(msg, "care") then

local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)

if getPlayerStorageValue(cid, config.control) > os.time() then

selfSay("Desculpe, mas eu já estou cuidando um de seus ovos.", cid)

else

selfSay("Você quer que eu cuide de seu ovo para fale {yes} ".. p .." ".. (p == config.price and "" or "k") .."?", cid)

talkState[talkUser] = 1

end

 

elseif msgcontains(msg, "back") then

if getPlayerStorageValue(cid, config.control[2]) == 1 then

selfSay("Olá, você veio para pegar o seu ovo? fale {yes}.", cid)

talkState[talkUser] = 2

else

selfSay("Desculpe, mas eu não estou cuidando de ovos de seus.", cid)

end

 

elseif msgcontains(msg, "check") then

local t = getPlayerStorageValue(cid, config.control[1])

if getPlayerStorageValue(cid, config.control[2]) == -1 then

selfSay("Desculpe, mas eu não estou cuidando de ovos de seus.", cid)

else

if t < os.time() then

selfSay("Yay, o ovo começou a eclodir, pegue.", cid)

setPlayerStorageValue(cid, config.control[1], -1)

setPlayerStorageValue(cid, config.control[2], -1)

else

selfSay("Eu estarei cuidando de seu ovo para mais ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)

end

end

end

 

if talkState[talkUser] == 1 then

if msgcontains(msg, "yes") then

if getPlayerStorageValue(cid, config.control[2]) == -1 then

if doPlayerRemoveMoney(cid, config.price) then

setPlayerStorageValue(cid, config.control[2], 1)

setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)

selfSay("Ok! Volte logo.", cid)

else

selfSay("Desculpe, você não tem dinheiro suficiente. Você precisa de mais ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)

end

else

selfSay("Eu já estou cuidando de um ovo para você.", cid)

end

elseif msgcontains(msg, "no") then

selfSay("Muito caro para você, hein?", cid)

end

elseif talkState[talkUser] == 2 then

local x = getPlayerStorageValue(cid, config.control)

local t = getPlayerStorageValue(cid, config.control[1])

if msgcontains(msg, "yes") then

if x > os.time() then

local item = doPlayerAddItem(cid, config.eggn, 1)

doItemSetAttribute(item, "description", "A hatched egg.")

selfSay("Leve-o!", cid)

setPlayerStorageValue(cid, control[2], -1)

setPlayerStorageValue(cid, control[1], -1)

else

selfSay("Desculpe, mas o seu ovo precisa de cuidados para mais ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)

end

end

end

return true

end

 

npcHandler:setMessage(MESSAGE_GREET, "OI, |PLAYERNAME|. Eu sou um educador de ovos. choque seu ovo fale {care} ou você quer checar o tempo? fale {check} ou você quer pegar o ovo de volta? fale {back}.")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

pq esse é um npc de agg sistem feito pelo sky daki do xtibia msm qi queria o problema com ele é que ele não ta devolvendo o ovo ao player dps que acaba o tempo se alguem arruma dou 3 rep+ por 3 dias.

 

aki esta o link pra ter uma ideia de como é:

 

http://www.xtibia.com/forum/topic/173283-npc-new-egg-system-fix/

Link para o comentário
https://xtibia.com/forum/topic/195112-script-bonito/
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...