Author Topic: Clean Mainchat For the new API  (Read 3219 times)

0 Members and 1 Guest are viewing this topic.

Offline HillyBilly

  • Scripter
  • Member
  • ******
  • Posts: 47
  • Karma: +4/-0
Clean Mainchat For the new API
« on: 29 September, 2007, 01:14:23 »
Code: [Select]
--[[
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
[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 = "\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

Cheers HB

PtokaX forum

Clean Mainchat For the new API
« on: 29 September, 2007, 01:14:23 »

Offline influxor

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Clean Mainchat For the new API
« Reply #1 on: 01 October, 2007, 14:53:30 »
Quote
Hi hillybilly,
Could u plzz add a profile table so as to give permission or not.

i get error:

Quote
[07:04] Syntax ...\PtokaX 0.3.6.0\scripts\acleanchat.lua:32: attempt to concatenate field 'sNick' (a nil value)
« Last Edit: 01 October, 2007, 15:09:18 by influxor »

Offline Rincewind

  • Scripter
  • Lord
  • ******
  • Posts: 403
  • Karma: +60/-7
    • Rincewind's Scripts
Re: Clean Mainchat For the new API
« Reply #2 on: 01 October, 2007, 15:51:09 »
That error sounds like you are using the pre-3.6.0d PtokaX which uses the old Lua API.

If you are then you need to either upgrade your PX to use this script as is, or change User.sNick to User.sName.

PtokaX forum

Re: Clean Mainchat For the new API
« Reply #2 on: 01 October, 2007, 15:51:09 »