PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Casanova82 on 09 April, 2005, 12:10:28

Title: Clean Chat
Post by: Casanova82 on 09 April, 2005, 12:10:28
--ScreenCleaner.lua 1.1 by yepyepyep4711 and Hawk
--!cls will wipe the main chat clean (does that remind you of something? ;) )
--the command will be added to the rightclick menu of the OPs (optional)



botname = "ScreenCleaner"

rightclick = 0 -- if anything else than 1 rightclick menu won't appear

function DataArrival (curUser, sData)
command=strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind(command,"%b<>%s+(%S+)")
   if curUser.bOperator then
      if cmd=="!cls" then
         temp = "\r\n"
         for i=1,200,1 do
            temp = temp.."\r\n"
         end
         SendToAll(botname, temp)
      end
   end
end



function OpConnected(curUser)
   if rightclick == 1 then
      curUser:SendData("$UserCommand 255 7")
      curUser:SendData("$UserCommand 0 3")
      curUser:SendData("$UserCommand 1 2 Clear Screen$<%[mynick]> !cls|")
   end
end



Could someone translate it in Lua5? ?(
Title:
Post by: jiten on 09 April, 2005, 12:31:11
Try this one:

-- made by yepyepyep4711 and Hawk
-- converted to Lua 5 by jiten

botname = "ScreenCleaner"

rightclick = 0 -- if anything else than 1 rightclick menu won't appear

function ChatArrival (curUser, sData)
command=string.sub(sData,1,string.len(sData)-1)
s,e,cmd = string.find(command,"%b<>%s+(%S+)")
if curUser.bOperator then
if cmd=="!cls" then
temp = "\r\n"
for i=1,200,1 do
temp = temp.."\r\n"
end
SendToAll(botname, temp)
return 1
end
end
end



function OpConnected(curUser)
if rightclick == 1 then
curUser:SendData("$UserCommand 255 7")
curUser:SendData("$UserCommand 0 3")
curUser:SendData("$UserCommand 1 2 Clear Screen$<%[mynick]> !cls|")
end
end

Cheers
Title:
Post by: Herodes on 09 April, 2005, 12:44:55
Try this one... Couldn't resist...-- made by ??
-- converted to Lua 5 by jiten
--- touched by Herodes

rightclick = 0 -- if anything else than 1 rightclick menu won't appear

function ChatArrival (curUser, sData)
if curUser.bOperator then
local s,e,cmd = string.find(string.sub( sData, 1, -2 ),"%b<>%s+(%S+)")
if (cmd=="!cls") then
SendToAll( string.rep( "\r\n", 200) )
return 1
end
end
end

function OpConnected(curUser)
if ( (rightclick == 1) and user.bUserCommand) then
curUser:SendData("$UserCommand 255 7")
curUser:SendData("$UserCommand 0 3")
curUser:SendData("$UserCommand 1 2 Clear Screen$<%[mynick]> !cls|")
end
end
Title:
Post by: Casanova82 on 09 April, 2005, 13:14:14
Thanks :D

How can add a string with some words?
Title:
Post by: kepp on 09 April, 2005, 21:42:59
What's wrong with clients /clear command?
Title:
Post by: Madman on 09 April, 2005, 22:16:20
QuoteOriginally posted by kepp
What's wrong with clients /clear command?

it's only clear your screen....the scripts cleans everybodys...
Title:
Post by: kepp on 09 April, 2005, 22:30:50
Bad configured bot sending out junk messages to often to all users??
Title:
Post by: jiten on 09 April, 2005, 22:32:38
QuoteOriginally posted by kepp
What's wrong with clients /clear command?

Yups, for example, in case the main chat is flooded with unnecessary messages/pub, cleans everyone's window.
Title:
Post by: bastya_elvtars on 10 April, 2005, 12:49:55
QuoteOriginally posted by jiten -- made by ??

yepyepyep4711 and Hawk
Title:
Post by: jiten on 10 April, 2005, 17:45:40
QuoteOriginally posted by bastya_elvtars
QuoteOriginally posted by jiten -- made by ??

yepyepyep4711 and Hawk

Roger that  :]
My post updated.