Ir para conteúdo
  • 0

Alguem ocnsegue resolver esse bug?


pvjf

Pergunta

Encontrei esse scrip no forum e parecia esta tudo legau mas tem um errinho nele, tipo era apenas par apoder usar a pick nos tiles com id 103, 351, 352, 353, 354 e 355,mas na pratica pode se usar a pick em qualker lugar pra ativar esse script. alguem pod me ajudar com esse bug?

 

 

 

--Action by FamiliLM--

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

if item2.itemid == 103 or 351 or 352 or 353 or 354 or 355 then

chaopos = {x=topos.x, y=topos.y, z=topos.z}
msg = "Parabéns, você conseguiu minerar!"
msg2 = "Você se Machucou!"

rand = math.random(1,29)

if rand == 1 then
doPlayerAddItem(cid,2157,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 2 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 3 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 4 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 5 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 6 then
doPlayerAddItem(cid,5880,2)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 7 then
doSendMagicEffect(topos,2)

elseif rand == 8 then
doSendMagicEffect(topos,2)


elseif rand == 9 then
doSendMagicEffect(topos,2)


elseif rand == 10 then
doSendMagicEffect(topos,2)


elseif rand == 11 then
doSendMagicEffect(topos,2)


elseif rand == 12 then
doSendMagicEffect(topos,2)


elseif rand == 13 then
doSendMagicEffect(topos,2)


elseif rand == 14 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)


elseif rand == 15 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)

elseif rand == 16 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)

elseif rand == 17 then
doSendMagicEffect(topos,2)

elseif rand == 18 then
doSendMagicEffect(topos,2)

elseif rand == 19 then
doSendMagicEffect(topos,2)

elseif rand == 20 then
doSendMagicEffect(topos,2)

elseif rand == 21 then
doSendMagicEffect(topos,2)

elseif rand == 22 then
doSendMagicEffect(topos,2)

elseif rand == 23 then
doSendMagicEffect(topos,2)

elseif rand == 24 then
doSendMagicEffect(topos,2)

elseif rand == 25 then
doSendMagicEffect(topos,2)

elseif rand == 26 then
doSendMagicEffect(topos,2)

elseif rand == 27 then
doSendMagicEffect(topos,2)

elseif rand == 28 then
doSendMagicEffect(topos,2)

elseif rand == 29 then
doSendMagicEffect(topos,2)

end
end
return 1
end

Link para o comentário
https://xtibia.com/forum/topic/213767-alguem-ocnsegue-resolver-esse-bug/
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

O de server antigo da esse erro:

 

[Error - Action Interface]
data/actions/scripts/mineracao.lua:onUse
Description:
data/actions/scripts/mineracao.lua:21: attempt to index field 'item' (a nil valu
e)
stack traceback:
    data/actions/scripts/mineracao.lua:21: in function <data/actions/scripts
/mineracao.lua:19>

 

 

E com o novo da esse erro:

 

[Error - Action Interface]
data/actions/scripts/mineracao.lua:onUse
Description:
data/actions/scripts/mineracao.lua:5: attempt to index field 'item' (a nil value
)
stack traceback:
    data/actions/scripts/mineracao.lua:5: in function <data/actions/scripts/
mineracao.lua:3>

Link para o comentário
https://xtibia.com/forum/topic/213767-alguem-ocnsegue-resolver-esse-bug/#findComment-1516587
Compartilhar em outros sites

testa ae:

 

 

 

--Action by FamiliLM--

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

if isInArray({103,351,352,353,354,355}, item2.item.id) then

chaopos = {x=topos.x, y=topos.y, z=topos.z}
msg = "Parabéns, você conseguiu minerar!"
msg2 = "Você se Machucou!"

rand = math.random(1,29)

if rand == 1 then
doPlayerAddItem(cid,2157,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 2 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 3 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 4 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 5 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 6 then
doPlayerAddItem(cid,5880,2)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 7 then
doSendMagicEffect(topos,2)

elseif rand == 8 then
doSendMagicEffect(topos,2)


elseif rand == 9 then
doSendMagicEffect(topos,2)


elseif rand == 10 then
doSendMagicEffect(topos,2)


elseif rand == 11 then
doSendMagicEffect(topos,2)


elseif rand == 12 then
doSendMagicEffect(topos,2)


elseif rand == 13 then
doSendMagicEffect(topos,2)


elseif rand == 14 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)


elseif rand == 15 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)

elseif rand == 16 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)

elseif rand == 17 then
doSendMagicEffect(topos,2)

elseif rand == 18 then
doSendMagicEffect(topos,2)

