WO
suporte otserv

DA Use e ganha outfit

Por wougoplex, 30 de set. de 2016 em Resolvidos

outfit
item
use
13
3.7k
wougoplexW
30 de setembro de 2016 às 17:17

Queria Que Quando o Player desce use em um item ele ganharia tal outfit pra sempre 

AdministradorA
30 de setembro de 2016 às 17:26

Vc quer que o item seja removido após usar? Esse script não remove o item:

local config = {storage = 2016 -- storagelooktype_male = X, -- male.looktype_female = y, -- Yfemaleaddons = Z, }function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid,config.storage) < 1 thenif getPlayerSex(cid) == 0 thendoPlayerAddOutfit(cid,config.looktype_female,config.addons)doPlayerSendTextMessage(cid,20,'You got an outfit.')doSendMagicEffect(getThingPos(cid),12)elseif getPlayerSex(cid) == 1 thendoPlayerAddOutfit(cid,config.looktype_male,config.addons)doPlayerSendTextMessage(cid,20,'You got an outfit.')doSendMagicEffect(getThingPos(cid),12)endelsedoPlayerSendTextMessage(cid,20,'You already have this outfit.')doSendMagicEffect(getThingPos(cid),2)endreturn trueend

(x: outfit pra male / y: outfit pra female / z: quantos addons vai entregar)

 

 

Já Este remove (créditos CodexNG)

 

local c = {    male = 620, -- looktype of the outfit for male.    female = 619, -- looktype of the outfit for female    addons = 0, -- how many addons you get.    storage = 5012, -- storage value used.    removeAmount = 1}function onUse(cid, item, fromPosition, itemEx, toPosition)    local player = Player(cid)    local msg = ''    if player:getStorageValue(c.storage) < 1 then        player:addOutfitAddon(player:getSex() == 0 and c.male or c.female, c.addons)        msg = 'You got an outfit.'        item:remove(c.removeAmount)        player:setStorageValue(c.storage, 1)    else        msg = 'You already have this outfit.'    end    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)    player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT)    return trueend

 

 

wougoplexW
30 de setembro de 2016 às 20:56
3 horas atrás, Daniel disse:

Vc quer que o item seja removido após usar? Esse script não remove o item:

local config = {storage = 2016 -- storagelooktype_male = X, -- male.looktype_female = y, -- Yfemaleaddons = Z, }function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid,config.storage) < 1 thenif getPlayerSex(cid) == 0 thendoPlayerAddOutfit(cid,config.looktype_female,config.addons)doPlayerSendTextMessage(cid,20,'You got an outfit.')doSendMagicEffect(getThingPos(cid),12)elseif getPlayerSex(cid) == 1 thendoPlayerAddOutfit(cid,config.looktype_male,config.addons)doPlayerSendTextMessage(cid,20,'You got an outfit.')doSendMagicEffect(getThingPos(cid),12)endelsedoPlayerSendTextMessage(cid,20,'You already have this outfit.')doSendMagicEffect(getThingPos(cid),2)endreturn trueend

(x: outfit pra male / y: outfit pra female / z: quantos addons vai entregar)

 

 

Já Este remove (créditos CodexNG)

 

local c = {    male = 620, -- looktype of the outfit for male.    female = 619, -- looktype of the outfit for female    addons = 0, -- how many addons you get.    storage = 5012, -- storage value used.    removeAmount = 1}function onUse(cid, item, fromPosition, itemEx, toPosition)    local player = Player(cid)    local msg = ''    if player:getStorageValue(c.storage) < 1 then        player:addOutfitAddon(player:getSex() == 0 and c.male or c.female, c.addons)        msg = 'You got an outfit.'        item:remove(c.removeAmount)        player:setStorageValue(c.storage, 1)    else        msg = 'You already have this outfit.'    end    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)    player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT)    return trueend

 

 

Ele Adiciona pra sempre no armario ?

KarlKalvinK
30 de setembro de 2016 às 21:25

Só você ir no arquivo XML, adicionar essa tag do lado do ID da outfit 

 

quest="123456"

 

 

Ir no arquivo que você da use e adicionar essa tag aos atributos

 

 

setPlayerStorageValue(cid, 123456, 1)

 

 

