need this
 

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

need this

Started by [NL]trucker, 31 October, 2003, 12:38:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[NL]trucker

hello  

if someone could help me with this i would be very gratefull.


i want a script with the following in it on a timer:

hubname
hubdescription
users online
[perhaps min max users]
Operators online
Hub Uptime.

for the hub uptime i want to use this script it just needs a trigger and timer


-- Gets the hubs uptime
-- return: hrs, mns
-- Author: RabidWombat
function GetUpTime()
   local hFile, sFinal = openfile("..\\error.log", "r"), nil

   if (hFile) then
      local line = read(hFile)
      while line do
         if(strsub(line, -15) == "Serving started") then
--            s, e, sFinal = strfind(line, "([^-]+).+")
            sFinal = strsub(line, 1, strlen(line) - 17) -- changed this line because there are '-' in the time, duh
         end
         line = read(hFile)
          end
   
      closefile(hFile)
   
      local StartTime = JulianDate(SplitTimeString(sFinal));
      -- Changed here too to new format
      local EndTime = JulianDate(SplitTimeString(date("%d-%m-%Y %H:%M:%S")));
      local diff =  EndTime - StartTime;
      return floor(diff) * 24 + floor(frac(diff) * 24), floor(frac(frac(diff)*24)*60);
   end

   return 0,0 -- this should NEVER happen
end

-- Split a specific Time string into its components
-- New Format: D-M-Y HR:MN:SC" - 24hr time
-- return: D,M,Y,HR,MN,SC  HR is in 24hr format
function SplitTimeString(TimeString) --
   local s,e,D,M,Y,HR,MN,SC = strfind(TimeString, "([^-]+).([^-]+).(%S+)%s([^:]+).([^:]+).(%S+)");

   D = tonumber(D)
   M = tonumber(M)
   Y = tonumber(Y)
   HR = tonumber(HR)
   MN = tonumber(MN)
   SC = tonumber(SC)

   assert(HR < 24);
   assert(MN < 60);
   assert(SC < 60);

   return D,M,Y,HR,MN,SC
end

function JulianDate(DAY, MONTH, YEAR, HOUR, MINUTE, SECOND) -- HOUR is 24hr format
   local jy, ja, jm;

   assert(YEAR ~= 0);
   assert(YEAR ~= 1582 or MONTH ~= 10 or DAY < 4 or DAY > 15);
   --The dates 5 through 14 October, 1582, do not exist in the Gregorian system!");

   if(YEAR < 0 ) then
      YEAR = YEAR + 1;
   end

   if( MONTH > 2) then
      jy = YEAR;
      jm = MONTH + 1;
   else
      jy = YEAR - 1;
      jm = MONTH + 13;
   end

   local intgr = floor( floor(365.25*jy) + floor(30.6001*jm) + DAY + 1720995 );

   --check for switch to Gregorian calendar
   local gregcal = 15 + 31*( 10 + 12*1582 );
   if(DAY + 31*(MONTH + 12*YEAR) >= gregcal ) then
      ja = floor(0.01*jy);
      intgr = intgr + 2 - ja + floor(0.25*ja);
   end

   --correct for half-day offset

   local dayfrac = HOUR / 24 - 0.5;
   if( dayfrac < 0.0 ) then
      dayfrac = dayfrac + 1.0;
      intgr = intgr - 1;
   end

   --now set the fraction of a day
   local frac = dayfrac + (MINUTE + SECOND/60.0)/60.0/24.0;

   --round to nearest second
   local jd0 = (intgr + frac)*100000;
   local  jd  = floor(jd0);
   if( jd0 - jd > 0.5 ) then jd = jd + 1 end
   return jd/100000;
end

function frac(num)
   return num - floor(num);
end
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


xokas

i have this simple one,maybe can be helpful:



-- -----------------------------------------------
-- UpTime v2.0
-- Originally Created by 'Cane'
-- Latest Version - v2.0 written by 'Homem_do_Leme'on 21/08/2003
-- What's New: Also show Hub's name
-- -----------------------------------------------
function DataArrival(USER,DATA)
    if (strsub(DATA,1,1)=="<") then  DATA=strsub(DATA,1,strlen(DATA)-1)  s,e,CMD=strfind(DATA,".*%s+(%S+)")
        if (strlower(CMD)=="!uptime") then local SC=clock()
            USER:SendData("UpTimeBot"," UpTime do "..frmHub:GetHubName().." ? de " ..floor(SC/86400).." dias, "..floor(mod(SC/3600,24)).." horas, e "..floor(mod(SC/60,60)).." minutos.")
        end
    end
end

xokas

errrrrrrrrrrrrrrrrrrr! sorry! here goes the 'correct' one:



