Postado Abril 1, 2022 3 anos Ao usar um item, mudará minha outfit e quando eu usa-lo novamente removerá a mesma. O item não será removido da Bag. Este item só poderá ser usado pela vocação <vocation id="1-13"/> Spoiler local remove = true -- Remover ao usar? local sto = 1234568 local outfits = { [11478] = {out = 2013}, } -- [Item ID] = {out = ID da Outfit}, function onUse(cid, item) local t = outfits[item.itemid] if getCreatureOutfit(cid).lookType ~= 2013 then --se o outfit for diferente do 2013 setPlayerStorageValue(cid, 1234567, getCreatureOutfit(cid).lookType) --salva o looktype atual do player else doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, 1234567)}) end if t and getCreatureOutfit(cid).lookType ~= 2013 then doCreatureChangeOutfit(cid, {lookType = t.out}) end if remove then doRemoveItem(item.uid, 0) end return true end Editado Abril 1, 2022 3 anos por raphadoidera (veja o histórico de edições)
Postado Abril 1, 2022 3 anos 11 minutos atrás, raphadoidera disse: Ao usar um item, mudará minha outfit e quando eu usa-lo novamente removerá a mesma. O item não será removido da Bag. local remover = false -- Remover ao usar? false = não remove, true = remover local outfits = { [11478] = {out = 2013}, } function onUse(cid, item) local t = outfits[item.itemid] if getCreatureOutfit(cid).lookType ~= 2013 then --se o outfit for diferente do 2013 setPlayerStorageValue(cid, 1234567, getCreatureOutfit(cid).lookType) --salva o looktype atual do player doCreatureChangeOutfit(cid, {lookType = t.out}) --transforma doPlayerSendTextMessage(cid, 22, "Voce alterou seu Outfit!") else doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, 1234567)}) --se o looktype for 2013 volta ao original doPlayerSendTextMessage(cid, 22, "De volta ao seu outfit original!") end if remover then doRemoveItem(item.uid, 1) -- pode deixar 1 aqui e no escopo deixa false end return true end uma dica não use "remove" "callback" como variavel, pq ja são funções do tibia, isso pode dar conflito as vezes alterei onde estava "remove" pra "remover" testa esse pra ver se funciona, se não funcionar posta o erro do console em spoiler pf. Editado Abril 1, 2022 3 anos por FeeTads ajuste (veja o histórico de edições)
Postado Abril 1, 2022 3 anos Autor 3 minutos atrás, FeeTads disse: local remover = false -- Remover ao usar? false = não remove, true = remover local outfits = { [11478] = {out = 2013}, } function onUse(cid, item) local t = outfits[item.itemid] if getCreatureOutfit(cid).lookType ~= 2013 then --se o outfit for diferente do 2013 setPlayerStorageValue(cid, 1234567, getCreatureOutfit(cid).lookType) --salva o looktype atual do player doCreatureChangeOutfit(cid, {lookType = t.out}) --transforma doPlayerSendTextMessage(cid, 22, "Voce alterou seu Outfit!") else doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, 1234567)}) --se o looktype for 2013 volta ao original doPlayerSendTextMessage(cid, 22, "De volta ao seu outfit original!") end if remover then doRemoveItem(item.uid, 1) -- pode deixar 1 aqui e no escopo deixa false end --uma dice não use "remove" "callback" como variavel, pq ja são funções do tibia, isso pode dar conflito as vezes return true end testa esse pra ver se funciona, se não funcionar posta o erro do console em spoiler pf. Funcionou perfeitamente irmão, só falta colocar pra apenas X vocação poder usar
Postado Abril 1, 2022 3 anos 6 minutos atrás, raphadoidera disse: Funcionou perfeitamente irmão, só falta colocar pra apenas X vocação poder usar if getPlayerVocation(cid) == 1 or if getPlayerVocation(cid) == 5 --esse eh sorc (n tenho ctz pode ser druid) if getPlayerVocation(cid) == 2 or if getPlayerVocation(cid) == 6 -- esse eh druid (n tenho ctz pode ser sorc) if getPlayerVocation(cid) == 3 or if getPlayerVocation(cid) == 7 --esse é pally if getPlayerVocation(cid) == 4 or if getPlayerVocation(cid) == 8 --esse eh knight vc adicionaria acima a vocation que vc quer assim: if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then if getCreatureOutfit(cid).lookType ~= 2013 then --se o outfit for diferente do 2013 setPlayerStorageValue(cid, 1234567, getCreatureOutfit(cid).lookType) --salva o looktype atual do player doCreatureChangeOutfit(cid, {lookType = t.out}) --transforma doPlayerSendTextMessage(cid, 22, "Voce alterou seu Outfit!") else doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, 1234567)}) --se o looktype for 2013 volta ao original doPlayerSendTextMessage(cid, 22, "De volta ao seu outfit original!") end if remover then doRemoveItem(item.uid, 1) -- pode deixar 1 aqui e no escopo deixa false end end 3 minutos atrás, FeeTads disse: getPlayerVocation(cid) == 5 ai vc olha la no teu vocation.xml e escolhe quais vc quiser kkkkkkkk Editado Abril 1, 2022 3 anos por FeeTads reajuste (veja o histórico de edições)
Postado Abril 1, 2022 3 anos Autor 16 minutos atrás, FeeTads disse: if getPlayerVocation(cid) == 1 or if getPlayerVocation(cid) == 5 --esse eh sorc (n tenho ctz pode ser druid) if getPlayerVocation(cid) == 2 or if getPlayerVocation(cid) == 6 -- esse eh druid (n tenho ctz pode ser sorc) if getPlayerVocation(cid) == 3 or if getPlayerVocation(cid) == 7 --esse é pally if getPlayerVocation(cid) == 4 or if getPlayerVocation(cid) == 8 --esse eh knight vc adicionaria acima a vocation que vc quer assim: if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then if getCreatureOutfit(cid).lookType ~= 2013 then --se o outfit for diferente do 2013 setPlayerStorageValue(cid, 1234567, getCreatureOutfit(cid).lookType) --salva o looktype atual do player doCreatureChangeOutfit(cid, {lookType = t.out}) --transforma doPlayerSendTextMessage(cid, 22, "Voce alterou seu Outfit!") else doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, 1234567)}) --se o looktype for 2013 volta ao original doPlayerSendTextMessage(cid, 22, "De volta ao seu outfit original!") end if remover then doRemoveItem(item.uid, 1) -- pode deixar 1 aqui e no escopo deixa false end end ai vc olha la no teu vocation.xml e escolhe quais vc quiser kkkkkkkk Deu esse erro na distro irmão. OBS: Mano em relação as vocações, exemplo naruto vai da Vocação 1 até a vocação 13. if getPlayerVocation(cid) == 1 or if getPlayerVocation(cid) == 13 Colocando dessa forma, não iria possibilitar apenas a vocação 1 e 13 de usarem? Ao invés de possibilitar da vocação 1 até a vocação 13?
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.