PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: witch on 12 August, 2004, 12:10:02

Title: PM to unregs
Post by: witch on 12 August, 2004, 12:10:02
Hi guys!
Looking for script that send text file every 5 min to unregs in PM.

Thanx in advince  :))
Title:
Post by: Herodes on 12 August, 2004, 12:38:41
It is clear that you havent used the search tool ... try that ... there are many around ...
Title:
Post by: witch on 12 August, 2004, 13:57:32
Well Mr. Herodes just to let u know.....i always do use a search tool before i post something here. It is some scripts on the board, but not what i need.

Also insted to tell me about search tool will be more clever from u to link me there if u know it...but if u prefere just to say something on people posts.......he he be my guest....lol

Greetings to Greece  :))
Title:
Post by: Herodes on 12 August, 2004, 14:14:43
there you go ... --- Periodical PMs to unregs   ?   requested by witch
--- by Herodes ?   13-8-2004

botsName = "SmartAss" --- Change this to whatever u want
TxtFile = "unregfile.txt" --- be sure to have a file corresponding to this one in the 'scripts'
thecmd = "!pmunregs" --- change this to whatever u want ...

secs = 1000
mins = 60*secs
timerinterval = 5*mins --- I hope this is clear enough ...

function Main()
tUnregUsers = {n=0}; --- don't touch this one ...
frmHub:UnregBot(botsName) --- Unreg the Bot from the NickList, ( using the string defined by the ' botsName ' value )
frmHub:RegBot(botsName) --- and Register it again ... ( using the string defined by the ' botsName ' value, again )
SetTimer(timerinterval)
StartTimer()
end

function OnTimer()
for index, nick in tUnregUsers do
SendPmToNick(nick, botsName, ReadTextFile(TxtFile))
end
end

function NewUserConnected(user)
if user.iProfile == -1 then
tinsert(tUnregUsers, (getn(tUnregUsers)+1), user.sName)
end
end

function UserDiconnected(user)
if user.sName == tUnregUsers then
tremove(tUnregUsers, user.sName)
end
end

function DataArrival(user, data)
if ( ( strsub(data, 1, 1) == "<" ) and user.bOperator )then
data = strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
if ( cmd == thecmd ) then
if getn(tUnregUsers) >= 25 then
user:SendPM(botsName, getn(tUnregUsers).." users have been notified.")
else
user:SendPM(botsName, "The following users have been notified : ")
for i = 1, getn(tUnregUsers) do
user:SendPM(botsName, "\t"..tUnregUsers[i])
end
end
for index, nick in tUnregUsers do
if nick == user.sName then
else SendPmToNick(nick, botsName, ReadTextFile(TxtFile))
end
end
end
end
end

function ReadTextFile(file)
local message = "\r\n"
readfrom(file, "r")
while 1 do
local line = read()
if ( line == nil ) then break
else message = message.."\t"..line.."\r\n"
end
end
readfrom()
return message
end

Next time dont be a smartass (first time)... I found 1 of my scripts in this forum, in this section  and all I changed was 10 lines ...

You have been here for a while and instead of being a smartass (second time) you could have spend some thinking like everybody else in this forum ...

Greetings received and returned :)

PS: Ooh and it is definately not about knowing how to write lua ... it is just thinking .. trust me..
Title:
Post by: witch on 12 August, 2004, 14:46:16
Syntax error: `end' expected (to close `if' at line 132);
  last token read: `elsemessage' at line 134 in file `D:\PtokaX\NEW\scripts\PMtoUnregs.lua'

Thanx in advince
Title:
Post by: Herodes on 12 August, 2004, 14:52:35
edited above post ... grab again should be ok now ...
Title:
Post by: witch on 12 August, 2004, 15:35:37
Works fine on timer dude! But on cmd shows report that only one user receeve massage...

why is that?
Title:
Post by: witch on 12 August, 2004, 17:01:00
DUDE!!!!!
I was too quick with answer....this script sends message in pm's to all users, unregs, regs. vip's even op's!!! That's sux man!!!! And i hope that was misstake... Please correct it!!!

Thanx
Title:
Post by: Herodes on 12 August, 2004, 17:13:16
No I wont ... sorry it didn't work out ... I got better things to do than waste my time with someone that doesn't talk nice to me ... :(
Title:
Post by: witch on 12 August, 2004, 17:17:04
well i was do my best be pation with u..... but as u wish Mr. Herodes