Ir para conteúdo
  • 0

[PEDIDO] modificaçao desse script


Josegvb

Pergunta

olá o script esta funfando perfeitamente porem tem algumas coisas q estao faltando e o autor esta muito ocupado pra me ajudar :/ entao alguem me ajuda ai pfv 

modifacaçao que eu quero:

1º queria mudar o script pra ele perguntar pra a pessoa se quizer aceitar a task pq no momento você só falta o nome do bixo pra matar e ele fala qt estao faltando mas nao faz entregue da task, alias vc nao pega... só conta mesmo se vc nao tivese pegado

2º queria que ele tivese um COUNTER alias q quando matase o bixo, aparesça "0000 Mounstros restantes pra finalizar sua task." pq no momento vc n sabe qt falta pra finalizar ;/:

3º ele ta entregando a exp, mas nao esta aparescendo aquele txt animado da exp q vc ta pegando, alias simplemente adiciona a exp no seu char de um jeito invisivel

 

o script:

funçao onkill

Spoiler

function onKill(cid, target)

local configs = {
{name = "War Gyarados", storage = 10294},
{name = "War Heracross", storage = 10295}
}

for _, t in ipairs(configs) do

if getCreatureName(target) == t.name then
if getPlayerStorageValue(cid, t.storage) < 0 then
setPlayerStorageValue(cid, t.storage, 1)
else
setPlayerStorageValue(cid, t.storage, getPlayerStorageValue(cid, t.storage) + 1)
return true
end
end

end

return true
end

 

script do npc:

Spoiler

local configs = {
{word = "War Gyarados", itemid = 0, itemcount = 0, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 10294, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
{word = "War Heracross", itemid = 0, itemcount = 0, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 10295, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
{word = "xxx", itemid = xxx, itemcount = xxx, money = xxx, rewardid = xxx, rewardcount = xxx, rewardexp = xxx, storageid = xxx, storagevalue = xxx, storagerequest = xxx, valuerequest = xxx, text = "xxx"};
}
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
for _, npc in ipairs(configs) do
    if(msgcontains(msg, ''..npc.word..'')) then
              if getPlayerStorageValue(cid, npc.storageid) < os.time() then
              if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then
              doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)
              setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest)     
              setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)
              doPlayerAddExperience(cid, npc.rewardexp)
              selfSay(''..npc.text..'', cid)   
    talkState[talkUser] = 0  
              else
              selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')
    talkState[talkUser] = 0  
              end
              else
              selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)
    talkState[talkUser] = 0  
              end
              end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 tomara q alguem me ajude ;..; valeu

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

onKill:

 

local configs = {		{name = "War Gyarados", storage = 10294, valuerequest = 1000, storagerequest = 14123}, -- Mude valuerequest para a quantidade que o player deve matar		{name = "War Heracross", storage = 10295, valuerequest = 1000, storagerequest = 14124},}function onKill(cid, target)		for _, t in ipairs(configs) do			if getPlayerStorageValue(cid, t.storage) >= 1 then				if getCreatureName(target) == t.name then					setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)					doPlayerSendTextMessage(cid, 20, "Faltam ".. configs.valuerequest - getPlayerStorageValue(cid, t.storagerequest) .." " .. t.name .. " para terminar a task.")					return true				end			end		end	return trueend

Npc:

 

local configs = {	{word = "War Gyarados",  sto = 10294, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14123, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};	{word = "War Heracross",  sto = 10295, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14124, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};	--{word = "xxx", sto = xxx,money = xxx, rewardid = xxx, rewardcount = xxx, rewardexp = xxx, storageid = xxx, storagevalue = xxx, storagerequest = xxx, valuerequest = xxx, text = "xxx"};}local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)	if(not npcHandler:isFocused(cid)) then		return false	end	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid	for _, npc in ipairs(configs) do		if(msgcontains(msg, ''..npc.word..'')) then			if getPlayerStorageValue(cid, npc.sto) >= 1 then				if getPlayerStorageValue(cid, npc.storageid) < os.time() then					if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then						doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)						setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest) 						setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)						doPlayerAddExperience(cid, npc.rewardexp)						doSendAnimatedText(pos, npc.rewardexp, 215)						selfSay(''..npc.text..'', cid) 						talkState[talkUser] = 0 					else						selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')						talkState[talkUser] = 0 					end				else					selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)						talkState[talkUser] = 0 					end				end			else				selfSay('You are gain the '..npc.word..' task!!', cid)				selfSay('You need kill just '..npc.valuerequest..' of him', cid)				setPlayerStorageValue(cid, npc.sto, 1)			end		end		return true	endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Eu não testei, qual quer coisa avisa aí!

