UL
talkaction

[Talkactions] Enviando Mensagem Global Por Comando! Necessita De Item.

Por ultimate1996, 03 de fev. de 2012 em Actions e Talkactions

tfs0.4
script
5
1.3k
ultimate1996U
03 de fevereiro de 2012 às 23:19

Vim aqui trazer pra vocês um sistema de mensagem Global, aonde qualquer player pode enviar mensagem através do chat ou broadcast.

 

Vá na pasta de seu OT/data/talkactions/scripts , copie e cole um arquivo e depois renomeie-o pra globalmessage .

 

Apague tudo que està no arquivo e substitua por :a

 

 

 

function onSay(cid, words, param)

 

local itemId = 12596

 

 

for _, pid in ipairs(getPlayersOnline()) do

doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE , getCreatureName(cid)..":"..param)

end

return TRUE

end

 

if (doPlayerRemoveItem(cid, itemId, 1)) then

doPlayerSendChannelMessage(cid, getCreatureName(cid), param, MESSAGE_EVENT_DEFAULT, CHANNEL_DEFAULT)

else

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"You dont have the necessary item.")

end

 

return TRUE

end

 

 

12596 - ID do item usado pra enviar a mensagem.

 

MESSAGE_STATUS_CONSOLE_BLUE - Cor da mensagem global que aparecerá no chat. ( pode ser mudada )

 

1 - Mude para 0 se você quer que o item não seja removido ao utilizar o comando.

 

 

 

Depois và em data/talkactions e abra o arquivo talkactions.xml.

 

E cole isso :

 

<talkaction words="!@" event="script" value="globalmessage.lua">

 

Como usar : Digite !@ no channel e a mensagem que quer em seguida.

 

 

OBS : Se você quiser mudar o comando pra enviar a mensagem global, é só você substituir o !@ pelo que quiser.. Exemplo : Se você mudar para !msg, você tera que digitar !msg Mensagem Aqui

 

 

é isso gente, não sei se funciona nos outros TFS, mas eu testei no TFS 0.4 e funcionou normalmente.</talkaction>

Editado Fevereiro 4 por RaizenUrameshi

haiguriH
04 de fevereiro de 2012 às 22:07

como faz p mudar a cor da mensagem??

 

Tirando isso, ta funfando aqui..

bepokemonB
04 de fevereiro de 2012 às 22:36

Seu código está com um erro estranho o.O'

function onSay(cid, words, param)
local item, type = {12596,1}, MESSAGE_INFO_DESCR

if (not param or param == '') then
return true, doPlayerSendCancel(cid, "Command param required.")
end
if not doPlayerRemoveItem(cid, item[1], item[2]) then
strocnt = item[2] == 1 and getItemArticleById(item[1]) or item[2]
return true, doPlayerSendCancel(cid, "You need at least "..strocnt.." "..getItemNameById(item[1]).." to broadcast a message.")
end
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerGroupId(cid) > getPlayerGroupId(pid) then
doPlayerSendTextMessage(pid, type, getPlayerName(cid)..' ['..getPlayerLevel(cid)..']: '..param)
end
return true
end
doPlayerSendTextMessage(cid, 18, words..' '..param)
return TRUE
end

 

ultimate1996U
04 de fevereiro de 2012 às 22:47

Que erro? Eu testei no TFS 0.4 e tá funcionando normalmente..

bepokemonB
04 de fevereiro de 2012 às 23:08

Que erro? Eu testei no TFS 0.4 e tá funcionando normalmente..

 

Ele checa se o param é "" e se for ele manda broadcast de 'Nome:'. o.O'