Code Board
 

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

Code Board

Started by plop, 29 April, 2004, 22:43:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

plop

i made this script for my own hub so posting codes doesn't mess up the chat.
but a couple ppl allready asked for it so lets make it avail for everybody.
simple but effective.
-- code board by plop
-- made for my own hub to seperate chat from code

Bot = "Code_Board"

function Main() 
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if(strsub(data, 1, 4) == "$To:") then
      local s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if whoTo == Bot then 
         data=strsub(data,1,strlen(data)-1) 
         local s,e,text = strfind(data, "%$%b<>(.*)")
         if text ~= "" then
            local line = "\r\nCode by: "..user.sName.."\r\n--------------------------------------------------------------------------------------------------------------------------------\r\n"
            line = line..text.."\r\n--------------------------------------------------------------------------------------------------------------------------------\r\n"
            SendPmToAll(Bot, line.."|")
         end
      end
   end
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

bastya_elvtars

Can it b done that it ignores away messages? I use it for important info purposes ---> having full of away messages kinda annoying :)
Everything could have been anything else and it would have just as much meaning.

[NL]trucker

Plop

could you make it also so that it doesnt show that what you have typed 2x?

now it shows that what you,ve typed above the lines and it shows the same message between the lines.

and yes i know the only one who sees 2x the messages is the one who typed it but it is annoying.

and taking up space.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


plop

both requests added.
but truckers request has a bad side effect, takes a bit more resources.
the result is good tho and thats what mathers.
-- code board V2 by plop
-- made for my own hub to seperate chat from code
-- doesn't repeat to the sender anymore
-- added away filter

Bot = "Code_Board"
tUsers = {}

function Main() 
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if tUsers[user.sName] == nil then
      tUsers[user.sName] = 1
   end
   if(strsub(data, 1, 4) == "$To:") then
      local s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if whoTo == Bot then 
         data=strsub(data,1,strlen(data)-1) 
         local s,e,text = strfind(data, "%$%b<>(.*)")
         if text ~= "" then
            local s,e,awayvip = strfind(text, "(%b<>)%s*$")
            if awayvip ~= nil then
               s,e,awayvip = strfind(awayvip, "(DC)")
            end
            if awayvip == nil then----
               local curUser
               local line = "\r\nCode by: "..user.sName.."\r\n"..date().."\r\n--------------------------------------------------------------------------------------------------------------------------------\r\n"
               line = line..text.."\r\n--------------------------------------------------------------------------------------------------------------------------------\r\n|"
               for a,b in tUsers do
                  curUser = GetItemByName(a)
                  if curUser and (a ~= user.sName) then
                     curUser:SendPM(Bot, line)
                  else
                     tUsers[a] = nil
                  end
               end
            end
         end
      end
   end
end

function OpConnected(user)
   if tUsers[user.sName] == nil then
      tUsers[user.sName] = 1
   end
end

NewUserConnected = OpConnected

function OpDisconnected(user)
   if tUsers[user.sName] then
      tUsers[user.sName] = nil
   end
end

UserDisconnected = OpDisconnected
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[NL]trucker

thnx plop for quick reply.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


SMF spam blocked by CleanTalk