0 Members and 1 Guest are viewing this topic.
const Color = $FFFFFFFF;var Visits: tstringarray;function Split(const Source: string; const Delimiter: string): tstringarray;var i,x,d: integer; s: string;begin d := Length(Delimiter); x := 0; i := 1; SetArrayLength(Result,1); while i <= Length(source) do begin s := Copy(Source,i,d); if s = Delimiter then begin Inc(i,d); Inc(x,1); SetArrayLength(result,x + 1); end else begin Result[x] := Result[x] + Copy(s,1,1); Inc(i,1); end; end;end;procedure ActivateServer();begin Visits := Split(ReadFile('Visits.txt'),Chr(13) + Chr(10));end;procedure OnMapChange(NewMap: string);var i: integer; File: string;begin for i := 0 to GetArrayLength(Visits) - 1 do if i = 0 then File := Visits[i] else File := File + Chr(13) + Chr(10) + Visits[i]; WriteFile('Visits.txt',File);end;procedure OnJoinGame(ID, Team: byte);var Found: boolean; i: integer; Temp: string;begin for i := 0 to GetArrayLength(Visits) - 1 do if GetPiece(Visits[i],Chr(1),0) = GetPlayerStat(ID,'IP') then begin Temp := GetPlayerStat(ID,'IP') + Chr(1) + InttoStr(StrtoInt(GetPiece(Visits[i],Chr(1),1)) + 1); Visits[i] := Temp; Found := true; WriteConsole(ID,'Welcome back to ' + ServerName + ' (' + ServerIP + ':' + InttoStr(ServerPort) + '), ' + GetPlayerStat(ID,'Name') + '!',Color); WriteConsole(0,GetPlayerStat(ID,'Name') + ' has been recognized here ' + GetPiece(Visits[i],Chr(1),1) + ' times.',Color); Break; end; if Found = false then begin SetArrayLength(Visits,GetArrayLength(Visits) + 1); Visits[GetArrayLength(Visits) - 1] := GetPlayerStat(ID,'IP') + Chr(1) + '1'; WriteConsole(ID,'Welcome to ' + ServerName + ' (' + ServerIP + ':' + InttoStr(ServerPort) + '), ' + GetPlayerStat(ID,'Name') + '!',Color); WriteConsole(0,'This is ' + GetPlayerStat(ID,'Name') + '''s first visit here.',Color); end;end;
there is no way to detect when the end of the day is without the help of an external program or GetURL or somethinglol i typed that on a phone! took me like 5 minutes.I can make it check total users ever, but if you want total users per day, you would need to GetURL some site that said the time of where the computer is located, or an external program writing to a file the current time every so often, or TCP sockets to whatever, you get my point. You would need to turn off savemode if you want this, plus GetURL (easiest to make in my mind) may lag the server a little..