PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: xfiles on 14 February, 2004, 23:04:05

Title: Need help with this script for Random Messages
Post by: xfiles on 14 February, 2004, 23:04:05
Hello everyone,

is there a scripter out there that can help me with this script?
i?ve changed it a little but it seems not work yet.
it is supposed to send Random Messages from time to time.
can anyone help me with it???



botname = "?RoboCop??"
minutes = 60
file1 = "txt/lusoarenainfo.txt"
file2 = "txt/lusoarenareg.txt"

countmin = "2"

function Main()
SetTimer(minutes*60000)
StartTimer()
end

function OnTimer()
MessageToAll()
end

function MessageToAll()
  if countmin=="0" then
    local handle = openfile(file1, "r")
    if (handle ~= nil) then
      local line = read(handle)
      while line do
        SendToAll(botname,line)
        line = read(handle)
      end
      closefile(handle)
      countmin = "1"
    end
  elseif countmin=="1" then
    local handle = openfile(file2, "r")
    if (handle ~= nil) then
      local line = read(handle)
      while line do
        SendToAll(botname,line)
        line = read(handle)
      end
      closefile(handle)
      countmin = "2"
    end
end
end



Thx guys...
Title:
Post by: nErBoS on 14 February, 2004, 23:37:56
Hi,

the reason why isn't working is because of this...
countmin = "2"
If you take a good look at function MessageToAll you will notice that the functio will only work if countmin is in 1 or 0

Best regards, nErBoS
Title:
Post by: xfiles on 15 February, 2004, 01:17:15
oi nerbos,

obrigado :)
nao notei nisso.
vou experimentar.

thx m8
Title:
Post by: xfiles on 15 February, 2004, 01:26:04
Funciona :))

Thx m8.