Jump to content

Recommended Posts

'~" MOD Comprar Item Por Alavanca "~'

mdr.gif

  • ​Como funciona?

Não está muito dificil de entender, simplesmente é compra itens (no caso runas) por alavanca com um mod:

  • Script:

​Na pasta principal do seu ot, entre na pasta MODS, e dentro crie um arquivo chamado Itemslever.xml

 

 

<?xml version="1.0" encoding="UTF-8"?>

<mod name="Itemslever" version="1.0" enabled="yes">

<config name="switch_items"><![CDATA[

uid = {

[5556] = {item = 2273, count = 1, charges = 2, cost = 50, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5557] = {item = 2313, count = 1, charges = 3, cost = 200, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5558] = {item = 2268, count = 1, charges = 3, cost = 250, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5559] = {item = 2293, count = 1, charges = 3, cost = 200, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5560] = {item = 2311, count = 1, charges = 10, cost = 75, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5561] = {item = 2304, count = 1, charges = 4, cost = 150, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5562] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5563] = {item = 7620, count = 20, charges = 1, cost = 1000, backpack = true, backpackID = 2001, backpackCount = 1, cap = true},

[5564] = {item = 2273, count = 20, charges = 2, cost = 1000, backpack = true, backpackID = 2002, backpackCount = 1, cap = true},

[5565] = {item = 2268, count = 20, charges = 3, cost = 5000, backpack = true, backpackID = 2003, backpackCount = 1, cap = true},

[5566] = {item = 2293, count = 20, charges = 3, cost = 4000, backpack = true, backpackID = 1999, backpackCount = 1, cap = true},

[5567] = {item = 2311, count = 20, charges = 10, cost = 1500, backpack = true, backpackID = 2001, backpackCount = 1, cap = true},

[5568] = {item = 2313, count = 20, charges = 3, cost = 4000, backpack = true, backpackID = 2001, backpackCount = 1, cap = true},

[5569] = {item = 2304, count = 20, charges = 4, cost = 3000, backpack = true, backpackID = 2000, backpackCount = 1, cap = true},

[5570] = {item = 3940, count = 1, charges = 1, cost = 20, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5571] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5572] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, backpackCount = 0, cap = true}

}

 

levers = {

1945,

1946

}

]]></config>

