Bom Galerinha do Xtibia, Estou mais uma vez postando um script Meo
Bom, esse meu pet system é pelas talkaction, e tem o buypet por action.
Atualizações
Novidade - V4
!remove reformulado, !creat editado para evitar quais quer possivel bug
Novidades - V3
!remove summon
Novidades - V2
Não pode mais sumonar dentro de pz
PET SYSTEM
Versão 8.~
crie um arquivo chamado petsystem.lua em Talkaction/scripts
e adicione isso dentro
function onSay(cid, words, param, itemEx, params)
local summons = getCreatureSummons(cid)
if words == "!remove" then
for _, k in ipairs(summons) do
doRemoveCreature(k)
end
end
end
local pet = {
["Dragon Hatchling"] = {25,34},
["Dragon"] = {35,54},
["Dragon Lord"] = {55,84},
["Ghastly Dragon"] = {85,99},
["Undead Dragon"] = {100,9999}
}
for k,v in pairs(pet) do -- 0
if words == "!creat" then -- 1
if getPlayerLevel(cid) >= v[1] and getPlayerLevel(cid) < v[2] then -- 2
if getPlayerStorageValue(cid, 78552) == 1 then -- 3
if (table.maxn(summons) < 1)then -- 4
if getTilePzInfo(getCreaturePosition(cid)) == false then --5
x = doSummonCreature(k, getCreaturePosition(cid))
doConvinceCreature(cid, x)
doCreatureSay(cid, k ..", go!", 1)
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 2)
else
doPlayerSendCancel(cid,"You can summon in Pz.")
return true
end -- 5
else
doPlayerSendCancel(cid,"You can summon only 1 Pet.")
return true
end -- 4
else
doPlayerSendCancel(cid,"You no have Pet.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You no have Pet.")
end -- 3
else
doPlayerSendCancel(cid,"You no have level for use Pet.")
end -- 2
end -- 1
end -- 0
return true
end
Versão 9.~
crie um arquivo chamado petsystem.lua em Talkaction/scripts
e adicione isso dentro
function onSay(cid, words, param, itemEx)
local summons = getCreatureSummons(cid)
if words == "!remove" then
for _, k in ipairs(summons) do
doRemoveCreature(k)
end
end
local pet = {
["Rat"] = {1,5},
["Dragon"] = {6,60}
}
for k,v in pairs(pet) do -- 0
if words == "!creat" then -- 1
if getPlayerLevel(cid) >= v[1] and getPlayerLevel(cid) <= v[2] then -- 2
if getPlayerStorageValue(cid, 78552) == 1 then -- 3
if (table.maxn(summons) < 1)then -- 4
if getTilePzInfo(getCreaturePosition(cid)) == false then -- 5
x = doSummonCreature(k, getCreaturePosition(cid))
doConvinceCreature(cid, x)
doCreatureSay(cid, k ..", go!", 1)
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 2)
else
doPlayerSendCancel(cid,"You can summon in Pz.")
return true
end -- 5
else
doPlayerSendCancel(cid,"You can summon only 1 Pet.")
return true
end -- 4
else
doPlayerSendCancel(cid,"You no have Pet.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You no have Pet.")
end -- 3
else
doPlayerSendCancel(cid,"You no have level for use Pet.")
end -- 2
end -- 1
end -- 0
return true
end
e isso em Talkaction.xml
<talkaction words="!creat" event="script" value="petsystem.lua"/>
e Isso
<talkaction words="!remove" event="script" value="petsystem.lua"/>
BUY PET
crie um arquivo chamado petitem.lua em Actions/scripts
e adicione isso dentro
function onUse(cid, words, param, item)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou um Pet")
setPlayerStorageValue(cid, 78552, 1)
doRemoveItem(item.uid,1)
end
e isso em Action.xml
<action itemid="3905" event="script" value="petitem.lua" allowfaruse="1"/>
CONFIGURANDO
["nome"] = {Level minimo para usar ,Level maximo para usar},
Exemplo :
["Demon"] = {100,150},
OBS : O ultimo monstro da tabela não deve ter uma virgula no final. Todos que tiveram antes dele tem que ter a virgula.
Exemplo :
["Rat"] = {1,5}, << COM VIRGULA PORQUE VEM ANTES DO ULTIMO MONSTRO.
["Dragon"] = {6,60} << Sem birgula PORQUE É O ULTIMO MONSTRO
Só isso pessoal Thx a todos e da um rep ai e.e n caio o dedo
Caso houver algum erro favor postar aqui, para que possa ser resolvido.