- 0
pedido Ajuda a arrumar esses scripts.
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 2158 visualizações
-
- 0 respostas
- 1400 visualizações
-
[TFS 0.4/8.60] NPC que aumenta a velocidade de upar todas as skill no trainer em 40% durante 7 dias!
Por BrunoBrilha,
- 1 resposta
- 2045 visualizações
-
- 1 resposta
- 1685 visualizações
-
- 0 respostas
- 1395 visualizações
-

Pergunta
gabriel28 60
Estou com esses dois scripts que não estou conseguindo ajeitar. Segue eles:
O problema desse é que não remove de jeito nenhum o item quando ele é usado:
function onUse(cid, item, fromPosition, itemEx, toPosition) local rewarditems = { {id = 2492, chance = 5, count = 1}, -- start with the lowest chances {id = 2498, chance = 10, count = 1}, {id = 2488, chance = 15, count = 1}, {id = 2152, chance = 70, count = math.random(1, 10)} } local chance = math.random(1,100) for i = 1, #rewarditems, 1 do if(chance < rewarditems[i].chance) then local info = getItemInfo(rewarditems[i].id) if(rewarditems[i].count > 1) then text = rewarditems[i].count .. " " .. info.plural else text = info.article .. " " .. info.name end local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count) if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) text = "You have failed to open your mystery box. The item is to heavy or you have not enough space to take it." else text = "You have received " .. text .. "." doRemoveItem(item.uid, 1) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text) return true else chance = chance - rewarditems[i].chance end end endEsse eu não estou conseguindo por uma chance individual para cada item e nem estou conseguindo por um math.randon pra vir uma quantidade aleatória dos itens.
local stonesMinerar = { [5709] = {minerioid = 5944, count = math.random(1, 10)}, -- [id da pedra] = {minerioid = id do item que ganha, count = countidade que ganha} [5624] = {minerioid = 6277, count = math.random(1, 5)}, [8748] = {minerioid = 5880, count = math.random(1, 5)}, [5619] = {minerioid = 12700, count = math.random(1, 3)} } local config = { exhaustionMinutes = 60, -- exausted em minutos effectChar = 30, -- efeito no char. storageUse = 34542 -- storage usado/ não mude caso não entenda. } local chance = 50 function onUse(cid, item, fromPosition, itemEx, toPosition) local a = math.random if(exhaustion.check(cid, config.storageUse) == TRUE) then if (exhaustion.get(cid, config.storageUse) >= 60) then doPlayerSendCancel(cid, "Voçê só pode usar após [" .. math.floor(exhaustion.get(cid, config.storageUse) / 60 + 1) .."] minutos.") end if (exhaustion.get(cid, config.storageUse) <= 60) then doPlayerSendCancel(cid, "Voçê só pode usar após [" .. exhaustion.get(cid, config.storageUse).."] segundos.") end return true end if stonesMinerar[itemEx.itemid] then local a = math.random(1, 100) if a < chance then doPlayerAddItem(cid, stonesMinerar[itemEx.itemid].minerioid, stonesMinerar[itemEx.itemid].count) doPlayerSendTextMessage(cid, 19, "Você recebeu "..(stonesMinerar[itemEx.itemid].count).." "..getItemNameById(stonesMinerar[itemEx.itemid].minerioid).."!") doSendMagicEffect(getPlayerPosition(cid), config.effectChar) exhaustion.set(cid, config.storageUse, config.exhaustionMinutes*60) else doPlayerSendCancel(cid, "Você falhou.") end else doPlayerSendCancel(cid, "Você não pode minerar isso.") end return true endSe alguém puder ajudar, agradeço desde já.
Link para o comentário
https://xtibia.com/forum/topic/239999-ajuda-a-arrumar-esses-scripts/Compartilhar em outros sites
11 respostass a esta questão
Posts Recomendados