Link para o comentário
Compartilhar em outros sites

  • 0

ta bug @Drazyn1291  quando mata o bixo ele fica assim

1c7e4d7642b9996ee219587c782715be.gif

 


[14/05/2016 08:30:10] [Error - CreatureScript Interface] 
[14/05/2016 08:30:10] data/creaturescripts/scripts/onkill.lua:onKill
[14/05/2016 08:30:10] Description: 
[14/05/2016 08:30:10] data/creaturescripts/scripts/onkill.lua:11: attempt to perform arithmetic on field 'valuerequest' (a nil value)
[14/05/2016 08:30:10] stack traceback:
[14/05/2016 08:30:10]     data/creaturescripts/scripts/onkill.lua:11: in function <data/creaturescripts/scripts/onkill.lua:6>

 

tmb ao falar com o npc fica assim:

70434f9f01d2faf35cab61c61f527d27.png

Editado por Josegvb
Link para o comentário
Compartilhar em outros sites

  • 0

Usa esse onKill:

 

local configs = {		{name = "War Gyarados", storage = 10294, valuerequest = 1000, storagerequest = 14123}, -- Mude valuerequest para a quantidade que o player deve matar		{name = "War Heracross", storage = 10295, valuerequest = 1000, storagerequest = 14124},}function onKill(cid, target)		for _, t in ipairs(configs) do			if getPlayerStorageValue(cid, t.storage) >= 1 then				if getCreatureName(target) == t.name then					setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)					doPlayerSendTextMessage(cid, 20, "Faltam ".. t.valuerequest - getPlayerStorageValue(cid, t.storagerequest) .." " .. t.name .. " para terminar a task.")					return true				end			end		end	return trueend

Nossa, eu tinha visto esse erro, tinha atualizado o post lá mas estranho que não atualizou kk mas use o script acima que vai dá certo!

Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, Drazyn1291 disse:

Usa esse onKill:

 

local configs = {		{name = "War Gyarados", storage = 10294, valuerequest = 1000, storagerequest = 14123}, -- Mude valuerequest para a quantidade que o player deve matar		{name = "War Heracross", storage = 10295, valuerequest = 1000, storagerequest = 14124},}function onKill(cid, target)		for _, t in ipairs(configs) do			if getPlayerStorageValue(cid, t.storage) >= 1 then				if getCreatureName(target) == t.name then					setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)					doPlayerSendTextMessage(cid, 20, "Faltam ".. t.valuerequest - getPlayerStorageValue(cid, t.storagerequest) .." " .. t.name .. " para terminar a task.")					return true				end			end		end	return trueend

Nossa, eu tinha visto esse erro, tinha atualizado o post lá mas estranho que não atualizou kk mas use o script acima que vai dá certo!

 

 

script funfando com alguns erros, ej:

09:46 Faltam 1 Enraged Typhlosion para terminar a task.

09:46 Faltam 0 Enraged Typhlosion para terminar a task.

09:46 Faltam -1 Enraged Typhlosion para terminar a task.

09:46 Faltam -2 Enraged Typhlosion para terminar a task.

 

enquanto o npc qualquer coisa q vc falase ele ira falar

09:46 Lixeiro: You are gain the Furios Mantine task!!

09:46 Lixeiro: You need kill just 1000 of him

09:46 Lixeiro: You are gain the Enraged Typhlosion task!!

09:46 Lixeiro: You need kill just 1000 of him

 

ai vc fala a task q vc fez, 

Enraged Typhlosion

09:49 Lixeiro: You are gain the Furios Mantine task!!

09:49 Lixeiro: You need kill just 1000 of him

09:49 Lixeiro: You already did this task, player. Wait 24 hours to do it again. (CERTO)

 

