PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Finished Scripts => Topic started by: HillyBilly on 29 September, 2007, 01:14:23

Title: Clean Mainchat For the new API
Post by: HillyBilly on 29 September, 2007, 01:14:23
--[[
For new API

HillyBilly 26 sept 07

Took some bits and parts from
CrazyGuy and Mutor 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
Title: Re: Clean Mainchat For the new API
Post by: influxor on 01 October, 2007, 14:53:30
QuoteHi 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)
Title: Re: Clean Mainchat For the new API
Post by: Rincewind 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.