Ir para conteúdo
  • 0

[Resolvido] Usar item somente em PZ


Amantezinho

Pergunta

Gente, tô tentando aprender o máximo que consigo dessas coisas de Lua, script e tal, mas não consigo HSUAUHSUAHUS, testei mil vezes e n foi.
Preciso que esse script só seja usado e pz.
Segue abaixo:

 

 

 

 

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

setPlayerStorageValue(cid, 8422, 0)
setPlayerStorageValue(cid, 23254, 50)
--doPlayerRemoveItem(cid, 7855, 1)
if isCreature(item2.uid) then
return doPlayerSendCancel(cid, "You can only use revive in pokeballs!")
end
if isPlayer(item2.uid) then
return doPlayerSendCancel(cid, "You cant use potions on wild pokemons.")
end
local x = pokeballs[getPokeballType(item2.itemid)]
if not x or isInArray(x.use, item2.itemid) then return doPlayerSendCancel(cid, "Sorry, is not possible.") end
if x.on or x.off then
doSendMagicEffect(getThingPos(cid), 14)
doRemoveItem(item.uid, 1)
maxh = tonumber(getItemAttribute(item2.uid, "poke"):match("/(.+)]"))
doItemSetAttribute(item2.uid, "poke", getItemAttribute(item2.uid, "poke"):sub(1, findLetter(getItemAttribute(item2.uid, "poke"), "[")) .. maxh .. getItemAttribute(item2.uid, "poke"):sub(findLetter(getItemAttribute(item2.uid, "poke"), "/")))
btype = getPokeballType(item2.itemid)
ons = pokeballs[btype].on
doTransformItem(item2.uid, ons)
doCureAllStatus(item2.uid)
else
doPlayerSendCancel(cid, "Sorry, is not possible.")
return true
end
end

 

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0


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

 

if not getTileInfo(getThingPos(cid)).protection then

return doPlayerSendCancel(cid, "You can only use this item in protection zone.")

end

 

setPlayerStorageValue(cid, 8422, 0)

setPlayerStorageValue(cid, 23254, 50)

--doPlayerRemoveItem(cid, 7855, 1)

if isCreature(item2.uid) then

return doPlayerSendCancel(cid, "You can only use revive in pokeballs!")

end

 

if isPlayer(item2.uid) then

return doPlayerSendCancel(cid, "You cant use potions on wild pokemons.")

end

 

local x = pokeballs[getPokeballType(item2.itemid)]

if not x or isInArray(x.use, item2.itemid) then return doPlayerSendCancel(cid, "Sorry, is not possible.") end

if x.on or x.off then

doSendMagicEffect(getThingPos(cid), 14)

doRemoveItem(item.uid, 1)

maxh = tonumber(getItemAttribute(item2.uid, "poke"):match("/(.+)]"))

doItemSetAttribute(item2.uid, "poke", getItemAttribute(item2.uid, "poke"):sub(1, findLetter(getItemAttribute(item2.uid, "poke"), "[")) .. maxh .. getItemAttribute(item2.uid, "poke"):sub(findLetter(getItemAttribute(item2.uid, "poke"), "/")))

btype = getPokeballType(item2.itemid)

ons = pokeballs[btype].on

doTransformItem(item2.uid, ons)

doCureAllStatus(item2.uid)

else

doPlayerSendCancel(cid, "Sorry, is not possible.")

return true

end

 

end

 

Link para o comentário
Compartilhar em outros sites

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

  if not getTileInfo(getThingPos(cid)).protection then
    return doPlayerSendCancel(cid, "You can only use this item in protection zone.")
  end
  
  setPlayerStorageValue(cid, 8422, 0) 
  setPlayerStorageValue(cid, 23254, 50)
  --doPlayerRemoveItem(cid, 7855, 1)
  if isCreature(item2.uid) then
    return doPlayerSendCancel(cid, "You can only use revive in pokeballs!")
  end
 
  if isPlayer(item2.uid) then
    return doPlayerSendCancel(cid, "You cant use potions on wild pokemons.")
  end
  
  local x = pokeballs[getPokeballType(item2.itemid)]
  if not x or isInArray(x.use, item2.itemid) then return doPlayerSendCancel(cid, "Sorry, is not possible.") end
    if x.on or x.off then
      doSendMagicEffect(getThingPos(cid), 14)
      doRemoveItem(item.uid, 1)
      maxh = tonumber(getItemAttribute(item2.uid, "poke"):match("/(.+)]"))
      doItemSetAttribute(item2.uid, "poke", getItemAttribute(item2.uid, "poke"):sub(1, findLetter(getItemAttribute(item2.uid, "poke"), "[")) .. maxh .. getItemAttribute(item2.uid, "poke"):sub(findLetter(getItemAttribute(item2.uid, "poke"), "/")))
      btype = getPokeballType(item2.itemid)
      ons = pokeballs[btype].on
      doTransformItem(item2.uid, ons)
      doCureAllStatus(item2.uid)
    else
      doPlayerSendCancel(cid, "Sorry, is not possible.")
    return true
  end 

end

TESTADO e APROVADO

 

Valeu MaX, adiconarei agradecimentos à você quando estiver com o projeto encaminhado. ;)

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

  • 0
  • Administrador
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...