OT
pedido

(Move Event) Ganha Storage Ao Equipar O Item!

Por othereality, 22 de set. de 2012 em Scripts

script
5
1.3k
otherealityO
22 de setembro de 2012 às 16:49

Galera eu tava querendo fazer o player ganhar +1 em um storage quando equipasse o item x, mas não consegui.

 

Aqui vai o que eu tentei:

function onEquip(cid, item, position, fromPosition)
local int = getPlayerStorageValue(cid, 23224)
setPlayerStorageValue(cid, 23224, int + 1)
end

 

E a tag que eu coloquei:

<movevent type="Equip" itemid="2517" level="2" slot="shield" event="Equip" script="skills/shield of honour.lua">
<vocation id="0"/>
<vocation id="5"/>
</movevent>

 

Não apresenta nenhum erro no cmd mas também não adiciona o storage.

Editado Setembro 22 por OtheReality

SkymagnumS
22 de setembro de 2012 às 17:16
function onEquip(cid, item, slot)
if getPlayerStorageValue(cid, 23224) < 1 then
setPlayerStorageValue(cid, 23224, getPlayerStorageValue(cid, 23224) + 1)
end
return true
end

function onDeEquip(cid, item, slot)
if getPlayerStorageValue(cid, 23224) > 0 then
setPlayerStorageValue(cid, 23224, getPlayerStorageValue(cid, 23224) - 1)
end
return true
end

otherealityO
22 de setembro de 2012 às 17:39

Não deu, acho que tem algum erro na minha tag '-'

SkymagnumS
22 de setembro de 2012 às 17:47
<movevent type="Equip" itemid="2157" slot="shield" event="script" value="nome.lua">
<vocation id="0"/>
<vocation id="5" showInDescription="0"/>

otherealityO
22 de setembro de 2012 às 17:59

Finalmente!!

Funcionou, só que tem que por o DeEquip na tag também se não quando tira não perde o storage.

<movevent type="DeEquip" itemid="2517" slot="shield" event="script" value="skills/shield of honour.lua"/>
<movevent type="Equip" itemid="2517" slot="shield" event="script" value="skills/shield of honour.lua">
<vocation id="0"/>
<vocation id="5"/>
</movevent>

Obrigado pela ajuda! já dei o rep de hj, mas amanhã é seu.

Editado Setembro 22 por OtheReality