-- -----------------------------------------------
-- UpTime v2.0
-- Originally Created by 'Cane'
-- Latest Version - v2.0 written by 'Homem_do_Leme'on 21/08/2003
-- What's New: Also show Hub's name
-- -----------------------------------------------
function DataArrival(USER,DATA)
if (strsub(DATA,1,1)=="<" then DATA=strsub(DATA,1,strlen(DATA)-1) s,e,CMD=strfind(DATA,".*%s+(%S+)"
if (strlower(CMD)=="!uptime" then local SC=clock()
USER:SendData("UpTimeBot"," UpTime do "..frmHub:GetHubName().." ? de " ..floor(SC/86400).." dias, "..floor(mod(SC/3600,24)).." horas, e "..floor(mod(SC/60,60)).." minutos."
end
end
end

xokas

heres a little change i've made: it list already the description of the hub! i will try to find how to do the users online and the others! im n00b in programming! maybe someone could help better but im gonna try!here it goes:

-- -----------------------------------------------
-- UpTime v2.0
-- Originally Created by 'Cane'
-- Latest Version - v2.0 written by 'Homem_do_Leme'on 21/08/2003
-- What's New: Also show Hub's name
--Hub Description changes made by xokas on 31/10/2003
-- -----------------------------------------------
function DataArrival(USER,DATA)
    if (strsub(DATA,1,1)=="<") then  DATA=strsub(DATA,1,strlen(DATA)-1)  s,e,CMD=strfind(DATA,".*%s+(%S+)")
        if (strlower(CMD)=="!uptime") then local SC=clock()
            USER:SendData("UpTimeBot"," UpTime of "..frmHub:GetHubName().." it's " ..floor(SC/86400).." days, "..floor(mod(SC/3600,24)).." hours and "..floor(mod(SC/60,60)).." minutes and the hub description is:"..frmHub:GetHubDescr())
        end
    end
end
 




that is already in english! its just put it in the right folder and use it :)

xokas

-- -----------------------------------------------
-- UpTime v2.0
-- Originally Created by 'Cane'
-- Latest Version - v2.0 written by 'Homem_do_Leme'on 21/08/2003
-- What's New: Also show Hub's name
--Hub Description changes and bot name made by xokas on 31/10/2003
-- -----------------------------------------------
Bot = "UptimeBot"
function Main()
   frmHub:RegBot(Bot)
end   
function DataArrival(USER,DATA)
    if (strsub(DATA,1,1)=="<")
    then  DATA=strsub(DATA,1,strlen(DATA)-1)  s,e,CMD=strfind(DATA,".*%s+(%S+)")
        if (strlower(CMD)=="!uptime") then local SC=clock()
            USER:SendData( Bot,"UpTime of "..frmHub:GetHubName().." it's " ..floor(SC/86400).." days, "..floor(mod(SC/3600,24)).." hours and "..floor(mod(SC/60,60)).." minutes and the hub description is:"..frmHub:GetHubDescr())
        end
    end
end
 



here is a more presentable version with botname declared!

BlazeXxX

Try This one buddy:

-- Start copying from this Line
-- Uptime by extracted from retrobot By Skrollster
-- Retrobot is made by Tezlo
-- Hiding of command from MainChat is added by JenZen?


BotName = "Your bot"

sek = 1000
min = sek*60
hour = min*60
days = hour*24

time = 1*hour

function Main()
SetTimer(time)
StartTimer()
end


function DataArrival(user, data)
-- remove end pipe
data=strsub(data,1,strlen(data)-1)
--extract command
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hours "..min.." minutes and "..sec.." seconds")
return 1;
end
end


function OnTimer()
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName, "?=============="..frmHub:GetHubName().."=================| ?| ::Hub Owner: [NL[DSNHO]Trucker | ::Hub Info: Min Share 1 Gb | ::Hub Rules: Type !rules or !help | ::Hub Op's: [NL]janeb & sp33d@home& [NL]..DPP-HENK | ::Hub E-Mail: pfokkink@hotmail.com | ::Hub Address: trucker1.dyndns.org or | ::Hub Network: = ?ev?L? ?h?pp?nG Netw??k =| ::Uptime = "..days.." days, "..hrs.." hours "..min.." minutes and "..sec.." seconds = ?")
SendToAll(BotName, "?============="..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." Users Connected==================")
end

-- Finish Copying

[NL]trucker

BlazeXxX

hai m8 where you from?


cause you have an old bot of mine there.

but the prob was i would like to make use of hub uptime  by Rabit wombat because it was devolped for me by him and i like that one.

furthermore the question was could someone ad a timer to this one and ....

hubname
hubdescription
users online
[perhaps min max users]
Operators online



i just see a few things here thats why i requested a new one.


xokas:

thnx m8 for the effort but the same counts for you i really like the part i added that rabidwombat made ofr me so if you could replace that with your timer and ad the extra,s for me i woul be gratefull

and thnx to all of you for your efforts it is much apprieciated.

btw sorry for the late reply i,m always gone for the weekends hey what can i say when your with your g/f you dont turn on a comp.  :-)))))
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


SMF spam blocked by CleanTalk