SK

[Resolvido] Pequena função !

Por skyofdeus, 27 de dez. de 2015 em Resolvidos

script
resolvido
18
3.2k
skyofdeusS
27 de dezembro de 2015 às 16:06

Olá, estou usando um pequeno script que encontrei aqui no forum, que é refetente a "PETs", mais quero adicionar algumas novas funções nele, mais não consigo, se alguem puder me ajudar agradeço.

 

Script baixo:

 

function onUse(cid, item, frompos, item2, topos)



local dolls = {

[11256] = {pet = "Rat"},

[11207] = {pet = "Monk"},

[11144] = {pet = "Dragon"},

[9019] = {pet = "Frost Dragon"},

}

local go = dolls[item.itemid]

local summon = getCreatureSummons(cid)



---------------------------------------------------



if #summon >= 1 then

for _, pid in ipairs(summon) do

doRemoveCreature(pid)

doCreatureSay(cid, "Can go rest ["..go.pet..]", TALKTYPE_ORANGE_1)

end

return true

end



doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))

doCreatureSay(cid, "Let battle ["..go.pet..]", TALKTYPE_ORANGE_1)

return true

end

 

 

Explicação;

- O jogador precisa de X item para chamar o pet certo ? Quero que apenas um item chame todos esses pets, mais por level, assim;

Level 1 até 10 ele tera um "rat" para chamar, apartir do lvl 11 eté lvl 20 ele tera um monk.

- O item que ele usa tera um tempo para usar novamente, ou seja quando der use, ele vira outra coisa, e depois de 30 minutos este item voltara ao normal, apenas um exaust para não ficar uma coisa repetitiva.

 

Agradeço se puderem me ajudar.

StrogmanS
27 de dezembro de 2015 às 16:34

Olá, estou usando um pequeno script que encontrei aqui no forum, que é refetente a "PETs", mais quero adicionar algumas novas funções nele, mais não consigo, se alguem puder me ajudar agradeço.

 

Script baixo:

 

 

Explicação;

- O jogador precisa de X item para chamar o pet certo ? Quero que apenas um item chame todos esses pets, mais por level, assim;

Level 1 até 10 ele tera um "rat" para chamar, apartir do lvl 11 eté lvl 20 ele tera um monk.

- O item que ele usa tera um tempo para usar novamente, ou seja quando der use, ele vira outra coisa, e depois de 30 minutos este item voltara ao normal, apenas um exaust para não ficar uma coisa repetitiva.

 

Agradeço se puderem me ajudar.

 

function onUse(cid, item, frompos, item2, topos)
local go = "Rat"
if getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then
go = "Monk"
elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then
go = "Dragon"
else
go = "Frost Dragon"
end

local summon = getCreatureSummons(cid)
---------------------------------------------------
if #summon >= 1 then
for _, pid in ipairs(summon) do
doRemoveCreature(pid)
doCreatureSay(cid, "Can go rest ["..go.."]", TALKTYPE_ORANGE_1)
end
return true
end

doConvinceCreature(cid, doSummonCreature(go, getCreaturePosition(cid)))
doCreatureSay(cid, "Let battle ["..go.."]", TALKTYPE_ORANGE_1)
return true
end

 

skyofdeusS
27 de dezembro de 2015 às 16:42
function onUse(cid, item, frompos, item2, topos)
local go = "Rat"
if getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then
go = "Monk"
elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then
go = "Dragon"
elseif getPlayerLevel(cid) >= 31 and getPlayerLevel(cid) <= 40 then
go = "Dragon Lord"
end
end

