Ir para conteúdo
  • Cadastre-se

(Resolvido)ITEM SKIN


Ir para solução Resolvido por changos,

Posts Recomendados

Ola,estou com problema em uma Action script,estou tentando fazer um item que muda a outfit do player
A script funciona normalmente mas eu queria adicionar uma condição nela que seria "apenas x vocation pode dar use nesse item e mudar a outfit"
 

Spoiler

function onUse(cid, item)
--------------------------------------------------
local dolls = {
    [6506] = {outfit = 402, name = "KISAME CURTINDO VERAO"},
    [11207] = {outfit = 9, name = "NOME 2"},
    [9019] = {outfit = 15, name = "NOME 3"},
}
---------------------------------------------------
local go = dolls[item.itemid]
---------------------------------------------------
 if getVocation (cid) = 1 then
 return true
    if go then
        if getCreatureOutfit (cid).lookType ~= go.outfit then
            doCreatureChangeOutfit(cid, { lookType = go.outfit})
            doCreatureSay(cid, "SKIN!! ("..go.name..")", TALKTYPE_ORANGE_1)
            return true
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'SKIN EM USO!!')
            return true
        end
    end
end

 

Link para o post
Compartilhar em outros sites

Boa Tarde, estou aprendendo lua vou tentar ajudá-lo!

 

Spoiler

local dolls = {
    [6506] = {roupaMale = 0, roupaFemale = 402, name = "KISAME CURTINDO VERAO", voc = 3},
    [11207] = {roupaMale = 9, roupaFemale = 0, name = "NOME 2", voc = 1},
    [9019] = {roupaMale = 15, roupaFemale = 0,  name = "NOME 3", voc = 2}
}
function onUse(cid, item)
for k,v in pairs(dolls) do
if item.itemid == k then
   if getVocation(cid) == v.voc then
     if getPlayerSex(cid) == 0 then
        doSetCreatureOutfit(cid, v.roupaFemale)
    else
        doSetCreatureOutfit(cid, v.roupaMale)
    return true
end
   end
end
    end
end
 

 

Editado por Pedro 469 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

testa assim.

Spoiler

local dolls = {
    [6506] = {roupaMale = 0, roupaFemale = 402, name = "KISAME CURTINDO VERAO", voc = 3},
    [11207] = {roupaMale = 9, roupaFemale = 0, name = "NOME 2", voc = 1},
    [9019] = {roupaMale = 15, roupaFemale = 0,  name = "NOME 3", voc = 2}
}

function onUse(cid, item)
for k,v in pairs(dolls) do
if item.itemid == k and getVocation(cid) == v.voc then
   doSetCreatureOutfit(cid, v.roupaMale)
   return true
  end
 end
end

 

Link para o post
Compartilhar em outros sites
  • Solução
local dolls = {
    [6506] = {name='Noob',outfit = 19, voc={1,2,5,6}},
	[11207] = {name='Puto',outfit = 9, voc={4,8}},
	[9019] = {name='Pendejo',outfit = 12,voc={3,7}}
	}
	
function onUse(cid,item,frompos,itemEx,topos)
local r,v = dolls[item.itemid],getThingPos(cid)
	if r then
		if isInArray(r.voc,getPlayerVocation(cid)) then
			if getCreatureOutfit (cid).lookType ~= r.outfit then
                doCreatureChangeOutfit(cid, {lookType = r.outfit})
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'Skin: '..r.name..'!')
				--doRemoveItem(item.uid,1)
			else
				doPlayerSendCancel(cid,'You already wear this outfit!')
				doSendMagicEffect(v,CONST_ME_POFF)
			end
		else
			doPlayerSendCancel(cid,'You have the wrong vocation!')
			doSendMagicEffect(v,CONST_ME_POFF)
                end
	else
		doPlayerSendCancel(cid,'Sorry not possible.')
	end
	return true
end

use this change the names and ids xd

<action itemid="id;id;id" event="script" value="name.lua"/>

 

 

with genders

 

local dolls = {
    [6506] = {name='Noob',outfit = {18,19}, voc={1,2,5,6}},
	[11207] = {name='Puto',outfit = {8,9}, voc={4,8}},
	[9019] = {name='Pendejo',outfit = {11,12},voc={3,7}}
	}
	
function onUse(cid,item,frompos,itemEx,topos)
local r,v = dolls[item.itemid],getThingPos(cid)
	if r then
		if isInArray(r.voc,getPlayerVocation(cid)) then
		--for i = 1, 2 do
			if getCreatureOutfit (cid).lookType ~= r.outfit then
                doCreatureChangeOutfit(cid, {lookType = r.outfit[getPlayerSex(cid) + 1]})
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'Skin: '..r.name..'!')
				--doRemoveItem(item.uid,1)
			else
				doPlayerSendCancel(cid,'You already wear this outfit!')
				doSendMagicEffect(v,CONST_ME_POFF)
			end
			--end
		else
			doPlayerSendCancel(cid,'You have the wrong vocation!')
			doSendMagicEffect(v,CONST_ME_POFF)
                end
	else
		doPlayerSendCancel(cid,'Sorry not possible.')
	end
	return true
end

 

Editado por changos (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo