Jump to content
×
×
  • Create New...
  • 0

PET SYSTEM!!! AJUDA!!


Go to solution Solved by lazarocp,

Question

Olá pessoal, gostaria que alguem me ajudasse no script desse actions.

 

É um pet system bem simples, você clika em um item e o monstro sai... oq eu gostaria é que ao clicar no item novamente o monstro voltasse..

 

Se alguem puder ajudar agradeço, segue script:

 

local vocs_id = {3,7}

function onUse(cid, item, frompos, item2, topos)
      if not isInArray(vocs_id,getPlayerVocation(cid)) then       
         doPlayerSendCancel(cid,"Sua vocacao nao pode summonar esse pet.")   
         soSendMagicEffect(getThingPos(cid),2)      
         return false       
      end    

       if getTilePzInfo(getCreaturePosition(cid)) then       
         doPlayerSendCancel(cid,"Esse monstro nao pode ser sumonado em protect zone!.")       
         return TRUE       
      end    
 
if (getPlayerStorageValue(cid, 11548) >= os.time()) then
doPlayerSendTextMessage(cid, 6,"Voce so pode sumonar seu pet novamente em " .. 
(getPlayerStorageValue(cid, 11548)-os.time()+(0)) .. " segundos.")
return true
end 
storage = 11548
if #getCreatureSummons(cid) >= 1 then
  return doPlayerSendCancel(cid,"Voce ja chamou seu pet!")
        end
 
if getPlayerStorageValue(cid,storsol) == 1 then
local z = getCreatureSummons(cid)[1]
doSendMagicEffect(getCreaturePosition(z), 2)
doSendDistanceShoot(getCreaturePosition(z), getPlayerPosition(cid), 3)
return true
end
 
 
local summons = getCreatureSummons(cid)
local pet = {
["Wolf lvl 1"] = {1,150},
["Wolf lvl 2"] = {151,250},
["Wolf lvl 3"] = {251,350},
["Wolf lvl 4"] = {351,450},
["Wolf lvl 5"] = {451,550},
["Wolf lvl 6"] = {551,650},
["Wolf lvl 7"] = {651,10000}
}


