i have an idea...
script that shows how many users connected to the hub
every IP = 1 in the entery list
+entery
last 24 hoers: 2500 enterys
sins script start enterys: 5000
:D
can it be made???
Hi,
Here you go...
--## IP ENTRY BOT
--## Requested by D-J Valhala
--## Made by nErBoS
--## Commands:
--## +entry - Shows all the entry status of IP
sBot = "IE-Bot"
arrIPEntry = {
["TOTAL"] = 0,
}
fIPEntry = "ipentry.dat"
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(sBot)
LoadFromFile(fIPEntry)
end
function OnExit()
SaveToFile(fIPEntry , arrIPEntry , "arrIPEntry")
end
function NewUserConnected(user)
if (arrIPEntry[GetTime()] == nil) then
CleanAndRefresh()
arrIPEntry[GetTime()] = {}
if (uLaterPtokax == 1) then
OnExit()
end
end
if (arrIPEntry[GetTime()][user.sIP] == nil) then
arrIPEntry[GetTime()][user.sIP] = 1
arrIPEntry["TOTAL"] = arrIPEntry["TOTAL"] + 1
if (uLaterPtokax == 1) then
OnExit()
end
end
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "+entry") then
local sTmp = "\r\n\r\n\t\t--## IP Entries of the HUB ##--\r\n\r\n"
if (arrIPEntry[GetTime()] == nil) then
CleanAndRefresh()
arrIPEntry[GetTime()] = {}
end
sTmp = sTmp.."\t--## Today IP entries: "..GetCount(arrIPEntry[GetTime()]).."\r\n"
sTmp = sTmp.."\t--## IP entries from all time: "..arrIPEntry["TOTAL"].."\r\n"
user:SendPM(sBot, sTmp)
return 1
end
end
end
function GetTime()
local day,month,year = date("%d"),date("%m"),date("%y")
return day.."/"..month.."/20"..year
end
function CleanAndRefresh()
local aux,date
for date, aux in arrIPEntry do
if (date ~= "TOTAL") then
arrIPEntry[date] = nil
end
end
end
function GetCount(table)
local count,aux,index = 0
for index, aux in table do
count = count + 1
end
return count
end
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
I still have one script to do to you, will do it as soon as i can :D
Best regards, nErBoS
work good but whan i restart the scripts it wont save...
and about the other script... take your time m8 :D
Hi,
Yes i have forgot to put the configuration part to TD and older version of ptokax. Fixed in the script above.
Best regards, nErBoS
steel no save...
[11:51] +entry
[11:52] <-PsYiBot->
===============================
U s e r s E n t r i e s o f t h e H u b:
===============================
Total entries In Lest 24 Hours: 598
Total entries: 991
[11:59] <-PsYiBot->
===============================
U s e r s E n t r i e s o f t h e H u b:
===============================
Total entries In Lest 24 Hours: 2
Total entries: 2
[12:00] <-PsYiBot->
===============================
U s e r s E n t r i e s o f t h e H u b:
===============================
Total entries In Lest 24 Hours: 0
Total entries: 0