Tenta assim:
-- Elemental Orb System -- -- Developed by Rigby -- -- Edited by JS Lotus -- local config = { -- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo}, [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132}, [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132}, } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerItemCount(cid, 2132) < 175 then doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!") else for i, k in pairs(config) do if (isInArray(i, item.itemid) == true) then random = math.random(k.quantity[1],k.quantity[2]) doPlayerAddItem(cid,k.fruit,random) doPlayerAddItem(cid,k.EmptyOrb,1) doPlayerRemoveItem(cid,15061,1) doPlayerRemoveItem(cid,2132,175) if random > 0 then doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".") else doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!") doPlayerRemoveItem(cid,k.fruit,1) end end end end return true end






info
Grupo: Campones
Registrado: 21/09/18
Posts: 21
Reputação: 0
Eae galera, hoje venho pedir uma ajudinha não muito complexa de vocês.
Não tenho muita noção de script, e tô sem ideias do que fazer pra conseguir isso.
É o seguinte: Esse sistema é de orb, ao clicar na orb, você pode receber 1 fire stone e 1 orb vazia, ou ela pode quebrar assim recebendo apenas 1 orb vazia.
Está funcionando normalmente como falei, só que preciso que verifique se o player tem 175 itens (2132) e caso tenha remova-os, caso não, aparece uma mensagem falando que não tem os materiais necessários. Obrigado!
-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
[15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
[8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
[8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
[8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
[8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
[8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
[8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
[8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for i, k in pairs(config) do
if (isInArray(i, item.itemid) == true) then
random = math.random(k.quantity[1],k.quantity[2])
doPlayerAddItem(cid,k.fruit,random)
doPlayerAddItem(cid,k.EmptyOrb,1)
doPlayerRemoveItem(cid,15061,1)
if random > 0 then
doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
else
doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
doPlayerRemoveItem(cid,k.fruit,1)
end
end
end
return true
end
Quem puder ajudar, agradeço.
Editado Setembro 22 por JS Lotus