local summon = getCreatureSummons(cid)
---------------------------------------------------
if #summon >= 1 then
for _, pid in ipairs(summon) do
doRemoveCreature(pid)
doCreatureSay(cid, "Can go rest ["..go.."]", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, 1978, 1)
doPlayerAddItem(cid, 1979, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used the sacred book of the Necromancers , now wait 30 minutes to use again!.")
end
return true
end

doConvinceCreature(cid, doSummonCreature(go, getCreaturePosition(cid)))
doCreatureSay(cid, "Let battle ["..go.."]", TALKTYPE_ORANGE_1)
return true
end

Quero adicionar um tempo entre as ações doPlayerAddItem(cid, 1978, 1) e doPlayerAddItem(cid, 1979, 1).

Tempo de 10 segundos, acontece a função doPlayerAddItem(cid, 1978, 1) e depois de 10 segundos acontece a doPlayerAddItem(cid, 1979, 1), podem me ajudar ?

 

Editado Dezembro 27 por skyof

Luga03L
28 de dezembro de 2015 às 12:24


function onUse(cid, item, frompos, item2, topos)

local go = "Rat"

local tempo = 10 - em segundos

if getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then

go = "Monk"

elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then

go = "Dragon"

elseif getPlayerLevel(cid) >= 31 and getPlayerLevel(cid) <= 40 then

go = "Dragon Lord"

end

end

 

local summon = getCreatureSummons(cid)

---------------------------------------------------

if #summon >= 1 then

for _, pid in ipairs(summon) do

doRemoveCreature(pid)

doCreatureSay(cid, "Can go rest ["..go.."]", TALKTYPE_ORANGE_1)

doRemoveItem(item.uid, 1)

doPlayerAddItem(cid, 1978, 1)

addEvent(function()

doPlayerAddItem(cid, 1979, 1)

end, tempo*1000)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used the sacred book of the Necromancers , now wait 30 minutes to use again!.")

end

return true

end

 

doConvinceCreature(cid, doSummonCreature(go, getCreaturePosition(cid)))

doCreatureSay(cid, "Let battle ["..go.."]", TALKTYPE_ORANGE_1)

return true

end

 

skyofdeusS
28 de dezembro de 2015 às 21:22

Deu certo não, esta apresentando erros.

Imagem abaixo;

 

2ms510l.jpg

CaronteC
28 de dezembro de 2015 às 21:25

O script do de cima corrigido:

function onUse(cid, item, frompos, item2, topos)
local go = "Rat"
local tempo = 10 -- em segundos
if getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then
go = "Monk"
elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then
go = "Dragon"
elseif getPlayerLevel(cid) >= 31 and getPlayerLevel(cid) <= 40 then
go = "Dragon Lord"
end
end

local summon = getCreatureSummons(cid)
---------------------------------------------------
if #summon >= 1 then
for _, pid in ipairs(summon) do
doRemoveCreature(pid)
doCreatureSay(cid, "Can go rest ["..go.."]", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, 1978, 1)
addEvent(function()
doPlayerAddItem(cid, 1979, 1)
end, tempo*1000)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used the sacred book of the Necromancers , now wait 30 minutes to use again!.")
end
return true
end

doConvinceCreature(cid, doSummonCreature(go, getCreaturePosition(cid)))
doCreatureSay(cid, "Let battle ["..go.."]", TALKTYPE_ORANGE_1)
return true

skyofdeusS
02 de janeiro de 2016 às 15:40

Ainda persiste com erro;

Imagem abaixo;

 

24ovnsj.jpg


uppp


up²


Alguem mais? Upp !

skyofdeusS
09 de janeiro de 2016 às 15:17

Ninguem mesmo ?

CaronteC
09 de janeiro de 2016 às 15:45


function onUse(cid, item, frompos, item2, topos)

local go = "Rat"

local tempo = 10 -- em segundos

if getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then

go = "Monk"

elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then

go = "Dragon"

elseif getPlayerLevel(cid) >= 31 and getPlayerLevel(cid) <= 40 then

go = "Dragon Lord"

end

end

 

local summon = getCreatureSummons(cid)

---------------------------------------------------

if summon >= 1 then

for _, pid in ipairs(summon) do

doRemoveCreature(pid)

doCreatureSay(cid, "Can go rest ["..go.."]", TALKTYPE_ORANGE_1)

doRemoveItem(item.uid, 1)

doPlayerAddItem(cid, 1978, 1)

addEvent(function()

doPlayerAddItem(cid, 1979, 1)

end, tempo*1000)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used the sacred book of the Necromancers , now wait 30 minutes to use again!.")

end

return true

end

 

doConvinceCreature(cid, doSummonCreature(go, getCreaturePosition(cid)))

doCreatureSay(cid, "Let battle ["..go.."]", TALKTYPE_ORANGE_1)

return true

end

 

skyofdeusS
09 de janeiro de 2016 às 16:09

Erro ainda persistente.

Segue imagem abaixo;

 

2ms2b88.jpg

CaronteC
09 de janeiro de 2016 às 16:15
Melhor resposta


function onUse(cid, item, frompos, item2, topos)

local go = "Rat"

local tempo = 10 -- em segundos

if getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then

go = "Monk"

elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then

go = "Dragon"

elseif getPlayerLevel(cid) >= 31 and getPlayerLevel(cid) <= 40 then

go = "Dragon Lord"

end

 

if #getCreatureSummons(cid) >= 1 then

for _, pid in ipairs(getCreatureSummons(cid)) do

doRemoveCreature(pid)

doCreatureSay(cid, "Can go rest ["..go.."]", TALKTYPE_ORANGE_1)

doRemoveItem(item.uid, 1)

doPlayerAddItem(cid, 1978, 1)

addEvent(function()

doPlayerAddItem(cid, 1979, 1)

end, tempo*1000)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used the sacred book of the Necromancers , now wait 30 minutes to use again!.")

end

return true

end

 

 

doConvinceCreature(cid, doSummonCreature(go, getCreaturePosition(cid)))

doCreatureSay(cid, "Let battle ["..go.."]", TALKTYPE_ORANGE_1)

return true

end

 

Editado Janeiro 9 por Caronte

skyofdeusS
09 de janeiro de 2016 às 16:57

Server iniciou sem erro, porem ao tentar usar o item da erro, segue abaixo o erro;

 

Erro:

 

2ms0cjb.jpg

CaronteC
09 de janeiro de 2016 às 18:24

post editado...

skyofdeusS
09 de janeiro de 2016 às 18:32

Estamos quase lá. rsrsrsrs :happy:

Descrição;

- Ao usar o item o mostro e sumonado, porem não e realizado a 2º função, quando re-clico no item, acontece um erro, segue imagem abaixo.

 

Erro:

 

118olxu.jpg

CaronteC
09 de janeiro de 2016 às 19:38

pronto.