for k,v in pairs(pet) do -- 1
 
 
if getPlayerStorageValue(cid,storsol) < 1 then
if getPlayerLevel(cid) >= v[1] and getPlayerLevel(cid) < v[2] then -- 2
if (table.maxn(summons) < 1)then -- 3
x = doSummonCreature(k, getCreaturePosition(cid))
doConvinceCreature(cid, x)
setPlayerStorageValue(cid,11548,os.time()+30)
doCreatureSay(cid, k ..", go!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 2)
end
end
end
 
 
end
return true
end

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  • Solution
local vocs_id = {3,7}

function onUse(cid, item, frompos, item2, topos)
      if not isInArray(vocs_id,getPlayerVocation(cid)) then       
         doPlayerSendCancel(cid,"Sua vocacao nao pode summonar esse pet.")   
         doSendMagicEffect(getThingPos(cid),2)      
         return false       
      end    

       if getTilePzInfo(getCreaturePosition(cid)) then       
         doPlayerSendCancel(cid,"Esse monstro nao pode ser sumonado em protect zone!.")       
         return TRUE       
      end 

if #getCreatureSummons(cid) >= 1 then
  local pet = getCreatureSummons(cid)[1]
  doRemoveCreature(pet)
  return doPlayerSendCancel(cid,"Voce removeu seu pet!")
end	  
 
if (getPlayerStorageValue(cid, 11548) >= os.time()) then
doPlayerSendTextMessage(cid, 6,"Voce so pode sumonar seu pet novamente em " .. 
(getPlayerStorageValue(cid, 11548)-os.time()+(0)) .. " segundos.")
return true
end 
storage = 11548
 
if getPlayerStorageValue(cid,storsol) == 1 then
local z = getCreatureSummons(cid)[1]
doSendMagicEffect(getCreaturePosition(z), 2)
doSendDistanceShoot(getCreaturePosition(z), getPlayerPosition(cid), 3)
return true
end
 
 
local summons = getCreatureSummons(cid)
local pet = {
["Wolf lvl 1"] = {1,150},
["Wolf lvl 2"] = {151,250},
["Wolf lvl 3"] = {251,350},
["Wolf lvl 4"] = {351,450},
["Wolf lvl 5"] = {451,550},
["Wolf lvl 6"] = {551,650},
["Wolf lvl 7"] = {651,10000}
}


for k,v in pairs(pet) do -- 1
 
 
if getPlayerStorageValue(cid,storsol) < 1 then
if getPlayerLevel(cid) >= v[1] and getPlayerLevel(cid) < v[2] then -- 2
if (table.maxn(summons) < 1)then -- 3
x = doSummonCreature(k, getCreaturePosition(cid))
doConvinceCreature(cid, x)
setPlayerStorageValue(cid,11548,os.time()+30)
doCreatureSay(cid, k ..", go!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 2)
end
end
end
 
 
end
return true
end

Tenta assim.

Edited by lazarocp
Link to post
Share on other sites
  • 0
1 hora atrás, Poke X Ice disse:

Achei esse erro dentro do script:

  Mostrar conteúdo oculto

soSendMagicEffect(getThingPos(cid),2)    

 

correto:

  Mostrar conteúdo oculto

doSendMagicEffect(getThingPos(cid),2)    

 

Corrigi aqui, muito obrigado amigo !

Link to post
Share on other sites
  • 0
18 horas atrás, lazarocp disse:

local vocs_id = {3,7}

function onUse(cid, item, frompos, item2, topos)
      if not isInArray(vocs_id,getPlayerVocation(cid)) then       
         doPlayerSendCancel(cid,"Sua vocacao nao pode summonar esse pet.")   
         doSendMagicEffect(getThingPos(cid),2)      
         return false       
      end    

       if getTilePzInfo(getCreaturePosition(cid)) then       
         doPlayerSendCancel(cid,"Esse monstro nao pode ser sumonado em protect zone!.")       
         return TRUE       
      end 

if #getCreatureSummons(cid) >= 1 then
  local pet = getCreatureSummons(cid)[1]
  doRemoveCreature(pet)
  return doPlayerSendCancel(cid,"Voce removeu seu pet!")
end	  
 
if (getPlayerStorageValue(cid, 11548) >= os.time()) then
doPlayerSendTextMessage(cid, 6,"Voce so pode sumonar seu pet novamente em " .. 
(getPlayerStorageValue(cid, 11548)-os.time()+(0)) .. " segundos.")
return true
end 
storage = 11548
 
if getPlayerStorageValue(cid,storsol) == 1 then
local z = getCreatureSummons(cid)[1]
doSendMagicEffect(getCreaturePosition(z), 2)
doSendDistanceShoot(getCreaturePosition(z), getPlayerPosition(cid), 3)
return true
end
 
 
local summons = getCreatureSummons(cid)
local pet = {
["Wolf lvl 1"] = {1,150},
["Wolf lvl 2"] = {151,250},
["Wolf lvl 3"] = {251,350},
["Wolf lvl 4"] = {351,450},
["Wolf lvl 5"] = {451,550},
["Wolf lvl 6"] = {551,650},
["Wolf lvl 7"] = {651,10000}
}


for k,v in pairs(pet) do -- 1
 
 
if getPlayerStorageValue(cid,storsol) < 1 then
if getPlayerLevel(cid) >= v[1] and getPlayerLevel(cid) < v[2] then -- 2
if (table.maxn(summons) < 1)then -- 3
x = doSummonCreature(k, getCreaturePosition(cid))
doConvinceCreature(cid, x)
setPlayerStorageValue(cid,11548,os.time()+30)
doCreatureSay(cid, k ..", go!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 2)
end
end
end
 
 
end
return true
end

Tenta assim.

Nossa irmão, funcionou certinho!!!

 

Muito obrigado !!!

 

Deixa eu perguntar só mais uma coisa, tipo quando eu uso o pet e subo uma escada ele fica la moscando e não me segue :( seria possível algum script que fizesse ele teleportar junto quando subisse escada, quando eu entrar em um teleport ou ficar muito longe dele, tipo um pokemon mesmo hahaha

 

Se não for possivel de buenas, muito obrigado tmj !

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now