text in main script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

text in main script

Started by Janyn, 08 November, 2003, 21:35:26

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Janyn

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


pHaTTy

Resistance is futile!

Janyn

No
#2
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

pHaTTy

look at the HOW:TO's by me
there you will find out how to
and how to write them urself
Resistance is futile!

DarkElf


--// 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:<filename> 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 [<data>] 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",
Please sorry my bad english, i'm learning it :-D

\\100Gb ][ MeGaShArE @ I?? - ?u?i?N Owner [/I]
100gb.ifs-fusion.net:666 Only EliTe ShArE min 100gb
-={ I?? - ?u?i?N }=- N??Owner

Janyn

#5
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

DarkElf

-- 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
Please sorry my bad english, i'm learning it :-D

\\100Gb ][ MeGaShArE @ I?? - ?u?i?N Owner [/I]
100gb.ifs-fusion.net:666 Only EliTe ShArE min 100gb
-={ I?? - ?u?i?N }=- N??Owner

Janyn

#7
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

SMF spam blocked by CleanTalk