Ir para conteúdo
  • 0

O Que Tem De Errado No Meu Script? Da Uma Olhada!


Kombosabo

Pergunta

Tentei fazer o script sozinho, mas foi um completo disastre...

 

local BREAK_CHANCE_RARE = 20
local RARE_RUSTY_ARMOR = 9810
local MAGIC_PLATE_ARMOR = 2472
local MAGIC_PLATE_ARMOR_CHANCE = 1
local DRAGON_SCALE_MAIL = 2492
local DRAGON_SCALE_MAIL_CHANCE = 2
local GOLDEN_ARMOR = 2466
local GOLDEN_ARMOR_CHANCE = 3
local CROWN_ARMOR = 2487
local CROWN_ARMOR_CHANCE = 4
local PALADIN_ARMOR = 2487
local PALADIN_ARMOR_CHANCE = 5
local KNIGHT_ARMOR = 2476
local KNIGHT_ARMOR_CHANCE = 20
local PLATE_ARMOR = 2463
local PLATE_ARMOR_CHANCE = 25

function onUse(cid, item, fromPosition, itemEx, toPosition)
end
if RARE_RUSTY_ARMOR[itemEx.itemid] ~= nil then

end
else
if math.random(100) <= BREAK_CHANCE_RARE then
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"The armor was already damaged so badly that it broke when you tried to clean it.")
end
else
if math.random(100) <= MAGIC_PLATE_ARMOR_CHANCE then
	doTransformItem(itemEx.uid,MAGIC_PLATE_ARMOR)
	end
else
if math.random(100) <= DRAGON_SCALE_ARMOR_CHANCE then
	doTransformItem(itemEx.uid,DRAGON_SCALE_ARMOR)
	end
else
if math.random(100) <= GOLDEN_ARMOR_CHANCE then
	doTransformItem(itemEx.uid,GOLDEN_ARMOR)
	end
else
if math.random(100) <= KNIGHT_ARMOR_CHANCE then
	doTransformItem(itemEx.uid,KNIGHT_ARMOR)
	end
else
if math.random(100) <= PLATE_ARMOR_CHANCE then
	doTransformItem(itemEx.uid,PLATE_ARMOR)
	end
end
doRemoveItem(item.uid, 1)
return TRUE
end
return FALSE
end

Editado por Kombosabo OT Server
Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

ve se é isso:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

-- chance em porcentagem

items = {
{id= 2472,chance=1},
{id= 2492,chance=2},
{id= 2466,chance=3},
{id= 2487,chance=4},
{id= 8891,chance=5},
{id= 2476,chance=20},
{id= 2463,chance=25}
}
local RARE_RUSTY_ARMOR = 9810

if itemEx.itemid == RARE_RUSTY_ARMOR then
local m = math.random(1,#items)
if math.random(1,100) <= items[m].chance then
doTransformItem(itemEx.uid,items[m].id)
else
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"The armor was already damaged so badly that it broke when you tried to clean it.")
end
end
return TRUE
end

Link para o comentário
Compartilhar em outros sites

  • 0

ve se é isso:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

-- chance em porcentagem

items = {
{id= 2472,chance=1},
{id= 2492,chance=2},
{id= 2466,chance=3},
{id= 2487,chance=4},
{id= 8891,chance=5},
{id= 2476,chance=20},
{id= 2463,chance=25}
}
local RARE_RUSTY_ARMOR = 9810

if itemEx.itemid == RARE_RUSTY_ARMOR then
local m = math.random(1,#items)
if math.random(1,100) <= items[m].chance then
doTransformItem(itemEx.uid,items[m].id)
else
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"The armor was already damaged so badly that it broke when you tried to clean it.")
end
end
return TRUE
end

 

Funfou aqui, valeu :)

Desculpe o atraso de quase 3 meses pra responder HASUHSAUSA

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...