[Resolvido] Pequena função !

skyofdeus
em Resolvidos
  • 1
  • 2

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

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.

Strogman

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 04/11/12Posts: 464Gênero: MasculinoChar no Tibia: Lysty Of Death

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

 

 

                                 logo_full_1600.png.f8d0c5d8ba71c660bad630b327c3e64d.png

                                                              htps://www.facebook.com/PokemonOnlineSVKE

                                                                                                                       PokeSvke

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos
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 ?

 

Luga03

Gabriel Lucena :D
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 14/04/15Posts: 956Gênero: Masculino


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

 

Hello! How are you? It's fine? 

 

Okay, so you like my helps? if yes, then do you can like my post, give-me a reputation, you can't?

 

Good morning for everyone! And have a good day!

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

Deu certo não, esta apresentando erros.

Imagem abaixo;

 

2ms510l.jpg

Caronte

Ex-Moderador de Scripting
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 25/09/10Posts: 1341Gênero: Masculino

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

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

Ainda persiste com erro;

Imagem abaixo;

 

24ovnsj.jpg


uppp


up²


Alguem mais? Upp !

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

Ninguem mesmo ?

Caronte

Ex-Moderador de Scripting
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 25/09/10Posts: 1341Gênero: Masculino


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

 

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

Erro ainda persistente.

Segue imagem abaixo;

 

2ms2b88.jpg

Caronte

Ex-Moderador de Scripting
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 25/09/10Posts: 1341Gênero: Masculino


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

 

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

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

 

Erro:

 

2ms0cjb.jpg

skyofdeus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/03/08Posts: 73Char no Tibia: Demonica dos infernos

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

  • 1
  • 2