alguem? pfv preciso urgentemente desse script ![]()
info
Grupo: Visconde
Registrado: 03/02/10
Posts: 322
Reputação: +98
Gênero: Masculino
Char no Tibia: Miguel Absy

Em actions.xml, adicione a tag:
<action itemid="15557;15558" script="outfititem.lua"/>
Em actions/scripts/, crie um arquivo de nome outfititem.lua e adicione:
local configs = {
{itemid = 15557, gender = 0, storage = 12987, value = 1, name = "Chun Li"};
{itemid = 15558, gender = 1, storage = 12988, value = 1, name = "NOMEDOOUTFIT2"}
}
function onUse(cid, item)
for _, outfit in ipairs(configs) do
if item.itemid == outfit.itemid then
if getPlayerStorageValue(cid, outfit.storage) <= 0 then
if getPlayerSex(cid) == outfit.gender then
setPlayerStorageValue(cid, outfit.storage, outfit.value)
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSendTextMessage(cid, 22, "You gained the "..outfit.name.." outfit.")
doRemoveItem(item.uid, 1)
return true
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendTextMessage(cid, 22, "You arent of the correct gender.")
return true
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendTextMessage(cid, 22, "You already has the "..outfit.name.." outfit.")
return true
end
end
end
return false
end
Em XML/outfits.xml, adicione, na frente de outfit id="IDDOOUTFIT":
storageId="12987" storageValue="1"
Editado Abril 24 por miguel223
11 horas atrás, miguel223 disse:Em actions.xml, adicione a tag:
<action itemid="ITEMID1;ITEMID2" type="script" value="outfititem.lua"/>
Em actions/scripts/, crie um arquivo de nome outfititem.lua e adicione:
local configs = {
{itemid = IDDOITEMDAMULHER, gender = 0, storage = 12987, value = 1, name = NOMEDOOUTFIT};
{itemid = IDDOITEMDOHOMEM, gender = 1, storage = 12987, value = 1, name = NOMEDOOUTFIT}
}
function onUse(cid, item)
for _, outfit in ipairs(configs) do
if item.itemid == outfit.itemid then
if getPlayerStorageValue(cid, outfit.storage) <= 0 then
if getPlayerGender(cid) == outfit.gender then
setPlayerStorageValue(cid, outfit.storage, outfit.value)
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSendTextMessage(cid, 22, "You gained the "..name.." outfit.")
doRemoveItem(item.uid)
else
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerSendTextMessage(cid, 22, "You arent of the correct gender.")
doRemoveItem(item.uid)
end
else
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
return true
end
Em XML/outfits.xml, adicione, na frente de outfit id="IDDOOUTFIT":
storageId="12987" storageValue="1"
ola testei porem o script nao esta pegando, nem sei o pq nao ta dando erro no log nem nada,
repassando os passos
1º tag na actions
<action itemid="15557;15558" type="script" value="outfitsitems.lua"/>
2º script do actions
local configs = {{itemid = 15557, gender = 0, storage = 12987, value = 1, name = Chun Li};} function onUse(cid, item) for _, outfit in ipairs(configs) doif item.itemid == outfit.itemid thenif getPlayerStorageValue(cid, outfit.storage) <= 0 thenif getPlayerGender(cid) == outfit.gender thensetPlayerStorageValue(cid, outfit.storage, outfit.value)doSendMagicEffect(getPlayerPosition(cid), 12)doPlayerSendTextMessage(cid, 22, "You gained the "..name.." outfit.")doRemoveItem(item.uid)elsedoSendMagicEffect(getPlayerPosition(cid), 2)doPlayerSendTextMessage(cid, 22, "You arent of the correct gender.")doRemoveItem(item.uid)endelsedoSendMagicEffect(getPlayerPosition(cid), 2)endend return trueend
3º no outfits.xlm
<outfit id="72" storageId="12987" storageValue="1"><list gender="0" lookType="2943" name="Chun Li"/></outfit>
o servidor é um pokemon PDA
acho q esqueci falar isso
info
Grupo: Visconde
Registrado: 03/02/10
Posts: 322
Reputação: +98
Gênero: Masculino
Char no Tibia: Miguel Absy

Editei, tenta ai.
Testei, acho q talvez o erro nao esteja no bug mas sim na configuraçao do item, pois ao clicar use ta dando o erro "you cannot use this object"
mas nao entendo pq pois no object item configurei ate usavel

edit: configurei ate no object builder pra ficar usavel mas mesmo assim nao faz nada ao ser usado
Editado Abril 24 por Josegvb
info
Grupo: Visconde
Registrado: 03/02/10
Posts: 322
Reputação: +98
Gênero: Masculino
Char no Tibia: Miguel Absy

Não pode ser usável.
Agora, miguel223 disse:Não pode ser usável.
tb quando tiro o usavel só vem essa mensagem
you cannot use this object
info
Grupo: Visconde
Registrado: 03/02/10
Posts: 322
Reputação: +98
Gênero: Masculino
Char no Tibia: Miguel Absy

Editei o script, tenta agora.
EDIT: acabei de editar de novo, usa exatamente do jeito que está ai, já até configurei pra ti.
Editado Abril 24 por miguel223
Agora, miguel223 disse:Editei o script, tenta agora.
mesmo erro, ao usar ta dando " you cannot use this object "
nada aparesce no log



info
Grupo: Marquês
Registrado: 23/09/12
Posts: 1k
Reputação: +87
Gênero: Masculino
ola fikei procurando no forum e achei varios scripts mas nemhum com a restriccoes q eu queria
entao eu queria q ao usar x item voce ira ganhar x outfit mas só poderia usar se for mulher, ou se for homem, alias queria que o item ira poder ser utiliçado somente pelo homem ou pelo mulher mas nao ambos ao mesmo tempo pois tem outfit q nao tem sua versao pra mulher, igualmente tem outfit q nao tem versao pra homen...
resumendo
script pra o outfit de homen: se for homen: parabens! voce ganhou o outfit
se for mullher e ia tentar usar: malz esse outfit é pra homen apenas
script 2, seria a mesma coisa somente somente q a mulher ia ganhar e se o homen tentase usar, o item ira falar q apenas mulher pode usar.