PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Snoris on 22 December, 2003, 20:29:28

Title: A little change
Post by: Snoris on 22 December, 2003, 20:29:28
Is it possible to make this script to show the information for ONLY user.iProfile-1 (Regular user)

-- Timer bot by piglja - 25/04/03  |  Nooblike mod by GoldMember - 30/04/03

-- Editable (start)
botname = "Info"
minutes = 25
file1 = "timer/adress.txt"
file2 = "timer/any.txt"
file3 = "timer/50GB.txt"

-- Editable (end)

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
  elseif countmin=="2" then
    local handle = openfile(file3, "r")
    if (handle ~= nil) then
      local line = read(handle)
      while line do
        SendToAll(botname,line)
        line = read(handle)
      end
    end
    closefile(handle)
    countmin = "0"
  end
end

Is there ANY1 who can help me with this little change in this script??I know its almost everyones holiday and all but maybe there is someone who can help me anyway
Title: Please?
Post by: Snoris on 28 December, 2003, 10:35:41
No one who can help me with this??

Its no hurry but an answer at least if there is anyone who can fix this....:]
Title:
Post by: BlazeXxX on 28 December, 2003, 16:58:24
It goes something like this in ur script, but since i am not an expert in lua.. i think instead of  SendToAll(botname,line) i need something like SendTo:user.iProfile = -1  ???

 local line = read(handle)
      while line do
      if user.iProfile == -1 then
      SendToAll(botname,line)
      line = read(handle)
      end
     end
     closefile(handle)
      countmin = "1"

If i am on the right track, someone tell me how to send the msg to a specific profile? I will be able to help snoris , if someone guides me on this little doubt..
Title:
Post by: plop on 29 December, 2003, 00:14:06
easyest is 2 store all users with that level in a table, when they enter you push them in and when they leave you remove them.
now all you have 2 do on sending the msg is 2 go thru all the users in the table with:

SendToNick(nick, data) - Sends data to specified nick. If the nick is not online then it's ignored
  nick - a nickname of user you want to send data to
  data - string to send

or for pm:

SendPmToNick(to, from, data) - Sends a private message to given nick
  to - nickname you want to send the PM to
  from - who's sending the message ?
  data - string to send

plop
Title: Thx =]
Post by: Snoris on 06 January, 2004, 21:40:44
Sorry for the late reply and thx u guys for helping me out with this...Gonna sit down and try it out....BOTH of them ;)