LU
action

Change Sex Item

Por LuckinhaSan, 17 de abr. de 2013 em Actions e Talkactions

script
3
1.3k
LuckinhaSanL
17 de abril de 2013 às 23:25

Quando o item é usado, deve mudar de sexo do jogador.

 

Vá em data/actions/scripts, crie um arquivo .lua com o nome de changesex e adicione isto -

function onUse(cid, item, fromposition, itemex, toposition) 
if( getPlayerSex(cid) == 0 )then  
doPlayerSetSex(cid, 1) 
doPlayerSendTextMessage(cid,22, "You have changed your Gender") 
doSendMagicEffect(getPlayerPosition(cid), 5) 
else 
if( getPlayerSex(cid) == 1 ) then  
doPlayerSetSex(cid, 0) 
doPlayerSendTextMessage(cid,22, "You have changed your Gender") 
doSendMagicEffect(getPlayerPosition(cid), 5) 
end  
return true  
end  
end

 

Abra actions.xml e adicione esta tag -

<action actionid="xxxx" event="script" value="changsex.lua"/>

 

actionid="xxxx" - xxxx é o id do item que será usado.

 

Créditos - X_Anero

SkymagnumS
17 de abril de 2013 às 23:29

Cara se for pra fazer sem remover nada é mais simples assim.

 

function onUse(cid, item)

 

return doPlayerSetSex(cid, getPlayerSex(cid) == 1 and 0 or 1)

end

xS0NYxX
20 de abril de 2013 às 15:48

Ou pode ser assim :

function onUse(cid, item, frompos, item2, topos)
sex =
{
[0] = 1,
[1] = 0
}
doPlayerSetSex(cid,sex[getPlayerSex(cid)])
end

Editado Abril 20 por xS0NYx