logo q entrega a task

09:49 Faltam 996 Enraged Typhlosion para terminar a task. começa a contar denovo

 

 

onkill:

Spoiler

local configs = {

--        {name = "War Gyarados", storage = 10294, valuerequest = 1000, storagerequest = 14123}, -- Mude valuerequest para a quantidade que o player deve matar

--        {name = "War Heracross", storage = 10295, valuerequest = 1000, storagerequest = 14124},

        {name = "Furiuos Mantine", storage = 10296, valuerequest = 1000, storagerequest = 14125}, -- Mude valuerequest para a quantidade que o player deve matar

        {name = "Enraged Typhlosion", storage = 10297, valuerequest = 1000, storagerequest = 14126},        

}

function onKill(cid, target)

        for _, t in ipairs(configs) do

            if getPlayerStorageValue(cid, t.storage) >= 1 then

                if getCreatureName(target) == t.name then

                    setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)

                    doPlayerSendTextMessage(cid, 20, "Faltam ".. t.valuerequest - getPlayerStorageValue(cid, t.storagerequest) .." " .. t.name .. " para terminar a task.")

                    return true

                end

            end

        end

    return true

end

 

npc script:

Spoiler

local configs = {

--    {word = "War Gyarados",  sto = 10294, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14123, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

--    {word = "War Heracross",  sto = 10295, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14124, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

{word = "Furios Mantine",  sto = 10296, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14125, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

    {word = "Enraged Typhlosion",  sto = 10297, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14126, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

}

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

    for _, npc in ipairs(configs) do

        if(msgcontains(msg, ''..npc.word..'')) then

            if getPlayerStorageValue(cid, npc.sto) >= 1 then

                if getPlayerStorageValue(cid, npc.storageid) < os.time() then

                    if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then

                        doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)

                        setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest) 

                        setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)

                        doPlayerAddExperience(cid, npc.rewardexp)

                        doSendAnimatedText(pos, npc.rewardexp, 215)

                        selfSay(''..npc.text..'', cid) 

                        talkState[talkUser] = 0 

                    else

                        selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')

                        talkState[talkUser] = 0 

                    end

                else

                    selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)

                        talkState[talkUser] = 0 

                    end

                end

            else

                selfSay('You are gain the '..npc.word..' task!!', cid)

                selfSay('You need kill just '..npc.valuerequest..' of him', cid)

                setPlayerStorageValue(cid, npc.sto, 1)

            end

        end

        return true

    end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Editado por Josegvb
Link para o comentário
Compartilhar em outros sites

  • 0

Npc:

 

local configs = {--    {word = "War Gyarados",  sto = 10294, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14123, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};--    {word = "War Heracross",  sto = 10295, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14124, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};    {word = "Furios Mantine",  sto = 10296, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14125, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};    {word = "Enraged Typhlosion",  sto = 10297, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14126, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};}local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)    if(not npcHandler:isFocused(cid)) then        return false    end    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    for _, npc in ipairs(configs) do        if(msgcontains(msg, ''..npc.word..'')) then            if getPlayerStorageValue(cid, npc.sto) ~= 1 then                if getPlayerStorageValue(cid, npc.storageid) < os.time() then                    if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then                        doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)                        setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest)                         setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)                        setPlayerStorageValue(cid, npc.sto, 1)                        doPlayerAddExperience(cid, npc.rewardexp)                        doSendAnimatedText(pos, npc.rewardexp, 215)                        selfSay(''..npc.text..'', cid)                         talkState[talkUser] = 0                     else                        selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')                        talkState[talkUser] = 0                     end                else                    selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)                        talkState[talkUser] = 0                     end                end            else                selfSay('You are gain the '..npc.word..' task!!', cid)                selfSay('You need kill just '..npc.valuerequest..' of him', cid)                setPlayerStorageValue(cid, npc.sto, 1)            end        end        return true    endnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Kill:

 

function onKill(cid, target)        for _, t in ipairs(configs) do            if getPlayerStorageValue(cid, t.storage) >= 1 then                if getCreatureName(target) == t.name then                    setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)                    doPlayerSendTextMessage(cid, 20, "Faltam ".. (t.valuerequest - getPlayerStorageValue(cid, t.storagerequest)) .." " .. t.name .. " para terminar a task.")                    return true                end            end        end    return trueend

 

