How can I let users in the hub post or add things.
 

How can I let users in the hub post or add things.

Started by ChoPPeDuPTeXaS, 23 December, 2004, 03:19:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ChoPPeDuPTeXaS

Im running PtokaX for my hub and i need to have a way that users in the hub can add or post things that ervry user can be able to pull up.  How do I do this or do I need a script for this if so which one?  I was in a hub that used the command +post to add a posting.  Please help thanks.

n1ck

--msgboard.lua, created by amutex 12.01.2003 edited by Mephiska
--thx to nathanos for the fine pm-pasing and Dirtyfinger for tokenizing
botname = "MessageBoard"
TimeSpanInHours = 168
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end
function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end
function Main()
SetTimer(TimeSpanInHours*3600000)
StartTimer()
frmHub:RegBot(botname)
end
function OnTimer()
   a=remove("msgboard.dat")
   SendToAll(botname, "MessageBoard Cleared...")
end
function DataArrival(user, data)
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="+msg") then
arg= GetArgs(data)
local handle=openfile("msgboard.dat","a")
write(handle,date("<"..user.sName.."> wrote @ %m/%d/%Y %T "..arg.."?*******************************************?"))
user:SendPM(botname,"MessageBoard entry saved ....")
SendToAll(botname, "New entry in the messageboard!")
closefile(handle)
end
if (cmd=="+mbhelp") then
   local mbhelp=""
         readfrom("mbhelp.txt")
         while 1 do
            local line = read()
            if (line == nil) then
               break
            else
               mbhelp = mbhelp..line.."\r\n"
            end
         end
         SendPmToNick(user.sName, botname, mbhelp)
         readfrom()
end

if (cmd=="+read") then
   handle2=openfile("msgboard.dat","r")
      if (handle2==nil) then
         else
         line = read(handle2,"*a")
         line=strsub(line,1,strlen(line)-1)
         linearray=tokenize(line,"?")
         for i=1,linearray.n do
         user:SendPM(botname,linearray)
      end
   closefile(handle2)


end
end
end
end
end
------------------------------------------------

That should do it - btw a simple search for 'message board' would have got you this result!
dcuk.direct-connect.co.uk

**compiled bots are like what microsoft is to open source!**

SMF spam blocked by CleanTalk