Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Mighty on July 04, 2010, 04:59:02 am

Title: Ping Track
Post by: Mighty on July 04, 2010, 04:59:02 am
Name: Ping Track

Author: Mighty (http://soldatcentral.com/index.php?page=profile&u=406)
Script version: 1.0.0
Server version: 2.6.5
Release Date: 4th of July 2010
Compile Test: Uploading disabled
Description:
The script checks player's ping every second, for 5 seconds. Then it returns the avarage and maximum ping measured. It's kinda better than single !ping, isn't it?
Commands:
 * !track ID  - starts tracking player's ping.
 * !track mig - starts tracking for (example) MyNameIsmig.

Requirements:
  *  None

---
(http://img4.imageshack.us/img4/4158/downloadiz.gif) (http://forums.soldat.pl/index.php?action=dlattach;topic=38528.0;attach=28633)
---
Code: {snippets}
Code: [Select]
(...)
procedure AppOnIdle(Ticks: integer);
begin

  if (TrackOrNot = TRUE) then
begin
for i:=1 to 12 do
begin

IF Track[i]=TRUE then
begin
if TrackCount[i] = 0 then
begin
TrackPing[i] := TrackPing[i] + GetPlayerStat(i,'ping');

WriteConsole(0,'Track result for ' + IDToName(i) + ':   Max Ping: ' + inttostr(TrackPingMax[i]) + '         Avarage: '+ inttostr(Round(TrackPing[i]/4)),Color);
// reset vars
TrackPingMax[i] := 0;
TrackPing[i] := 0;
Track[i] := FALSE;
end
else if TrackCount[i] > 0 then
begin
TrackPing[i] := TrackPing[i] + GetPlayerStat(i,'ping');
IF GetPlayerStat(i,'ping') > TrackPingMax[i] then TrackPingMax[i] := GetPlayerStat(i,'ping');
TrackCount[i] := TrackCount[i] - 1;
end;
end;

end;
end;

end;
(...)

Questions? Bugs? Report please --> macekmil@gmail.com
Title: Re: Ping Track
Post by: Bonecrusher on July 04, 2010, 05:40:55 pm
Useful but I have other ping track script running on my servers:)
Title: Re: Ping Track
Post by: Spotix on February 08, 2012, 01:02:27 pm
Good work.  ;D
Title: Re: Ping Track
Post by: Hubiq on July 27, 2016, 01:32:23 am
After release 1.7.1 function "!track [name other player]" doesn't work :/
Title: Re: Ping Track
Post by: KoGAi on August 02, 2016, 11:22:55 pm
Right, same goes for the readwhoiz/whoiz script commands. :)
Title: Re: Ping Track
Post by: soldat-game on September 02, 2016, 01:59:12 pm
How fix:
Go script dir open script.pas (Track.pas) find and go to function StrToID(s: string): byte;
and replace to this function:
Code: [Select]
function StrToID(s: string): byte;
var i,xx: byte;
begin
xx:=0;
Result:=254;
try
if GetPlayerStat(StrToInt(s),'active') then begin
Result := StrToInt(s);
xx:=1;
end;
except
end;
if (xx=0) then begin
s := LowerCase(s);
for i := 1 to 32 do if GetPlayerStat(i,'active') then begin
if ContainsString(LowerCase(IDToName(i)), s) then begin
Result := i;
break;
end;
end;
end;
end;
Title: Re: Ping Track
Post by: KoGAi on September 18, 2016, 08:04:46 pm
How fix:
Go script dir open script.pas (Track.pas) find and go to function StrToID(s: string): byte;
and replace to this function:
Code: [Select]
function StrToID(s: string): byte;
var i,xx: byte;
begin
xx:=0;
Result:=254;
try
if GetPlayerStat(StrToInt(s),'active') then begin
Result := StrToInt(s);
xx:=1;
end;
except
end;
if (xx=0) then begin
s := LowerCase(s);
for i := 1 to 32 do if GetPlayerStat(i,'active') then begin
if ContainsString(LowerCase(IDToName(i)), s) then begin
Result := i;
break;
end;
end;
end;
end;

Thank you so much for this! :3