Link para o comentário
Compartilhar em outros sites

  • 0
9 horas atrás, Drazyn1291 disse:

Npc:

 

local configs = {--    {word = "War Gyarados",  sto = 10294, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14123, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};--    {word = "War Heracross",  sto = 10295, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14124, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};    {word = "Furios Mantine",  sto = 10296, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14125, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};    {word = "Enraged Typhlosion",  sto = 10297, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14126, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};}local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)    if(not npcHandler:isFocused(cid)) then        return false    end    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    for _, npc in ipairs(configs) do        if(msgcontains(msg, ''..npc.word..'')) then            if getPlayerStorageValue(cid, npc.sto) ~= 1 then                if getPlayerStorageValue(cid, npc.storageid) < os.time() then                    if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then                        doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)                        setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest)                         setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)                        setPlayerStorageValue(cid, npc.sto, 1)                        doPlayerAddExperience(cid, npc.rewardexp)                        doSendAnimatedText(pos, npc.rewardexp, 215)                        selfSay(''..npc.text..'', cid)                         talkState[talkUser] = 0                     else                        selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')                        talkState[talkUser] = 0                     end                else                    selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)                        talkState[talkUser] = 0                     end                end            else                selfSay('You are gain the '..npc.word..' task!!', cid)                selfSay('You need kill just '..npc.valuerequest..' of him', cid)                setPlayerStorageValue(cid, npc.sto, 1)            end        end        return true    endnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Kill:

 

function onKill(cid, target)        for _, t in ipairs(configs) do            if getPlayerStorageValue(cid, t.storage) >= 1 then                if getCreatureName(target) == t.name then                    setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)                    doPlayerSendTextMessage(cid, 20, "Faltam ".. (t.valuerequest - getPlayerStorageValue(cid, t.storagerequest)) .." " .. t.name .. " para terminar a task.")                    return true                end            end        end    return trueend

 

 

 

[14/05/2016 19:46:33] [Error - CreatureScript Interface] 

[14/05/2016 19:46:33] data/creaturescripts/scripts/onkill.lua:onKill

[14/05/2016 19:46:34] Description: 

[14/05/2016 19:46:34] data/creaturescripts/scripts/onkill.lua:2: bad argument #1 to 'ipairs' (table expected, got nil)

[14/05/2016 19:46:35] stack traceback:

[14/05/2016 19:46:35]     [C]: in function 'ipairs'

[14/05/2016 19:46:36]     data/creaturescripts/scripts/onkill.lua:2: in function <data/creaturescripts/scripts/onkill.lua:1>

Link para o comentário
Compartilhar em outros sites

  • 0

up ;..; voltei pro o antigo script :/ 

Spoiler

