CH

Problema Com Um Script.

Por Chopperr, 14 de out. de 2010 em Archived

script
3
1.1k
ChopperrC
14 de outubro de 2010 às 14:30

Olá galera, achei um script de renovar a soft e a firewalker por 10k apenas clicando nela, porém quando clico aparece o seguinte erro no console:

 

[14/10/2010 14:22:51] [Error - Action Interface]

[14/10/2010 14:22:51] data/actions/scripts/other/firewalker.lua:onUse

[14/10/2010 14:22:51] Description:

[14/10/2010 14:22:51] (luaDoRemoveItem) Item not found

 

e:

 

[14/10/2010 14:22:04] [Error - Action Interface]

[14/10/2010 14:22:04] data/actions/scripts/other/softboots.lua:onUse

[14/10/2010 14:22:04] Description:

[14/10/2010 14:22:04] (luaDoRemoveItem) Item not found

 

As duas são recarregadas normalmente, mas não cobra nada por isso! Ou seja, a pessoa clica na boots e o dinheiro requisitado não some!

 

Vou postar aqui os dois scripts para quem entende me ajudar:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
local moneyneed = 10000 -- price to get new firewalker boots
local playermoney = getPlayerMoney(cid)
if playermoney >= moneyneed then
if doPlayerTakeItem(cid, 10022, 1) then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid, 9933, 1)
doPlayerRemoveMoney(cid, moneyneed)
doSendMagicEffect(fromPosition,12)
else
doPlayerSendTextMessage(cid,20, "You don't have worn firewalker boots.")
end
else
doPlayerSendTextMessage(cid,20, "Sorry, but you need ".. moneyneed .." gold coins to get a new firewalker boots.")
end
end

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
local moneyneed = 10000 -- price to get new soft boots
local playermoney = getPlayerMoney(cid)
if playermoney >= moneyneed then
if doPlayerTakeItem(cid, 10021, 1) then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid, 6132, 1)
doPlayerRemoveMoney(cid, moneyneed)
doSendMagicEffect(fromPosition,12)
else
doPlayerSendTextMessage(cid,20, "You don't have worn soft boots.")
end
else
doPlayerSendTextMessage(cid,20, "Sorry, but you need ".. moneyneed .." gold coins to get a new soft boots.")
end
end

 

Valeu!

Garou12G
14 de outubro de 2010 às 16:05

Olá, Chopperr.

 

Tente usar o código abaixo:

 

local c = {
  needMoney = 10000
}

local boots = {
  [10021] = 6321,
  [10022] = 9933
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  if(boots[item.itemid]) then
     if(doPlayerRemoveMoney(cid, c.needMoney)) then
        doTransformItem(item.uid, boots[item.itemid])
        doSendMagicEffect(fromPosition, 12)
     else
        doPlayerSendCancel(cid, "You need ".. c.needMoney .." to repair ".. getItemInfo(item.itemid).name .."")
     end
  end
  return true
end

 

Tomei a liberdade de resumir os dois códigos passados no tópico em um só, logo você deve registrar o arquivo no actions.xml da seguinte forma:

 

<action itemid="10021;10022" event="script" value="NOME_DO_ARQUIVO.lua"/>

Editado Outubro 14 por Garou

ChopperrC
14 de outubro de 2010 às 21:25

nossa cara ainda melhorou o script!

brigadããão mesmo! rep+

 

ah, só uma coisinha no seu script:

local c = {
  needMoney = 10000
}

local boots = {
  [10021] = 6321,
  [10022] = 9933
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  if(boots[item.itemid]) then
     if(doPlayerRemoveMoney(cid, c.needMoney)) then
        doTransformItem(item.uid, boots[item.itemid])
        doSendMagicEffect(fromPosition, 12)
     else
        doPlayerSendCancel(cid, "You need ".. c.needMoney .." to repair ".. getItemInfo(item.itemid).name .."")
     end
  end
  return true
end

 

ali aonde tá [10021] = 6321, o id está errado! o certo é 6132!

eu fui testar na primeira vez e trocou a worn soft boots por um destroyer morto o.O

 

Quem for pegar também pegue esse que eu concertei:

 

local c = {
  needMoney = 10000
}

local boots = {
  [10021] = 6132,
  [10022] = 9933
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  if(boots[item.itemid]) then
     if(doPlayerRemoveMoney(cid, c.needMoney)) then
        doTransformItem(item.uid, boots[item.itemid])
        doSendMagicEffect(fromPosition, 12)
     else
        doPlayerSendCancel(cid, "You need ".. c.needMoney .." to repair ".. getItemInfo(item.itemid).name .."")
     end
  end
  return true
end