mm for all users including offline - Page 2
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

mm for all users including offline

Started by bsalsa, 27 January, 2004, 15:35:12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bsalsa

finely it works

!msg


code:--------------------------------------------------------------------------------messages = dofile("messages.dat") or {}

function NewUserConnected(user)
   local tmp = messages[user.sName]
   if tmp then
      local n = getn(tmp)
      user:SendData(">> "..n.." messages for you..")
      for i = 1, getn(tmp) do
         user:SendData(">> "..tmp[1]..": "..tmp[2])
      end
      messages[user.sName] = nil
      savemessages()
   end
end

OpConnected = NewUserConnected

function DataArrival(user, data)
   if strsub(data, 1, 1) == "<" then
      local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s?(.*)|$")
      if s then
         cmd = strlower(cmd)
         if cmd == "msg" then
            local s, e, nick, msg = strfind(args, "(%S+)%s?(.*)")
            if s then
               local tmp = GetItemByName(nick)
               if tmp then
                  tmp:SendData(">> "..user.sName..": "..msg)
                  user:SendData(">> "..nick.." is online he/she got your message")
               else
                  messages[nick] = messages[nick] or {}
                  tinsert(messages[nick], { user.sName, msg })
                  user:SendData(">> message saved")
                  savemessages()
               end
            else
               user:SendData(">> syntax: !msg ")
            end; return 1
         end
      end
   end
end

function savemessages()
   local f = openfile("messages.dat", "w+")
   assert(f, "messages.dat")
   write(f, "return {\n")
   for nick, table in messages do
      write(f, "\t"..format("[%q]", nick).." = {\n")
      for i = 1, getn(table) do write(f, "\t\t{ "..format("%q", table[1])..", "..format("%q", table[2]).."},\n") end
      write(f, "\t},\n")
   end write(f, "}") closefile(f)
end--------------------------------------------------------------------------------

how can i change it for :
1 send the offline message  as a pm ?
2 an option to send mm to all users together (user that are online and offline) and that will send the message imidietly the the online user and will store it for the offline users and will post them as sooon as they connects
thanks

SMF spam blocked by CleanTalk