Hello again!
a need a little scripts...
just like a TimeBot but
shows in main
with time and reads from a
textfil in dir.
a have ones before but lose it some where :(
Thx.... Janyn
start here >>>>>> click here (http://board.univ-angers.fr/thread.php?threadid=44&boardid=4&styleid=1&sid=4b7748f53b03fd8283dde54bdf3f909e)
that's wrong script sorry :(
the scrits say's like that every hour.....
I have every old board user ICQ. MSN,Yahoo number... But there are 2k+ users...
I will start doing mass spam to all of them tomorow evening:)
// Janyn
look at the HOW:TO's by me
there you will find out how to
and how to write them urself
--// Announcer Bot v1.5 ----------------------------------------------------
-- by: gg3k
-- bugfix and improvements by: bonki
-- file: announcer.lua
-- Thanks to: Ptaczek for making the great hubsoft, all the people at the lua forum for helping out when needed. :)
-- // Configure below
--
-- Enter the name of the announcer here. Set to nil for alternate (***) layout.
-- ex. BotName = "Hub-hostess"
BotName = "[?]erminator?"
HubOwner = "[?]DarkCrash?"
HubCoOwner = ""
--// Timer related configuration ------
-- The number of minutes between each sent timer message.
MessageDelay = 60
-- Use the Timed message feature (0 = no, 1 = yes)
UseTimer = 1
-- How to send the private onjoin messages
-- "pm" = Send in PM.
-- "main" = Send in main (privately).
privatemode = "main"
-- These values will prevent users from getting flooded with repeated messages over time.
-- all numbers refers to number of events that has to have taken place since the last message
-- round before the bot sends the messages from start. Either of the two events will trigger a resending.
-- (0 = disable)
MinChat = 0 -- minimum number of chatlines+announced.
MinUserConnect = 0 -- minimum number of new user connections (unannounced+announced).
-- Enter the profile name of any profile that should invoke a message, and the message to be sent below.
-- If you don't want a message, simply don't add one for that particular profile. :)
-- Example: ["profile name"] = "message",
--
-- You can send a private onjoin message to users in a specific profile by putting ! before the profile name.
-- Example: ["!master"] = "Hi [user], your ip is [userip], there are [usercount] users online.",
--
-- To set a connection/disconnection message for a specific user put a $ before the nickname.
-- Example: ["$user"] = "The amazing [user] has entered the hub.",
--
-- To disable connection/disconnection message for a specific user, set the message to @.
-- Example: ["$user"] = "@",
--
-- To send a custom message to the connecting user (privately), put $pm$ before the nickname.
-- Example: ["$pm$user"] = "Hi [user], Your IP is [userip]",
--
-- These only work on connect/disconnect messages.
-- [user] = the name of connecting user (this will not work on the time messages).
-- [userdesc] = Description of connecting user (exluding a possible tag).
-- [userspeed] = Speed of the connecting user.
-- [useremail] = E-mail of connecting user.
-- [usershare.xx.y] = Share of connecting user. (where 'xx' is the displayed unit. may be
-- bb for bytes (no .y in this case!
-- mb for megabytes
-- gb for gigabytes
-- tb for terabytes
-- pb for petabytes.
-- 'y' digits after the decimal point)
-- E.g.: [usershare.bb], [usershare.gb.3] aso.
-- [userip] = IP of connecting user.
--
-- These work on both connect/disconnect and times messages.
-- [hubname] = name of the hub.
-- [hubowner] = owner of the hub.
-- [usercount] = current number of users.
-- [totalshare.xx.y] = total amount of share. see [usershare.xx.y] above for further details.
-- [minshare] = minimum share in hub (GB).
-- [maxusers] = maximum number of users.
-- [crlf] = new line.
--
-- unreg$ is a special profile for all unregistered users.
-- I don't recommend using it for public announcement of all connecting users.
-- Try it and you'll see what i mean. :)
-- Connecting users/profiles.
iprofiles = {
["user"] = "Ciao [user], come butta?",
["user"] = "[user], il tuo IP ? [userip], ci sono [usercount] users online.",
["user"] = "Stai attualmente sharando [usershare.gb.y] GgigaBytes.",
}
-- Disconnecting users/profiles.
oprofiles = {
}
-- Timed messages, add as many as you want, it will rotate in sequence.
-- To read from a file type file: as message. Example: [1] = "file:message.txt",
-- The filename is case sensitive, so take care when typing. Put the textfile in the scripts dir.
-- The [] replacements works on the contents of the text file too.
tmessages = {
[1] = "file:rules.txt",
}
-- End of configuration
profileNr = { }
count = {
chat = 0,
connected = 0,
startdate = date(),
}
--// This function is fired at the serving start
function Main()
setlocale("swe")
if BotName == nil then
layout = "*** "
else
layout = "<"..BotName.."> "
end
SetTimer(MessageDelay*60000)
if UseTimer == 1 then
StartTimer()
end
end
--// This function is fired when a new data arrives
function DataArrival(curUser, sData)
if strsub(sData, 1, 1) == "<" then
count.chat = count.chat + 1
end
end
--// This function is fired when a new user finishes the login
function NewUserConnected(curUser)
getmessages(curUser, "in")
end
--// This function is fired when an operator enters the hub
function OpConnected(curUser)
getmessages(curUser, "in")
end
--// This function is fired when an user disconnects
function UserDisconnected(curUser)
getmessages(curUser, "out")
end
--// This function is fired when an operator disconnects
function OpDisconnected(curUser)
getmessages(curUser, "out")
end
function OnTimer()
if timetag == nil then
timetag = 0
count.chat = MinChat
count.connected = MinUserConnect
end
timetag = timetag + 1
if timetag == 1 then
if MinChat > 0 then
reset = 0
if count.chat < MinChat then
timetag = 0
local reset = 0
else
count.chat = 0
count.connected = 0
local reset = 1
end
end
if MinUserConnect > 0 and reset == 0 then
if count.connected < MinUserConnect then
timetag = 0
else
count.chat = 0
count.connected = 0
end
end
end
if tmessages[timetag] then
message = tmessages[timetag]
if strsub(message, 1, 5)=="file:" then
local filename = strsub(message, 6, strlen(message))
readfrom(filename)
local message = ""
while 1 do
local line = read()
if line == nil then break
else
message = message..line.."\r\n"
end
end
announce(BotName, message)
readfrom()
else
announce(BotName, message)
end
else
timetag = 0
end
end
--// Help functions ----------------------------------------------------
function announce(user, string)
local arrTmp = substitute(user, string)
SendToAll(layout..arrTmp)
end
function pm(user, string)
local arrTmp = substitute(user, string)
if privatemode == "pm" then
user:SendPM(BotName, arrTmp)
elseif privatemode == "main" then
user:SendData(layout..arrTmp)
end
end
function substitute(user, string)
local arrTmp = gsub(string, "%[usercount%]", frmHub:GetUsersCount())
arrTmp = gsub(arrTmp, "%[maxusers%]", frmHub:GetMaxUsers())
arrTmp = FormatSize(arrTmp, "totalshare", frmHub:GetCurrentShareAmount());
arrTmp = gsub(arrTmp, "%[minshare%]", frmHub:GetMinShare()/1024)
arrTmp = gsub(arrTmp, "%[hubname%]", frmHub:GetHubName())
arrTmp = gsub(arrTmp, "%[hubowner%]", HubOwner)
arrTmp = gsub(arrTmp, "%[crlf%]", "\r\n")
if type(user) == "table" then
local myinfo = user.sMyInfoString
local _, _, desc, speed, email, sharesize = strfind(myinfo, "$ALL %S+ (.*)%$ %$(.+)%$(.*)%$(%d+)%$");
if (desc and strfind(desc, "(.+)%b<>")) then
desc = gsub(desc, "(.+)%b<>", "%1");
else
desc = "none";
end
if (speed == nil or strlen(speed) == 0) then speed = "none" end;
if (email == nil or strlen(email) == 0) then email = "none"; end;
if (sharesize == nil) then sharesize = 0; end;
arrTmp = gsub(arrTmp, "%[user%]", user.sName)
arrTmp = gsub(arrTmp, "%[userdesc%]", desc)
arrTmp = gsub(arrTmp, "%[userspeed%]", strsub(speed, 1, strlen(speed)-1))
arrTmp = gsub(arrTmp, "%[useremail%]", email)
arrTmp = FormatSize(arrTmp, "usershare", tonumber(sharesize));
arrTmp = gsub(arrTmp, "%[userip%]", user.sIP)
end
return arrTmp
end
function getmessages(user, io)
local userprofile = GetProfileName(user.iProfile)
if user.iProfile == -1 then
userprofile = "unreg$"
end
if userprofile == nil then userprofile = "qwertyuiopasdfghjkl" end
if io == "in" then
if iprofiles["$"..user.sName] then
if iprofiles["$"..user.sName] ~= "@" then
announce(user, iprofiles["$"..user.sName])
count.chat = count.chat + 1
else
count.connected = count.connected + 1
end
elseif iprofiles[userprofile] then
announce(user, iprofiles[userprofile])
count.chat = count.chat + 1
else
count.connected = count.connected + 1
end
if iprofiles["$pm$"..user.sName] then
pm(user, iprofiles["$pm$"..user.sName])
end
if iprofiles["!"..userprofile] then
pm(user, iprofiles["!"..userprofile])
end
else
if oprofiles["$"..user.sName] then
if oprofiles["$"..user.sName] ~= "@" then
announce(user, oprofiles["$"..user.sName])
count.chat = count.chat + 1
end
elseif oprofiles[userprofile] then
announce(user, oprofiles[userprofile])
count.chat = count.chat + 1
end
end
end
function FormatSize(sString, sTag, iVal)
assert(type(sString) == "string", "FormatSize(): bad argument #1 (string expected)");
assert(type(iVal) == "number", "FormatSize(): bad argument #2 (numerical value expected)");
local _, _, sFormat = strfind(sString, "%["..sTag.."%.[mgtp]b(%.%d+)%]");
if (sFormat) then
sFormat = "%"..sFormat.."f";
sString = gsub(sString, "%["..sTag.."%.mb%.%d+%]", format(sFormat, toMB(iVal)).." MB");
sString = gsub(sString, "%["..sTag.."%.gb%.%d+%]", format(sFormat, toGB(iVal)).." GB");
sString = gsub(sString, "%["..sTag.."%.tb%.%d+%]", format(sFormat, toTB(iVal)).." TB");
sString = gsub(sString, "%["..sTag.."%.pb%.%d+%]", format(sFormat, toPB(iVal)).." PB");
else
sString = gsub(sString, "%["..sTag.."%.bb%]", iVal.." B");
end
return sString;
end -- bonki
function toMB(bytes)
return (bytes / 1024 / 1024);
end
function toGB(bytes)
return (bytes / 1024 / 1024 / 1024);
end
function toTB(bytes)
return (bytes / 1024 / 1024 / 1024 / 1024);
end
function toPB(bytes)
return (bytes / 1024 / 1024 / 1024 / 1024 / 1024);
end
Just change [1] = "file:rules.txt",
Only one funktions and that most reads right, cut off the line like::
**************
This is a script
**************
my info....
**************
no like:
**************This is a script************** my info....**************
// Jenyn
-- Timed messages, add as many as you want, it will rotate in sequence.
-- To read from a file type file: as message. Example: [1] = "file:message.txt",
-- The filename is case sensitive, so take care when typing. Put the textfile in the scripts dir.
-- The [] replacements works on the contents of the text file too.
tmessages = {
[1] = "file:rules.txt",
}
Just the change the lines like:
tmessages = {
[1] = "file:rules.txt",
For read a txt in the /scripts folder
Or
tmessages = {
[1] = "text&functions",
For write a Text but for each lines change [1] in [2] or [3]
;)
//bye
bot = "Reminder"
mins = 2
file = "reminder.txt"
function Main()
SetTimer(mins*60000)
StartTimer()
end
function OnTimer()
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
SendToAll(bot,line)
line = read(handle)
end
closefile(handle)
end
end
// Janyn