local configs = {
--    {word = "War Gyarados",  sto = 10294, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14123, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
--    {word = "War Heracross",  sto = 10295, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14124, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
-- {word = "Ancient Meganium",  sto = 10296, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14125, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
-- {word = "Enraged Typhlosion",  sto = 10297, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14126, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
{word = "Thief",  sto = 10299, money = 0, rewardid = 15590, rewardcount = 100, rewardexp = 10000000, storageid = 5457, storagevalue = os.time() + 1*24*60*60, storagerequest = 14128, valuerequest = 12, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};    
{word = "Furious Ampharos",  sto = 10290, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5458, storagevalue = os.time() + 1*24*60*60, storagerequest = 14129, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
{word = "Brave Venusaur",  sto = 10289, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5458, storagevalue = os.time() + 1*24*60*60, storagerequest = 14130, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
}
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
    for _, npc in ipairs(configs) do
        if(msgcontains(msg, ''..npc.word..'')) then
            if getPlayerStorageValue(cid, npc.sto) >= 1 then
                if getPlayerStorageValue(cid, npc.storageid) < os.time() then
                    if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then
                        doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)
                        setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest) 
                        setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)
                        doPlayerAddExperience(cid, npc.rewardexp)
                        doSendAnimatedText(pos, npc.rewardexp, 215)
                        selfSay(''..npc.text..'', cid) 
                        talkState[talkUser] = 0 
                    else
                        selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')
                        talkState[talkUser] = 0 
                    end
                else
                    selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)
                        talkState[talkUser] = 0 
                    end
                end
            else
                selfSay('You are gain the '..npc.word..' task!!', cid)
                selfSay('You need kill just '..npc.valuerequest..' of him', cid)
                setPlayerStorageValue(cid, npc.sto, 1)
            end
        end
        return true
    end

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

 

mas ta chato isso q qualquer coisa q vc fala ele responde

e904d328d40dcbf391d9c1b9c6fe20a4.png

 

e se falar alguma das opçoes q ele fala ai, ele ira responder na janela default + na janela de npc tb ;x

1b5d9f4d9d9725322e1dd376856fcb11.gif

 

tmb qndo caba a task e peça pro o npc denoevo ira resetar o contador ;x 

 

Spoiler

local configs = {
--        {name = "War Gyarados", storage = 10294, valuerequest = 1000, storagerequest = 14123}, -- Mude valuerequest para a quantidade que o player deve matar
--        {name = "War Heracross", storage = 10295, valuerequest = 1000, storagerequest = 14124},
        {name = "Ancient Meganium", storage = 10296, valuerequest = 1000, storagerequest = 14125}, -- Mude valuerequest para a quantidade que o player deve matar
        {name = "Enraged Typhlosion", storage = 10297, valuerequest = 1000, storagerequest = 14126},    
        {name = "Thief", storage = 10299, valuerequest = 12, storagerequest = 14128},        
        {name = "ThiefM", storage = 10299, valuerequest = 12, storagerequest = 14128},        
        {name = "ThiefF", storage = 10299, valuerequest = 12, storagerequest = 14128},        
        {name = "Furious Ampharos", storage = 10290, valuerequest = 1000, storagerequest = 14129},
        {name = "Brave Venusaur", storage = 10289, valuerequest = 1000, storagerequest = 14130},
}

function onKill(cid, target)
        for _, t in ipairs(configs) do
            if getPlayerStorageValue(cid, t.storage) >= 1 then
                if getCreatureName(target) == t.name then
                    setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)
                    doPlayerSendTextMessage(cid, 20, "Faltam ".. t.valuerequest - getPlayerStorageValue(cid, t.storagerequest) .." " .. t.name .. " para terminar a task.")
                    return true
                end
            end
        end
    return true
end

 

Editado por Josegvb
Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, Josegvb disse:

up ;..; voltei pro o antigo script :/ 

  Ocultar conteúdo

local configs = {

--    {word = "War Gyarados",  sto = 10294, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14123, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

--    {word = "War Heracross",  sto = 10295, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 14124, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

-- {word = "Ancient Meganium",  sto = 10296, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14125, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

-- {word = "Enraged Typhlosion",  sto = 10297, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5456, storagevalue = os.time() + 1*24*60*60, storagerequest = 14126, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

{word = "Thief",  sto = 10299, money = 0, rewardid = 15590, rewardcount = 100, rewardexp = 10000000, storageid = 5457, storagevalue = os.time() + 1*24*60*60, storagerequest = 14128, valuerequest = 12, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};    

{word = "Furious Ampharos",  sto = 10290, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5458, storagevalue = os.time() + 1*24*60*60, storagerequest = 14129, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

{word = "Brave Venusaur",  sto = 10289, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5458, storagevalue = os.time() + 1*24*60*60, storagerequest = 14130, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};

}

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

    for _, npc in ipairs(configs) do

        if(msgcontains(msg, ''..npc.word..'')) then

            if getPlayerStorageValue(cid, npc.sto) >= 1 then

                if getPlayerStorageValue(cid, npc.storageid) < os.time() then

                    if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then

                        doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)

                        setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest) 

                        setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)

                        doPlayerAddExperience(cid, npc.rewardexp)

                        doSendAnimatedText(pos, npc.rewardexp, 215)

                        selfSay(''..npc.text..'', cid) 

                        talkState[talkUser] = 0 

                    else

                        selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')

                        talkState[talkUser] = 0 

                    end

                else

                    selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)

                        talkState[talkUser] = 0 

                    end

                end

            else

                selfSay('You are gain the '..npc.word..' task!!', cid)

                selfSay('You need kill just '..npc.valuerequest..' of him', cid)

                setPlayerStorageValue(cid, npc.sto, 1)

            end

        end

        return true

    end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

mas ta chato isso q qualquer coisa q vc fala ele responde

e904d328d40dcbf391d9c1b9c6fe20a4.png

 

e se falar alguma das opçoes q ele fala ai, ele ira responder na janela default + na janela de npc tb ;x

1b5d9f4d9d9725322e1dd376856fcb11.gif

 

tmb qndo caba a task e peça pro o npc denoevo ira resetar o contador ;x 

 

  Ocultar conteúdo

local configs = {

--        {name = "War Gyarados", storage = 10294, valuerequest = 1000, storagerequest = 14123}, -- Mude valuerequest para a quantidade que o player deve matar

--        {name = "War Heracross", storage = 10295, valuerequest = 1000, storagerequest = 14124},

        {name = "Ancient Meganium", storage = 10296, valuerequest = 1000, storagerequest = 14125}, -- Mude valuerequest para a quantidade que o player deve matar

        {name = "Enraged Typhlosion", storage = 10297, valuerequest = 1000, storagerequest = 14126},    

        {name = "Thief", storage = 10299, valuerequest = 12, storagerequest = 14128},        

        {name = "ThiefM", storage = 10299, valuerequest = 12, storagerequest = 14128},        

        {name = "ThiefF", storage = 10299, valuerequest = 12, storagerequest = 14128},        

        {name = "Furious Ampharos", storage = 10290, valuerequest = 1000, storagerequest = 14129},

        {name = "Brave Venusaur", storage = 10289, valuerequest = 1000, storagerequest = 14130},

}

function onKill(cid, target)

        for _, t in ipairs(configs) do

            if getPlayerStorageValue(cid, t.storage) >= 1 then

                if getCreatureName(target) == t.name then

                    setPlayerStorageValue(cid, t.storagerequest, getPlayerStorageValue(cid, t.storagerequest) + 1)

                    doPlayerSendTextMessage(cid, 20, "Faltam ".. t.valuerequest - getPlayerStorageValue(cid, t.storagerequest) .." " .. t.name .. " para terminar a task.")

                    return true

                end

            end

        end

    return true

end

 

Então oq falta nesse script que fiz, Falta corrigir isso de mandar a ms direto e quando terminar a task tem que resetar a contagem pra 0, certo? Mais algo?

Link para o comentário
Compartilhar em outros sites

  • 0
34 minutos atrás, Drazyn1291 disse:

Então oq falta nesse script que fiz, Falta corrigir isso de mandar a ms direto e quando terminar a task tem que resetar a contagem pra 0, certo? Mais algo?

 

oque falta seria q colocasse um tipo quando ele falasse o nome da task ele responde: "Tem certeza que quer matar 1000 nomedobixo?" ai o player falase yes e começaria a contar os bixos, tb q paresse esse erro q vc fala qualquer coisa e ele fala q tem q matar td isso, mas acho q isso é no antigo script, nem tenho certeza de oque voce fez no novo, se tiver como arrumar pra eu ver oque tem errado nele ai eu falo se estiver faltando algo ^^ 

Link para o comentário
Compartilhar em outros sites

  • 0

Pronto, refiz todo o script, acho que ficou tão baum que até eu vou usar kkkk

 

Kill:

function onKill(cid, target)        for _, t in ipairs(configs) do            local total_count = t.valuerequest            local m_sto = t.storage            local count_sto = t.storagerequest            local rest = total_count - getPlayerStorageValue(cid, count_sto)            if getPlayerStorageValue(cid, m_sto) >= 1 then                if getCreatureName(target) == t.name then                    if getPlayerStorageValue(cid, count_sto) < total_count then                        setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)                        doPlayerSendTextMessage(cid, 20, "Missing ".. rest .." " .. t.name .. " to finish the task.")                        return true                    end                end            end        end    return trueend

NPC:

 

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)    if(not npcHandler:isFocused(cid)) then        return false    end    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    for _, configss in ipairs(configs) do -- lê todas as tabelas        local name = configs.word        local m_sto = configss.sto        local time_sto = configss.storageid        local count_sto = configss.storagerequest        local total_count = configss.valuerequest        local rest = total_count - getPlayerStorageValue(cid, count_sto)        if msgcontains(msg, name) then -- Verifica se o player falou o nome da criatura            if getPlayerStorageValue(cid, time_sto) < os.time() then -- verifica se o player ainda está no prazo                if getPlayerStorageValue(cid, msto) <= 0 then -- verifica se o player não pegou está task                    selfSay('Are you sure you want to do the task '.. total_count ..' '.. name ..'?', cid)                    if isInArray({'yes', 'sim', 'claro', 'yeah'}, msg) then                        selfSay('Ready! Now you need kill a '.. total_count .. ' '.. name .. '!', cid)                        setPlayerStorageValue(cid, npc.sto, 1)                        talkState[talkUser] = 0                      end                                  else                    if getPlayerStorageValue(cid, count_sto) >= total_count then -- Verifica se o player matou todos os monstros nescessários                        doPlayerAddItem(cid, configss.rewardid, configss.rewardcount)                        setPlayerStorageValue(cid, count_sto, 0)                         setPlayerStorageValue(cid, time_sto, npc.storagevalue)                        doPlayerAddExperience(cid, configss.rewardexp)                        doSendAnimatedText(pos, configssconfigss.rewardexp, 215)                        selfSay(configss.text, cid)                         talkState[talkUser] = 0                    else                        selfSay('You need to kill '..rest..' '..name..' to gain a reward.')                        talkState[talkUser] = 0                    end                end            else                selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, time_sto) - os.time())/(60*60))..' hours to do it again.', cid)                talkState[talkUser] = 0            end        end        return true    endnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Pronto! Não testei mas acho que desta vez vai funcionar!

