Ir para conteúdo
  • 0

Changegold Nova Moeda


Adriez

Pergunta

[23:38:51.062] [Error - Action Interface] 
[23:38:51.062] data/actions/scripts/other/changegold.lua
[23:38:51.062] Description: 
[23:38:51.062] data/actions/scripts/other/changegold.lua:4: table index is nil
[23:38:51.062] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)
 

Spoiler

local coins = {
[iTEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[iTEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[iTEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, to = 6527, effect = TEXTCOLOR_LIGHTBLUE
},
[6527] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_TEAL
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end
local coin = coins[item.itemid]
if(not coin) then
return false
end
if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, coin.to, 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
end
return true
end

 

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Essa sua tabela ta meio estranha, tenta assim:

local coins = {[iTEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW},[iTEM_PLATINUM_COIN] = {from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE},[iTEM_CRYSTAL_COIN] = {from = ITEM_PLATINUM_COIN, to = 6527, effect = TEXTCOLOR_LIGHTBLUE},[6527] = {from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_TEAL}}function onUse(cid, item, fromPosition, itemEx, toPosition)if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) thenreturn falseendlocal coin = coins[item.itemid]if(not coin) thenreturn falseendif(coin.to ~= nil and item.type == ITEMCOUNT_MAX) thendoChangeTypeItem(item.uid, item.type - item.type)doPlayerAddItem(cid, coin.to, 1)doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)elseif(coin.from ~= nil) thendoChangeTypeItem(item.uid, item.type - 1)doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)endreturn trueend

E informe melhor sobre o erro, quando que ele acontece?

Link para o comentário
Compartilhar em outros sites

  • -1

assim q do reload actions ou quando inicia o servidor ....

 

7 horas atrás, luangop disse:

Essa sua tabela ta meio estranha, tenta assim:

local coins = {[iTEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW},[iTEM_PLATINUM_COIN] = {from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE},[iTEM_CRYSTAL_COIN] = {from = ITEM_PLATINUM_COIN, to = 6527, effect = TEXTCOLOR_LIGHTBLUE},[6527] = {from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_TEAL}}function onUse(cid, item, fromPosition, itemEx, toPosition)if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) thenreturn falseendlocal coin = coins[item.itemid]if(not coin) thenreturn falseendif(coin.to ~= nil and item.type == ITEMCOUNT_MAX) thendoChangeTypeItem(item.uid, item.type - item.type)doPlayerAddItem(cid, coin.to, 1)doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)elseif(coin.from ~= nil) thendoChangeTypeItem(item.uid, item.type - 1)doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)endreturn trueend

E informe melhor sobre o erro, quando que ele acontece?

 

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

×
×
  • Criar Novo...