Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: cooz on November 07, 2006, 04:56:27 am
-
Script Name: upTime
Script Description: another simple script, it shows how long server is already running in %%days:%%hours:%%minutes:%%seconds format on !uptime or /uptime command
Original Author: cooz
Core Version: 2.5.2
const
ADMIN_UPTIME_ON=1; //turns off/on /uptime script
PLAYER_UPTIME_ON=1; //turns off/on !uptime script
var
up: integer;
procedure ActivateServer();
begin
up:=0;
end;
procedure AppOnIdle(Ticks: integer);
begin
up:=up+1;
end;
function formatTime():string;
var d,h,m,s: integer;
begin
d:= up/86400;
h:= up/3600 mod 24;
m:= up/60 mod 60;
s:= up mod 60;
if((d=0) and (h=0)) then begin result:=inttostr(m)+'m:'+inttostr(s)+'s'; end
else if d=0 then begin result:=inttostr(h)+'h:'+inttostr(m)+'m:'+inttostr(s)+'s'; end
else result:=inttostr(d)+'d:'+inttostr(h)+'h:'+inttostr(m)+'m:'+inttostr(s)+'s';
end;
procedure OnPlayerSpeak(Name,Text: string);
begin
if((Text='!uptime')and(PLAYER_UPTIME_ON=1)) then begin
saytoplayer(NametoID(Name),'server is running for: '+formatTime());
end;
end;
procedure OnCommand(ID: integer;Text: string);
begin
if((Text='/uptime')and(ADMIN_UPTIME_ON=1)) then begin
saytoplayer(ID,'server is running for: '+formatTime());
end;
end;
-
Good work on getting this scripts forum up and running with your scripts. Can't wait to see the other scripts which will come out of here.
I especially like this script, I don't really know why... Well Done ;D
Edit: Don't know if you used the right bb code, from the sticky it states
(use the [ CODE=Pascal ] [ /CODE ] tags around your code!)
-
i tried to use code=pascal, but this forum seems to not understand it,
we all know that it's pascal anyway ;)
-
The [ code = pascal] thing is there because I copied the post template from my forum, which supports the GeSHI SMF Mod, but soldatforums doesnt... hopefully it will soon though.