Official Soldat Forums
Server Talk => Scripting Releases => Topic started 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}
(...)
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
-
Useful but I have other ping track script running on my servers:)
-
Good work. ;D
-
After release 1.7.1 function "!track [name other player]" doesn't work :/
-
Right, same goes for the readwhoiz/whoiz script commands. :)
-
How fix:
Go script dir open script.pas (Track.pas) find and go to function StrToID(s: string): byte;
and replace to this function:
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;
-
How fix:
Go script dir open script.pas (Track.pas) find and go to function StrToID(s: string): byte;
and replace to this function:
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