wougoplexW
30 de setembro de 2016 às 22:01
36 minutos atrás, KarlKalvin disse:

Só você ir no arquivo XML, adicionar essa tag do lado do ID da outfit 

 

quest="123456"

 

 

Ir no arquivo que você da use e adicionar essa tag aos atributos

 

 

setPlayerStorageValue(cid, 123456, 1)

Tem como montar pra min so meio mongol com essas coisa

Tem como montar pra min so meio mongol com essas coisa

Editado Setembro 30 por wougoplex

KarlKalvinK
01 de outubro de 2016 às 01:16

Qual o ID da roupa que você quer que o cara ganhe quando clicar no item permanentemente? Posta o Nº ID e o seu outfits.xml que fica na pasta data/xml

wougoplexW
01 de outubro de 2016 às 13:58
12 horas atrás, KarlKalvin disse:

Qual o ID da roupa que você quer que o cara ganhe quando clicar no item permanentemente? Posta o Nº ID e o seu outfits.xml que fica na pasta data/xml

<outfit id="78" quest="181656">

<list gender="0" lookType="1736" name="Deidara"/>

<list gender="1" lookType="1736" name="Deidara"/>

</outfit>

 

KarlKalvinK
01 de outubro de 2016 às 16:26

Então é só criar o script na pasta actions do arquivo que você quer que de a outfit.

-- Código não testado.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")return trueendend

 

wougoplexW
01 de outubro de 2016 às 16:28
2 minutos atrás, KarlKalvin disse:

Então é só criar o script na pasta actions do arquivo que você quer que de a outfit.

-- Código não testado.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")return trueendend

 

Dai fica assim ?

 

local c = {

    male = 620, -- looktype of the outfit for male.

    female = 619, -- looktype of the outfit for female

    addons = 0, -- how many addons you get.

    storage = 5012, -- storage value used.

    removeAmount = 1

}

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, 181656) == 1 then

return doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")

else

setPlayerStorageValue(cid, 181656, 1)

doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")

return true

end

end

24 minutos atrás, KarlKalvin disse:

Então é só criar o script na pasta actions do arquivo que você quer que de a outfit.

-- Código não testado.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")return trueendend

 

Nao foi

Editado Outubro 1 por wougoplex

KarlKalvinK
01 de outubro de 2016 às 18:05

Não, o script você coloca oque eu te mandei.

Não foi? deu erro? qual erro? Posta o Erro do TFS aqui.

Eu não coloquei pra remover o item, atualizei o código.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doRemoveItem(item.uid, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")return trueendend

 

 

wougoplexW
01 de outubro de 2016 às 18:30
1 hora atrás, KarlKalvin disse:

Então é só criar o script na pasta actions do arquivo que você quer que de a outfit.

-- Código não testado.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")return trueendend

 

Funciono pá mais quando o player da use de novo n fala que ja tenho o outfit 

dai da esse erro na distro  

 

 

[01/10/2016 18:30:55] [Error - Action Interface] 

[01/10/2016 18:30:55] data/actions/scripts/Roupa1.lua:onUse

[01/10/2016 18:30:55] Description: 

[01/10/2016 18:30:55] (luaDoPlayerSendCancel) Player not found

 

 

 

KarlKalvinK
01 de outubro de 2016 às 18:38

Código atualizado para que não tenha esse erro... se ele diz que você já tem a outfit então agora é só trocar sua outfit como pediu.

O código tá para você usar o item, ganhar uma roupa permanente como você pediu.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doRemoveItem(item.uid, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")endend

 

 

wougoplexW
01 de outubro de 2016 às 18:44
6 minutos atrás, KarlKalvin disse:

Código atualizado para que não tenha esse erro... se ele diz que você já tem a outfit então agora é só trocar sua outfit como pediu.

O código tá para você usar o item, ganhar uma roupa permanente como você pediu.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)if getPlayerStorageValue(cid, 181656) == 1 thenreturn doPlayerSendCancel(cid, 22, "Você já possue essa outfit.")elsesetPlayerStorageValue(cid, 181656, 1)doRemoveItem(item.uid, 1)doPlayerSendTextMessage(cid, 22, "Parabéns você ganhou a outfit Deidara.")endend

 

 

Me Ajudou muito Rep+