Greetz ..
So far still using lua 4... need upgrading also...
I'm looking for some code to assist me in the removal of muppets from my hub.
I have a number of rules that are constantly being infringed, and am getting a little peeved trying to remember who and what I pm, so I want to take the work out of the job.
What I want is to send a PM to the offending user stating what rules have been broken and telling them they have 10 mins to reply to me or I will kick them automatically.
Once I send the PM the clock starts ticking for that user, if the alarm is not cancelled 10 mins later the user is to be auto kicked for the rules listed.
If the OP gets a reply he can cancel the timer on the user.
I'm thinking that if the user and timestamp were entered into either a table or file and compared to current time it could determine if user was to be rebooted -
I also run a number of timers so I do not want to use Start/Stop timer. What I have so far is a bit mish/mash..
Rightclick commands
==============
user:SendData("$UserCommand 1 6 Warn\\PM warning ON$<%[mynick]> !pmwarnon %[nick] %[line:Enter rule numbers]|")
user:SendData("$UserCommand 1 6 Warn\\PM warning OFF$<%[mynick]> !pmwarnoff %[nick]|")
function Main()
frmHub:RegBot("Smeag")
LoadFromFile(fUser)
frmHub:EnableSearchData(1)
loadchat()
for name, users in bots do
frmHub:RegBot(name)
end
SendToAll(BOTNameInfo)
botLen = strlen( BOTName )
RegTimer(CheckShare, 10*Min)
-- RegTimer(LocalTimer, 1*Min)
SetTimer(TmrFreq)
StartTimer()
end
Existing Timer functions
================
function RegTimer(f, Interval)
local tmpTrig = Interval / TmrFreq
assert(Interval >= TmrFreq , "RegTimer(): Please Adjust TmrFreq")
local Timer = {n=0}
Timer.func=f
Timer.trig=tmpTrig
Timer.count=1
tinsert(tabTimers, Timer)
end
function LocalTimer()
frmHub:UnregBot(startchrs ..current ..endchrs)
time = date("%H:%M")
current = time
frmHub:RegBot(startchrs ..current ..endchrs)
end
function OnTimer()
for i=1, getn(tabTimers) do
tabTimers[i].count = tabTimers[i].count + 1
if tabTimers[i].count > tabTimers[i].trig then
tabTimers[i].count=1
tabTimers[i]:func()
end
end
end
Part of DataArrival
=============
elseif (cmd == prefix.."pmwarnon") then
local s,e,nick,message = strfind( data, "%b<>%s+%S+%s+(%S+)%s*(.*)" )
local vUser = GetItemByName(nick)
if message == "" then
user:SendPM(BOTName,"Please supply rules")
elseif user.iProfile == 0 or user.iProfile == 1 or user.iProfile == 4 then
vUser:SendPM(user.sName,"You are violating rules "..message..", if you haven't answered this message within the next 10 min, you will be kicked automatically")
return 1
end
Any Help is appreciated..
Even just the compare timer function would be a great help... think am gonna create a table with
user.sName,
time (HH:MM)
Ban or Kick
and Reason/Rule Broken
Many thanks in advance
Stravides ..