Editado por Drazyn1291
Link para o comentário
Compartilhar em outros sites

  • 0
46 minutos atrás, Drazyn1291 disse:

Pode usar a mesma tabela anterior, não modifiquei nada nas tabelas!

 

tava dando esse erro

 

[15/05/2016 10:53:27] [Error - LuaScriptInterface::loadFile] data/npc/scripts/lixeiro.lua:52: 'end' expected (to close 'function' at line 9) near '<eof>'

[15/05/2016 10:53:27] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/lixeiro.lua

[15/05/2016 10:53:27] data/npc/scripts/lixeiro.lua:52: 'end' expected (to close 'function' at line 9) near '<eof>'

 

ai adicionei um end extra no final e arrumou, porem agora quando vc fala pro ele o nome dos bixos n responde,

ta dando esse erro

[15/05/2016 10:58:23] [Error - Npc interface] 

[15/05/2016 10:58:23] data/npc/scripts/lixeiro.lua:onCreatureSay

[15/05/2016 10:58:23] Description: 

[15/05/2016 10:58:23] data/npc/scripts/lixeiro.lua:14: bad argument #1 to 'ipairs' (table expected, got nil)

[15/05/2016 10:58:23] stack traceback:

[15/05/2016 10:58:23]     [C]: in function 'ipairs'

