PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Help with scripts => Topic started by: malhi on 12 January, 2015, 14:58:00

Title: Clean main chat
Post by: malhi on 12 January, 2015, 14:58:00
HI
im using one Cleanmain chat script but it only clean at my end not the all users end, i want when i use command it should clear main chat for all users also not only at my end, how i can do that ? and which script i need to clean main chat ?

please help
Title: Re: Clean main chat
Post by: the-master on 12 January, 2015, 21:57:27
Ptokax script? post it, see what we can do.
Title: Re: Clean main chat
Post by: malhi on 13 January, 2015, 02:04:48
--[[
   For new API
   
   HillyBilly   26 sept 07
   
   Took some bits and parts from
    CrazyGuy and American Idiot Lua 5.1.x and credits to them.
   
   28 sept 07   
   added Cleaners table who may or may not clean.   -   speedX
   
--]]

cmdClean = "cleanmain"
soapwater = 100 -- For more or less soap and water

tCleaners = {
      [-1] = 0,   -- Unreg Users
      
Title: Re: Clean main chat
Post by: the-master on 13 January, 2015, 17:15:34
script is running fine, try less soapwater, perhaps your flooding clients  :(
Title: Re: Clean main chat
Post by: the-master on 13 January, 2015, 18:01:39
Only issue I found was a missing Bot.. some clients send those messages to kickbar, try this:

--[[
   For new API
   
   HillyBilly   26 sept 07
   Added Botname By The-Master 13 jan 2015
   Took some bits and parts from
    CrazyGuy and American Idiot Lua 5.1.x and credits to them.
   
   28 sept 07   
   added Cleaners table who may or may not clean.   -   speedX
   
--]]
Bot = "Whiper"
cmdClean = "cleanmain"
soapwater = 100 -- For more or less soap and water

tCleaners = {
      [-1] = 0,   -- Unreg Users
      [0] = 1,   -- Masters
  [1] = 1,   -- Operators
      [2] = 0,   -- VIPs
      [3] = 0,   -- Regs
}
     
ChatArrival = function(User,Data)
   if tCleaners[User.iProfile] == 1 then
      local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
      if cmd and (cmd == cmdClean) then
         local str = "<"..Bot..">\n\n"..string.rep("\t",3).." "..
            User.sNick.." is clearing Main Chat...  ???"..
            string.rep("\n",soapwater)..string.rep("\t",3).."Main Chat Has "..
            "Been Cleared By: "..User.sNick.."   ???\n\n"
            Core.SendToAll(str)
            return true
         else
            return "Clear Main Chat","",""
         end
      end
   end
Title: Re: Clean main chat
Post by: malhi on 14 January, 2015, 22:44:03
thanks working fine :D
Title: Re: Clean main chat
Post by: Cêñoßy†ê on 07 May, 2015, 21:06:21
Couldnt resist to touch it little :P  here is my version  :yes:

Code (lua) Select
--[[
   For new API
   
   HillyBilly   26 sept 07
   Added Botname By The-Master 13 jan 2015
   Took some bits and parts from
    CrazyGuy and American Idiot Lua 5.1.x and credits to them.
   
   28 sept 07   
   added Cleaners table who may or may not clean.   -   speedX
   
  07.05.2015
  Removed Cleaners table and made it work only for users with key.
  Cleaned code little - Cêñoßy†ê
   
--]]
Bot = "Whiper"
cmdClean = "cleanmain"
soapwater = 1000 -- For more or less soap and water
     
function ChatArrival(user,data)
if Core.GetUserData(user,11) then
local _,_,cmd = data:find("%b<>%s%p(%S+)|")
if cmd and cmd == cmdClean then
local str = "<"..Bot..">\n\n"..string.rep("\t",3).." "..
user.sNick.." is clearing Main Chat..."..
string.rep("\n",soapwater)..string.rep("\t",3).."Main Chat Has "..
"Been Cleaned By: "..user.sNick.."\n\n"
return Core.SendToAll(str),true
end
end
end