0 Members and 1 Guest are viewing this topic.
const ADMIN_UPTIME_ON=1; //turns off/on /uptime script PLAYER_UPTIME_ON=1; //turns off/on !uptime scriptvar 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);beginif((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;
Either edit the apropriate files in the scripts directory to include that code, or delete the affected procedures, put it in a new file, and add it to the script list. I'd recommend the latter; so delete the ActivateServer, AppOnIdle, and OnCommand procedures from Core.pas, and delete OnPlayerSpeak from NetworkCore.pas, create a new file (uptime.pas), save it in the same directory, and add uptime.pas to includes.txt
Name: SnipufinPosts: 111 (1.11 per day)Position: SoldierKarma: -11