elseif rand == 19 then
doSendMagicEffect(topos,2)

elseif rand == 20 then
doSendMagicEffect(topos,2)

elseif rand == 21 then
doSendMagicEffect(topos,2)

elseif rand == 22 then
doSendMagicEffect(topos,2)

elseif rand == 23 then
doSendMagicEffect(topos,2)

elseif rand == 24 then
doSendMagicEffect(topos,2)

elseif rand == 25 then
doSendMagicEffect(topos,2)

elseif rand == 26 then
doSendMagicEffect(topos,2)

elseif rand == 27 then
doSendMagicEffect(topos,2)

elseif rand == 28 then
doSendMagicEffect(topos,2)

elseif rand == 29 then
doSendMagicEffect(topos,2)

end
end
return 1
end

 

 

 

se o sv for antigo:

 

 

--Action by FamiliLM--
function isInArray(array, value, caseSensitive)
if(caseSensitive == nil or caseSensitive == FALSE) and type(value) == "string" then
local lowerValue = value:lower()
for _, _value in ipairs(array) do
if type(_value) == "string" and lowerValue == _value:lower() then
return 1
end
end
else
for _, _value in ipairs(array) do
if (value == _value) then return 1 end
end
end

return 0
end

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

if isInArray({103,351,352,353,354,355}, item2.item.id) then

chaopos = {x=topos.x, y=topos.y, z=topos.z}
msg = "Parabéns, você conseguiu minerar!"
msg2 = "Você se Machucou!"

rand = math.random(1,29)

if rand == 1 then
doPlayerAddItem(cid,2157,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 2 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 3 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 4 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 5 then
doPlayerAddItem(cid,5880,1)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 6 then
doPlayerAddItem(cid,5880,2)
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid, 22, msg)

elseif rand == 7 then
doSendMagicEffect(topos,2)

elseif rand == 8 then
doSendMagicEffect(topos,2)


elseif rand == 9 then
doSendMagicEffect(topos,2)


elseif rand == 10 then
doSendMagicEffect(topos,2)


elseif rand == 11 then
doSendMagicEffect(topos,2)


elseif rand == 12 then
doSendMagicEffect(topos,2)


elseif rand == 13 then
doSendMagicEffect(topos,2)


elseif rand == 14 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)


elseif rand == 15 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)

elseif rand == 16 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, msg2)

elseif rand == 17 then
doSendMagicEffect(topos,2)

elseif rand == 18 then
doSendMagicEffect(topos,2)

elseif rand == 19 then
doSendMagicEffect(topos,2)

elseif rand == 20 then
doSendMagicEffect(topos,2)

elseif rand == 21 then
doSendMagicEffect(topos,2)

elseif rand == 22 then
doSendMagicEffect(topos,2)

elseif rand == 23 then
doSendMagicEffect(topos,2)

elseif rand == 24 then
doSendMagicEffect(topos,2)

elseif rand == 25 then
doSendMagicEffect(topos,2)

elseif rand == 26 then
doSendMagicEffect(topos,2)

elseif rand == 27 then
doSendMagicEffect(topos,2)

elseif rand == 28 then
doSendMagicEffect(topos,2)

elseif rand == 29 then
doSendMagicEffect(topos,2)

end
end
return 1
end

 

 

Link para o comentário
https://xtibia.com/forum/topic/213767-alguem-ocnsegue-resolver-esse-bug/#findComment-1516384
Compartilhar em outros sites

Tenta:

 

 

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

local cfg = {
items_can = {103, 351, 352, 353, 354, 355},
rand= math.random(1,29),
}


if not isInArray(cfg.items_can, item2.itemid) then
doPlayerSendTextMessage(cid, 27, "Não é possível mineirar aqui.")
return true end

if cfg.rand >= 1  and cfg.rand <= 6 then
doPlayerAddItem(cid, 2157, 1)
doSendMagicEffect(topos, 12)
doPlayerSendTextMessage(cid, 22, "Parabéns, você conseguiu minerar!") return true end

if cfg.rand >= 7 and cfg.rand <= 13 or cfg.rand >= 17 and cfg.rand <= 29 then
doSendMagicEffect(topos, 2) return true end

if cfg.rand >= 14 and cfg.rand <= 16 then
doSendMagicEffect(topos,2)
doCreatureAddHealth(cid, -50)
doPlayerSendTextMessage(cid, 22, "Você se machucou!")
end
return true
end

 

Link para o comentário
https://xtibia.com/forum/topic/213767-alguem-ocnsegue-resolver-esse-bug/#findComment-1516664
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

×
×
  • Criar Novo...