Ir para conteúdo
  • 0

[Resolvido] Help onuse script


FelipeXT

Pergunta

Eae galera do Xtibia, vim pedir a ajuda de vocês em um script de forja que estou usando no meu otserver 7.92, o problema e o seguinte os items tem uma determindo lugar para ficarem, o blacksmith hammer ser usado no solid iron so que quando os items estão ali eu posso pegar um outro blacksmith hammer e dar use em qualquer local que funciona a forja lá.  Version OT 7.92

Já tentei de varias formas resolver e não obtive sucesso ;[

Spoiler

2w2q6pz.png

 

Script:

 

levelss = {
[-1] = 2414, ---- D.LANCE
[0] = 2391, --- W.HAMMER
[1] = 2391, --- W.HAMMER
[10] = 2393, -- GS
[12] = 3963, -- SCYTHEBLADE
[13] = 2257, -- trash
[15] = 2400, -- Small Diamond
[16] = 2257, -- trash
[17] = 2431, -- STONEAXE
[18] = 2431, -- STONEAXE
[20] = 2257, -- trash
[21] = 2257, -- trash
[22] = 2257, -- trash
[23] = 2257, -- trash
[25] = 2415, -- G.AXE
[27] = 7405, -- D.SPIRIT
[28] = 2400, -- Gold Nuggets
[35] = 13537, --- F.BUTCHER
[36] = 2421, -- T.HAMMER
[37] = 2453, --A. WAND
[38] = 7426, -- M.WAND
[39] = 13531, -- E.CROSSB
[40] = 14835, -- DEVILEYE
[40] = 2257, -- TRASH
[42] = 13534, -- S.GRINDER
[45] = 13543, -- A.Blade
[50] = 13547, -- S.O.Teseu
}

local exhausted_seconds = 1 -- Segundos para entrar novamente
local exhausted_storagevalue = 1858 -- Storage Value do Cool Down

function onUse(cid, item, frompos, item2, topos)
local config = {
storage = 50000,
chance = 20, --- chance de achar um item ou não
k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
experience = 19334
}
local drops = {}
 
function getDrops(cid)
for i= -1,getPlayerStorageValue(cid, config.storage) do
if levelss then
table.insert(drops, levelss)
end
end
return true
end
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
   doPlayerSendTextMessage(cid, 20,"Voce esta exhausto!")
    doSendMagicEffect(playerpos,2)
   return TRUE
end
 
 

piecepos1 = {x=444, y=197, z=4, stackpos=2} or {x=444, y=201, z=4, stackpos=2}
piecepos2 = {x=443, y=197, z=4, stackpos=2} or {x=443, y=201, z=4, stackpos=2}
piecepos3 = {x=443, y=198, z=4, stackpos=2} or {x=443, y=202, z=4, stackpos=2}
piecepos4 = {x=443, y=199, z=4, stackpos=2} or {x=443, y=203, z=4, stackpos=2}
piecepos5 = {x=444, y=199, z=4, stackpos=2} or {x=444, y=203, z=4, stackpos=2}
getpiece1 = getThingfromPos(piecepos1)
getpiece2 = getThingfromPos(piecepos2)
getpiece3 = getThingfromPos(piecepos3)
getpiece4 = getThingfromPos(piecepos4)
getpiece5 = getThingfromPos(piecepos5)

if getpiece1.itemid == 2321 and getpiece3.itemid == 2149 and getpiece3.type == 10 then
 random_number = math.random(1,100)
 doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_ORANGE)
 doSendMagicEffect(topos,CONST_ME_BLOCKHIT)
 if random_number <= (11+getPlayerStorageValue(cid, 50000)) then
 doCreateItem(13626, 1,piecepos3)
 doRemoveItem(getpiece3.uid,10)
 doPlayerSendTextMessage(cid,19,"Voce refinou 10 small emeralds.")
 doPlayerAddHealth(cid, -25)
end
  
elseif getpiece1.itemid == 2321 and getpiece3.itemid == 2153 then
 random_number = math.random(1,100)
 doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_ORANGE)
 doSendMagicEffect(topos,CONST_ME_BLOCKHIT)
 if random_number <= (11+getPlayerStorageValue(cid, 50000)) then
 doCreateItem(13632, 1,piecepos3)
 doRemoveItem(getpiece3.uid,10)
 doPlayerSendTextMessage(cid,19,"Voce refinou 1 violet gem.")
 doPlayerAddHealth(cid, -25)
end
  
elseif getpiece1.itemid == 2321 and getpiece3.itemid == 2157 and getpiece3.type == 10 then
 random_number = math.random(1,100)
 doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_ORANGE)
 doSendMagicEffect(topos,CONST_ME_BLOCKHIT)
 if random_number <= (11+getPlayerStorageValue(cid, 50000)) then
 doCreateItem(13633, 1,piecepos3)
 doRemoveItem(getpiece3.uid,10)
 doPlayerSendTextMessage(cid,19,"Voce refinou 10 golden nuggets.")
 doPlayerAddHealth(cid, -25)
end
  
elseif getpiece1.itemid == 2321 and getpiece3.itemid == 13641 and getpiece3.type == 10 then
 random_number = math.random(1,100)
 doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_ORANGE)
 doSendMagicEffect(topos,CONST_ME_BLOCKHIT)
 if random_number <= (11+getPlayerStorageValue(cid, 50000)) then
 doCreateItem(13634, 1,piecepos3)
 doRemoveItem(getpiece3.uid,10)
 doPlayerSendTextMessage(cid,19,"Voce refinou 10 iron nuggets.")
 doPlayerAddHealth(cid, -25)
end

elseif getpiece1.itemid == 2321 and getpiece3.itemid == 13634 and getpiece3.type == 1 then
getDrops(cid)
doSendAnimatedText(topos, "Priimm!", TEXTCOLOR_ORANGE)
doSendMagicEffect(topos, 9)
rand1 = math.random(1,200)
if rand1 <= (10+getPlayerStorageValue(cid, config.storage)) then
if #drops >= 1 then
local items = drops[math.random(1,#drops)]
doPlayerSendTextMessage(cid, 22, "Voce conseguiu forjar uma ("..getItemName(items).."), parabens!.")
doCreateItem(items, 1,piecepos3)
doSendMagicEffect(topos, 15)
doRemoveItem(getpiece3.uid,1)
doSendAnimatedText(topos, "Forged!", TEXTCOLOR_WHITE_EXP)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
setPlayerStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
local experience = getPlayerStorageValue(cid, config.experience)
if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then
setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
doPlayerSendTextMessage(cid, 20, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
end
else
doSendMagicEffect(topos, 9)
doSendAnimatedText(topos, "Plack!", TEXTCOLOR_ORANGE)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return true
end
return false
end
return true
end
end
 

 

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 1

local continue

if topos.x == piecepos1.x and topos.y == piecepos1.y then

continue = true

elseif topos.x == piecepos2.x and topos.y == piecepos2.y then

continue = true

elseif topos.x == piecepos3.x and topos.y == piecepos3.y then

continue = true

elseif topos.x == piecepos4.x and topos.y == piecepos4.y then

continue = true

elseif topos.x == piecepos5.x and topos.y == piecepos5.y then

continue = true

end

if not continue then return TRUE end

 

Isso chama-se gambiarra, mas vai te ajudar.

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

  • 0

Pra ser sincero, eu não li o código todo. Qual o ID desse solid iron? Basicamente você só precisaria adicionar algo como:

 

  if item2.itemid ~= ID do solid iron  then  return doPlayerSendCancel(cid, "Use o hammer no Solid Iron.") and false  end

 

 

logo no início.

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

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...