[15/05/2016 10:58:23]     data/npc/scripts/lixeiro.lua:14: in function 'callback'

[15/05/2016 10:58:23]     data/npc/lib/npcsystem/npchandler.lua:391: in function 'onCreatureSay'

[15/05/2016 10:58:23]     data/npc/scripts/lixeiro.lua:7: in function <data/npc/scripts/lixeiro.lua:7>

 

 

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

    for _, configss in ipairs(configs) do -- lê todas as tabelas

        local name = configs.word

        local m_sto = configss.sto

        local time_sto = configss.storageid

        local count_sto = configss.storagerequest

        local total_count = configss.valuerequest

        local rest = total_count - getPlayerStorageValue(cid, count_sto)

        if msgcontains(msg, name) then -- Verifica se o player falou o nome da criatura

            if getPlayerStorageValue(cid, time_sto) < os.time() then -- verifica se o player ainda está no prazo

                if getPlayerStorageValue(cid, msto) <= 0 then -- verifica se o player não pegou está task

                    selfSay('Are you sure you want to do the task '.. total_count ..' '.. name ..'?', cid)

                    if isInArray({'yes', 'sim', 'claro', 'yeah'}, msg) then

                        selfSay('Ready! Now you need kill a '.. total_count .. ' '.. name .. '!', cid)

                        setPlayerStorageValue(cid, npc.sto, 1)

                        talkState[talkUser] = 0  

                    end                  

                else

                    if getPlayerStorageValue(cid, count_sto) >= total_count then -- Verifica se o player matou todos os monstros nescessários

                        doPlayerAddItem(cid, configss.rewardid, configss.rewardcount)

                        setPlayerStorageValue(cid, count_sto, 0) 

                        setPlayerStorageValue(cid, time_sto, npc.storagevalue)

                        doPlayerAddExperience(cid, configss.rewardexp)

                        doSendAnimatedText(pos, configssconfigss.rewardexp, 215)

                        selfSay(configss.text, cid) 

                        talkState[talkUser] = 0

                    else

                        selfSay('You need to kill '..rest..' '..name..' to gain a reward.')

                        talkState[talkUser] = 0

                    end

                end

            else

                selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, time_sto) - os.time())/(60*60))..' hours to do it again.', cid)

                talkState[talkUser] = 0

            end

        end

        return true

    end

    end

    

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Editado por Josegvb
Link para o comentário
Compartilhar em outros sites

  • 0

 

