Postado Fevereiro 20, 2017 8 anos Autor 8 horas atrás, KotZletY disse: Script: Ocultar conteúdo function onUse(cid, item, fromPosition, itemEx, toPosition) local l = { storage = 45455, -- storage desejada storage2 = 1234, -- storage da quest, para não fazer novamente gmax = 50, -- quantidade máxima de golds que vai poder ganhar gold = 2160, -- Item Id do Gold random = math.random(1, gmax) } if getPlayerStorageValue(cid, l.storage2) == -1 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Parabéns você acabou de completar a Reflect Quest e recebeu ' .. l.random .. ' golds.') doPlayerAddItem(cid, l.gold, l.random) setPlayerStorageValue(cid, l.storage, 1) setPlayerStorageValue(cid, l.storage2, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Você já terminou a quest!') end return true end tag xml: <action actionid="4000" event="script" value="NomeDoArquivo.lua"/> @Tópico movido para área correta, preste mais atenção da próxima vez!! [Error - Action Interface] data/actions/scripts/Quests novas/reflectquest.lua:onUse Description: data/actions/scripts/Quests novas/reflectquest.lua:8: bad argument #2 to 'random' (number expected, got nil) stack traceback: [C]: in function 'random' data/actions/scripts/Quests novas/reflectquest.lua:8: in function <data/actions/scripts/Quests novas/reflectquest.lua:1>
Postado Fevereiro 20, 2017 8 anos @diarmaint Tenta assim, esquece aquele código que passei, e substitui aquele que você mostrou por esse aqui: function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 8945 then local queststatus = getPlayerStorageValue(cid, 31320) local max_gold = 50 if queststatus == -1 then local qtd_gold = math.random(1,max_gold) doPlayerSendTextMessage(cid,22,"Parabéns você acabou de completar a reflect quest e recebeu ".. qtd_gold .." golds em uma quantidade aleatória de 0 a ".. max_gold ..". ") setPlayerStorageValue(cid, 45455, 1) doPlayerAddItem(cid, 2148, qtd_gold) setPlayerStorageValue(cid, queststatus, 1) else doPlayerSendTextMessage(cid,22,"Está vazio.") end elseif item.uid > 1000 and item.uid < 13000 then local itemWeight = getItemWeightById(item.uid, 1) local playerCap = getPlayerFreeCap(cid) if getPlayerStorageValue(cid, item.uid) == -1 then if playerCap >= itemWeight then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. '.') doPlayerAddItem(cid, item.uid ,1) setPlayerStorageValue(cid, item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.') end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") end else return false end return true end
Postado Fevereiro 20, 2017 8 anos Autor 8 minutos atrás, Zanrix disse: @diarmaint Tenta assim, esquece aquele código que passei, e substitui aquele que você mostrou por esse aqui: function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 8945 then local queststatus = getPlayerStorageValue(cid, 31320) local max_gold = 50 if queststatus == -1 then local qtd_gold = math.random(1,max_gold) doPlayerSendTextMessage(cid,22,"Parabéns você acabou de completar a reflect quest e recebeu ".. qtd_gold .." golds em uma quantidade aleatória de 0 a ".. max_gold ..". ") setPlayerStorageValue(cid, 45455, 1) doPlayerAddItem(cid, 2148, qtd_gold) setPlayerStorageValue(cid, queststatus, 1) else doPlayerSendTextMessage(cid,22,"Está vazio.") end elseif item.uid > 1000 and item.uid < 13000 then local itemWeight = getItemWeightById(item.uid, 1) local playerCap = getPlayerFreeCap(cid) if getPlayerStorageValue(cid, item.uid) == -1 then if playerCap >= itemWeight then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. '.') doPlayerAddItem(cid, item.uid ,1) setPlayerStorageValue(cid, item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.') end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") end else return false end return true end
Postado Fevereiro 20, 2017 8 anos @diarmaint Tira essa tag no actions.xml que tem no final da imagem, deixa sem, e muda o script de novo: function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 8945 then local max_gold = 50 if getPlayerStorageValue(cid, item.uid) == -1 then local qtd_gold = math.random(1,max_gold) doPlayerSendTextMessage(cid,22,"Parabéns você acabou de completar a reflect quest e recebeu ".. qtd_gold .." golds em uma quantidade aleatória de 0 a ".. max_gold ..". ") setPlayerStorageValue(cid, 45455, 1) doPlayerAddItem(cid, 2148, qtd_gold) setPlayerStorageValue(cid, item.uid, 1) else doPlayerSendTextMessage(cid,22,"Está vazio.") end elseif item.uid > 1000 and item.uid < 13000 then local itemWeight = getItemWeightById(item.uid, 1) local playerCap = getPlayerFreeCap(cid) if getPlayerStorageValue(cid, item.uid) == -1 then if playerCap >= itemWeight then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. '.') doPlayerAddItem(cid, item.uid ,1) setPlayerStorageValue(cid, item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.') end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") end else return false end return true end
Postado Fevereiro 20, 2017 8 anos Autor 1 minuto atrás, Zanrix disse: @diarmaint Tira essa tag no actions.xml que tem no final da imagem, deixa sem, e muda o script de novo: function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 8945 then local max_gold = 50 if getPlayerStorageValue(cid, item.uid) == -1 then local qtd_gold = math.random(1,max_gold) doPlayerSendTextMessage(cid,22,"Parabéns você acabou de completar a reflect quest e recebeu ".. qtd_gold .." golds em uma quantidade aleatória de 0 a ".. max_gold ..". ") setPlayerStorageValue(cid, 45455, 1) doPlayerAddItem(cid, 2148, qtd_gold) setPlayerStorageValue(cid, item.uid, 1) else doPlayerSendTextMessage(cid,22,"Está vazio.") end elseif item.uid > 1000 and item.uid < 13000 then local itemWeight = getItemWeightById(item.uid, 1) local playerCap = getPlayerFreeCap(cid) if getPlayerStorageValue(cid, item.uid) == -1 then if playerCap >= itemWeight then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. '.') doPlayerAddItem(cid, item.uid ,1) setPlayerStorageValue(cid, item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemNameById(item.uid) .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.') end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") end else return false end return true end Agora não fala nada, apenas ganho o item 8945, e não estou ganhando a storage.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.