<action fromuid="5556" touid="5572" event="buffer"><![CDATA[

domodlib('switch_items')

 

doTransformItem(item.uid, levers[item.itemid == levers[1] and 2 or 1])

 

local item = uid[item.uid]

if item then

if item.backpack then

if getPlayerMoney(cid) < item.cost then

doPlayerSendCancel(cid, "Voce precisa de " .. item.cost .. " Gps Pra comprar uma backpack de " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

if item.cap and getPlayerFreeCap(cid) < (getItemWeightById(item.backpackID, item.backpackCount) + getItemWeightById(item.item, item.count)) then

doPlayerSendCancel(cid, "Voce nao tem cap.")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

local container = doPlayerAddItem(cid, item.backpackID, item.backpackCount)

for i = 1, item.count do

doAddContainerItem(container, item.item, item.charges)

end

doPlayerRemoveMoney(cid, item.cost)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce comprou " .. item.count .. "x de " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)

else

if getPlayerMoney(cid) < item.cost then

doPlayerSendCancel(cid, "Voce precisa de " .. item.cost .. " Gps pra comprar " .. getItemArticleById(item.item) .. " " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

if item.cap and getPlayerFreeCap(cid) < getItemWeightById(item.item, item.count) then

doPlayerSendCancel(cid, "Voce nao tem cap.")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

for i = 1, item.count do

doPlayerAddItem(cid, item.item, item.charges)

end

doPlayerRemoveMoney(cid, item.cost)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você comprou " .. item.count .. "x de " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)

end

end

]]></action>

</mod>

  • Explicação:

[5556] = {item = 2273, count = 1, charges = 2, cost = 50, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

 

_________________________________

|» Unique que se vai por na alavanca |

|» ID do item que será comprado |

|» Quantia que vai vim a cada puxada |___________________________________________

|» Cargas, quantas cargas vão vir (caso seja runa), se não for runa coloca 'charges = 1' |

|» Preço que o player vai pagar _________________________________________________|

|» Não precisa mecher _______|

|___________________|

Edited by GuizitoG
Link to comment
Share on other sites

Claro é simples:

 

 

<?xml version="1.0" encoding="UTF-8"?>

<mod name="Itemslever" version="1.0" enabled="yes"> <config name="switch_items"><![CDATA[ uid = { "] = {item = 2273, count = 1, charges = 2, cost = 50, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5557] = {item = 2313, count = 1, charges = 3, cost = 200, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5558] = {item = 2268, count = 1, charges = 3, cost = 250, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5559] = {item = 2293, count = 1, charges = 3, cost = 200, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5560] = {item = 2311, count = 1, charges = 10, cost = 75, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5561] = {item = 2304, count = 1, charges = 4, cost = 150, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5562] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5563] = {item = 7620, count = 20, charges = 1, cost = 1000, backpack = true, backpackID = 2001, backpackCount = 1, cap = true},

[5564] = {item = 2273, count = 20, charges = 2, cost = 1000, backpack = true, backpackID = 2002, backpackCount = 1, cap = true},

[5565] = {item = 2268, count = 20, charges = 3, cost = 5000, backpack = true, backpackID = 2003, backpackCount = 1, cap = true},

[5566] = {item = 2293, count = 20, charges = 3, cost = 4000, backpack = true, backpackID = 1999, backpackCount = 1, cap = true},

[5567] = {item = 2311, count = 20, charges = 10, cost = 1500, backpack = true, backpackID = 2001, backpackCount = 1, cap = true},

[5568] = {item = 2313, count = 20, charges = 3, cost = 4000, backpack = true, backpackID = 2001, backpackCount = 1, cap = true},

[5569] = {item = 2304, count = 20, charges = 4, cost = 3000, backpack = true, backpackID = 2000, backpackCount = 1, cap = true},

[5570] = {item = 3940, count = 1, charges = 1, cost = 20, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5571] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, backpackCount = 0, cap = true},

[5572] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, backpackCount = 0, cap = true}

}

 

levers = {

1945,

1946

}

]]></config>

<action fromuid="5556" touid="5572" event="buffer"><![CDATA[

domodlib('switch_items')

 

doTransformItem(item.uid, levers[item.itemid == levers[1] and 2 or 1])

 

local item = uid[item.uid]

if item then

if item.backpack then

if getPlayerMoney(cid) < item.cost then

doPlayerSendCancel(cid, "Voce precisa de " .. item.cost .. " Gps Pra comprar uma backpack de " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

if item.cap and getPlayerFreeCap(cid) < (getItemWeightById(item.backpackID, item.backpackCount) + getItemWeightById(item.item, item.count)) then

doPlayerSendCancel(cid, "Voce nao tem cap.")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

local container = doPlayerAddItem(cid, item.backpackID, item.backpackCount)

for i = 1, item.count do

doAddContainerItem(container, item.item, item.charges)

end

doPlayerRemoveMoney(cid, item.cost)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce comprou " .. item.count .. "x de " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)

else

if getPlayerMoney(cid) < item.cost then

doPlayerSendCancel(cid, "Voce precisa de " .. item.cost .. " Gps pra comprar " .. getItemArticleById(item.item) .. " " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

if item.cap and getPlayerFreeCap(cid) < getItemWeightById(item.item, item.count) then

doPlayerSendCancel(cid, "Voce nao tem cap.")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

return true

end

 

for i = 1, item.count do

doPlayerAddItem(cid, item.item, item.charges)

end

doPlayerRemoveMoney(cid, item.cost)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você comprou " .. item.count .. "x de " .. getItemNameById(item.item) .. ".")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)

end

end

]]></action>

</mod>

 

Ali, coloquei em marrom e aumentei a letra, ali no caso é o id do iten que se vai puxa, que no caso akeles ids são as alavancas... Recomendo voce nao colocar o id dos coins, por que coins são agrupaveis, e itens agrupaveis podem bugar, e acabar perdendo a unique...

Link to comment
Share on other sites

  • 8 years later...

Desculpem reviver esse tópico, estou precisando de um sistema de troca por alavanca em que ao inves de usar gold, eu use uma moeda do jogo!! 

Esse sistema é o mais completo e simplificado que encontrei de troca por gold!! Se alguem puder me ajudar vai ser top!!!

Link to comment
Share on other sites

 Share

×
×
  • Create New...