Coloca isso no configuration.lua lá no final

tasksss = {   {name = "Brave Venusaur",  sto = 10289, count = 1000, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};}

Tu só vai usar essa tabela para configurar os 2 scripts!

 

Agora substitui o onKill por esse:

 

function onKill(cid, target)        for _, t in ipairs(tasksss) do            local total_count = t.count            local m_sto = t.storage            local count_sto = t.sto_count            local rest = total_count - getPlayerStorageValue(cid, count_sto)            if getPlayerStorageValue(cid, m_sto) >= 1 then                if getCreatureName(target) == t.name then                    if rest > 0 then                        setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)                        doPlayerSendTextMessage(cid, 20, "Missing ".. rest .." " .. t.name .. " para terminar a task.")                        return true                    end                end            end        end    return trueend

E substitui o Npc por esse:

 

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)    if(not npcHandler:isFocused(cid)) then        return false    end    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    for _, configss in ipairs(tasksss) do -- lê todas as tabelas        local name = configs.word        local m_sto = configss.sto        local time_sto = configss.time_sto        local count_sto = configss.sto_count        local total_count = configss.count        local rest = total_count - getPlayerStorageValue(cid, count_sto)        if msgcontains(msg, name) then -- Verifica se o player falou o nome da criatura            if getPlayerStorageValue(cid, time_sto) < os.time() then -- verifica se o player ainda está no prazo                if getPlayerStorageValue(cid, m_sto) <= 0 then -- verifica se o player não pegou está task                    selfSay('Are you sure you want to do the task '.. total_count ..' '.. name ..'?', cid)                    if isInArray({'yes', 'sim', 'claro', 'yeah'}, msg) then                        selfSay('Ready! Now you need kill a '.. total_count .. ' '.. name .. '!', cid)                        setPlayerStorageValue(cid, m_sto, 1)                        talkState[talkUser] = 0                      end                                  else                    if rest <= 0 then -- Verifica se o player matou todos os monstros nescessários                        doPlayerAddItem(cid, configss.rewardid, configss.rewardcount)                        setPlayerStorageValue(cid, count_sto, 0)                         setPlayerStorageValue(cid, m_sto, 0)                         setPlayerStorageValue(cid, time_sto, os.time() + configss.time)                        doPlayerAddExperience(cid, configss.rewardexp)                        doSendAnimatedText(getCreaturePosition(cid), configss.rewardexp, 215)                        selfSay(configss.text, cid)                         talkState[talkUser] = 0                    else                        selfSay('You need to kill '..rest..' '..name..' to gain a reward.')                        talkState[talkUser] = 0                    end                end            else                selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, time_sto) - os.time())/(60*60))..' hours to do it again.', cid)                talkState[talkUser] = 0            end        end        return true    endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Qual quer coisa já sabe né kk

Editado por Drazyn1291
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...