Bom .. estou aqui para postar meu 2º script .. que consiste em TalkActions And Global Events.. se tiver alguma coisa errada e td mas .. eu vou arrumar
-----------------EDIT------------------
Bem , o script serve para a seguinte coisa .. se voce quer falar alguma coisa .. ou dexar um recado para os players de uma coisa nova que voce fes .. é só usar essa talkaction ..
-----------------EDIT------------------
Bom Para Nao Ficar Enrolando Vamos Ao Script..
Vamos Começar Pelo TalkActions..
Abra O TalkActions.xml e Adicione o Seguinte \/
<talkaction log="yes" words="/addnews" access="3" event="script" value="addnews.lua"/>
<talkaction words="!new" event="script" value="news.lua"/>
E dai abra a pasta SCRIPTS .. copie qualquer script e renomeie para addnews
Abra o script.. apague td o que tiver la dentro e adicione o seguinte..
function onSay(cid, words, param, channel)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return TRUE
end
local file = io.open("news.txt", "w+")
file:write("\n ### SERVER NEWS ###\n - ".. os.date("%d / %B / %Y - %X ", os.time()) .."-\n\n--> "..param.."\n\n### POSTED BY " .. getPlayerName(cid) .." ###\n")
file:close()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "NEWS ADDED!\n ".. param .."")
return TRUE
end
Dai copie qualquer otro script e renomeie para "news" .. (sem as aspas)..
Abra o script e adicione o seguinte..
function onSay(cid, words, param, channel)
local file = io.open('news.txt','r')
doPlayerSendTextMessage(cid, TALKTYPE_BROADCAST, file:read(-1))
file:close()
return TRUE
end
Pronto .. Agora Va Até globalevents -> GlobalEvents.xml e Adicione o Seguinte ..
<globalevent name="news" interval="4000" event="script" value="autonews.lua"/>
Dai abra a pasta scripts .. copie qualquer script e renomeie para autonews
Dai abra e apague tudo oque tiver la dentro e coloque o seguinte
function onThink(interval, lastExecution)
local file = io.open('news.txt','r')
for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
doPlayerSendTextMessage(player, TALKTYPE_BROADCAST, file:read(-1))
end
file:close()
return TRUE
end
Pronto .. Salve Tudo e REABRA seu ot .. ou de reload no que voce usou .. no caso ->
/reload talkactions
E
/reload globalevents
dai entre no teu ot e escreva .. ->
/addnews
Por Exemplo..
/addnews Seja Bem Vindo Ao Ot.Bom Jogo.
E para o Player Saber A Mensagem que o GOD mandou é só escrever o seguinte ->
!new
Pronto .. Obrigado Se Funcionou e tudo .. se nao funcionou eu arrumarei Thx.
E se eu postei em lugar errado .. me desculpe =D
Até o Proximo Post .. ou melhor Proximo Script