AuthorMessage
Meka][Meka
Unstopable
Posts: 700

a login script, shows uptime and usercount when logging in
Code:

--// Quick Entrance Uptime Script For Hexhub Lua Plugin
--// Author: Meka][Meka
--// Meka][Meka Lua Plugin 1.502b and above is needed.
SecsToTime = function(iTime, bSmall)
   string.gmatch = (string.gmatch or string.gfind)
   local T = os.date("!*t", tonumber(iTime));
   local sTime = string.format("%i year(s), %i month(s), %i day(s), %i hour(s), %i minute(s)", T.year-1970, T.month-1, T.day-1, T.hour, T.min)
   if bSmall then
      for i in string.gmatch(sTime, "%d+") do
         if tonumber(i) == 0 then sTime = string.gsub(sTime, "^"..i.."%s(%S+),%s", "") end
      end
   end
   return sTime
end
UserConnected = function(user)
   SendChatTo(user.iUserID, Hub.BotName(), 'Current user count: '..Hub.UserCount()..', uptime: '..SecsToTime(Hub.Uptime(), 1))
end;

Meka][Meka
Unstopable
Posts: 700

small update to script
Code:

--// Quick Entrance Uptime Script For Hexhub Lua Plugin
--// Author: Meka][Meka
--// Meka][Meka Lua Plugin 1.502b and above is needed.
SecsToTime = function(iTime, bSmall)
   string.gmatch = (string.gmatch or string.gfind)
   local T = os.date("!*t", tonumber(iTime));
   local sTime = string.format("%i year(s), %i month(s), %i day(s), %i hour(s), %i minute(s)", T.year-1970, T.month-1, T.day-1, T.hour, T.min)
   if bSmall then
      for i in string.gmatch(sTime, "%d+") do
         if tonumber(i) == 0 then sTime = string.gsub(sTime, "^"..i.."%s(%S+),%s", "") end
      end
   end
   return sTime
end
UserConnected = function(user)
   SendChatTo(user.iUserID, Hub.BotName(), 'Current user count: '..Hub.UserCount()..', uptime: '..SecsToTime(Hub.Uptime(), 1))
end;
ChatArrival = function(user, chat)
   if chat == '!uptime' then
      local botname = Hub.BotName();
      SendChatTo(user.iUserID, botname, '[command] '..chat);
      SendChatTo(user.iUserID, botname, 'Current hub uptime: '..SecsToTime(Hub.Uptime(), 1));
      return 1;
   end;
   return 0;
end;

Code:

*** Connecting to 127.0.0.1...
*** Connected
<Hub-Security> HeXHub 3.10 for more information write !about
<Hub-Security> This hub is powered by Lua-Plugin 1.502b written by Meka][Meka
<Hub-Security> Current user count: 1, uptime: 0 minute(s)
<Hub-Security> Type !help to see the commands you have
   Für Hubbefehle in deutscher Sprache, schreibe !language DE
   Për ti parë porositë e HUBIT në gjuhën shqipe shkruani !language AL
   Pour voir les messages du Hub en français, write !language FR
   Per vedere i messaggi dell’HUB in lingua italiana digita !language IT
   Om de HUBs berichten in het nederlands te zien, type !language NL
   Zeby zobaczyc polecenia huba po polsku, wpisz !language PL
   Pentru a vedea mesajele de la HUB in limba romana, scrie !language RO
<Meka][Meka> lol
<Hub-Security> [command] !uptime
<Hub-Security> Current hub uptime: 0 minute(s)
<Meka][Meka> s
<Meka][Meka> d

ltr...
Ashura
Unstopable
Posts: 370

uhm hexhub shows uptime on login by default though
Lord_Zero
Ametuar
Posts: 122

Some people don't like hexhub's default messages and i won't add formatting options to the variabiles they can use. Using a plugin to change them is a good idea.
Meka][Meka
Unstopable
Posts: 700

a quick change to show seconds also
Code:

--// Quick Entrance Uptime Script For Hexhub Lua Plugin
--// Author: Meka][Meka
--// Meka][Meka Lua Plugin 1.502b and above is needed.
SecsToTime = function(iTime, bSmall)
   string.gmatch = (string.gmatch or string.gfind)
   local T = os.date("!*t", tonumber(iTime));
   local sTime = string.format("%i year(s), %i month(s), %i day(s), %i hour(s), %i minute(s), %i second(s)", T.year-1970, T.month-1, T.day-1, T.hour, T.min, T.sec)
   if bSmall then
      for i in string.gmatch(sTime, "%d+") do
         if tonumber(i) == 0 then sTime = string.gsub(sTime, "^"..i.."%s(%S+),%s", "") end
      end
   end
   return sTime
end
UserConnected = function(user)
   SendChatTo(user.iUserID, Hub.BotName(), 'Current user count: '..Hub.UserCount()..', uptime: '..SecsToTime(Hub.Uptime(), 1))
end;
ChatArrival = function(user, chat)
   if chat == '!uptime' then
      local botname = Hub.BotName();
      SendChatTo(user.iUserID, user.sName, '[command] '..chat);
      SendChatTo(user.iUserID, botname, 'Current hub uptime: '..SecsToTime(Hub.Uptime(), 1));
      return 1;
   end;
   return 0;
end;