This script keeps tabs on your ping and fps map by map and creates a hard copy. It logs in the log folder of your t2 install, view it to see your stats as far as system performance goes. As always, copy/save as serverstuff.cs, paste into the autoexec folder of your scripts folder. Works automatically.
// #autoload
// #name = ServerStuff
// #version = 0.1
// #author = ilys
// #category = ilys' Scripts
// #include = support/callback.cs
// #include = support/mission_callbacks.cs
// #include = support/file_tools.cs
$ServerStuff::ShowHud = 0;
$ServerStuff::PingNum = 0;
$ServerStuff::CurrentPing = 0;
$ServerStuff::TotalPing = 0;
$ServerStuff::MaxPing = 0;
$ServerStuff::MinPing = 0;
$ServerStuff::AvPing = 0;
$ServerStuff::PLNum = 0;
$ServerStuff::CurrentPL = 0;
$ServerStuff::TotalPL = 0;
$ServerStuff::MaxPL = 0;
$ServerStuff::MinPL = 0;
$ServerStuff::AvPL = 0;
$ServerStuff::FPSNum = 0;
$ServerStuff::CurrentFPS = 0;
$ServerStuff::TotalFPS = 0;
$ServerStuff::MaxFPS = 0;
$ServerStuff::MinFPS = 0;
$ServerStuff::AvFPS = 0;
$ServerStuff::ServerTimeSec = "0"@0;
$ServerStuff::ServerTimeMin = "0"@0;
$ServerStuff::ServerTimeHour = "0"@0;
$ServerStuff::MapTimeSec = "0"@0;
$ServerStuff::MapTimeMin = "0"@0;
$ServerStuff::MapTimeHour = "0"@0;
package ServerStuff {
function PlayGui::onWake(%this)
{
Callback.add(onMatchStart, "ServerStuffReset");
Callback.add(onGameOver, "ServerStuffExportLog");
Callback.add(onUserClientDrop, "ServerStuffExportServerLog");
parent::onWake(%this);
if(!isObject(PlayGui)) return;
if(isObject(ServerStuffHud)) return;
new GuiControlProfile ("SSHudLabel")
{
fontType = "Univers Condensed";
fontSize = 16;
fontColor = "255 255 255";
justify = "center";
};
new GuiControlProfile ("SSHudText")
{
fontType = "Univers Condensed";
fontSize = 16;
fontColor = "0 255 0";
justify = "center";
};
new ShellFieldCtrl(ServerStuffHud)
{
profile = "GuiChatBackProfile";
horizSizing = "left";
vertSizing = "bottom";
extent = "300 185";
visible = "0";
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "100 16 ";
visible = "1";
text = "Server Name:";
};
new GuiMLTextCtrl(SSServerName)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 0";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "100 16 ";
visible = "1";
text = "Server IP:";
};
new GuiMLTextCtrl(SSServerIP)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 20";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 40";
extent = "100 16 ";
visible = "1";
text = "Server Map Name:";
};
new GuiMLTextCtrl(SSServerMapName)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 40";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 60";
extent = "100 16 ";
visible = "1";
text = "Server Map Type:";
};
new GuiMLTextCtrl(SSServerMapType)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 60";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 80";
extent = "100 16 ";
visible = "1";
text = "Current Ping:";
};
new GuiMLTextCtrl(SSCurPing)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 80";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "150 80";
extent = "100 16 ";
visible = "1";
text = "Average Ping:";
};
new GuiMLTextCtrl(SSAvPing)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "250 80";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 100";
extent = "100 16 ";
visible = "1";
text = "Lowest Ping:";
};
new GuiMLTextCtrl(SSMinPing)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 100";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "150 100";
extent = "100 16 ";
visible = "1";
text = "Highest Ping:";
};
new GuiMLTextCtrl(SSMaxPing)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "250 100";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 120";
extent = "100 16 ";
visible = "1";
text = "Current FPS:";
};
new GuiMLTextCtrl(SSCurFPS)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 120";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "150 120";
extent = "100 16 ";
visible = "1";
text = "Average FPS:";
};
new GuiMLTextCtrl(SSAvFPS)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "250 120";
extent = "250 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 140";
extent = "100 16 ";
visible = "1";
text = "Lowest FPS:";
};
new GuiMLTextCtrl(SSMinFPS)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 140";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "150 140";
extent = "100 16 ";
visible = "1";
text = "Highest FPS:";
};
new GuiMLTextCtrl(SSMaxFPS)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "250 140";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "0 160";
extent = "100 16 ";
visible = "1";
text = "Total Time:";
};
new GuiMLTextCtrl(SSServerTime)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "100 160";
extent = "200 16 ";
visible = "1";
};
new GuiTextCtrl()
{
profile = "SSHudLabel";
horizSizing = "right";
vertSizing = "bottom";
position = "150 160";
extent = "100 16 ";
visible = "1";
text = "Map Time:";
};
new GuiMLTextCtrl(SSMapTime)
{
profile = "SSHudText";
horizSizing = "right";
vertSizing = "bottom";
position = "250 160";
extent = "200 16 ";
visible = "1";
};
};
playGui.add(ServerStuffHud);
if(isObject(HM) && isObject(HudMover)) hudmover::addhud(ServerStuffHud,"ServerStuff");
ServerStuffUpdateHud();
ServerStuffUpdatePL();
ServerStuffUpdateTime();
ServerStuffUpdatePing();
ServerStuffUpdateFPS();
}
function OptionsDlg::onWake( %this )
{
if($ServerStuff::Binds != 1)
{
$RemapName[$RemapCount]="Toggle SSHud";
$RemapCmd[$RemapCount]="ServerStuffToggleHud";
$RemapCount++;
$ServerStuff::Binds = 1;
}
GlobalActionMap.copyBind(moveMap, ServerStuffToggleHud);
parent::onWake( %this );
}
function handleClientJoin(%msgType, %msgString, %clientName, %clientId, %targetId, %isAI, %isAdmin, %isSuperAdmin, %isSmurf, %guid)
{
parent::handleClientJoin(%msgType, %msgString, %clientName, %clientId, %targetId, %isAI, %isAdmin, %isSuperAdmin, %isSmurf, %guid);
if(StrStr(%msgString, "Welcome to Tribes") != -1) $ClientRep = $PlayerList[%clientID];
}
function ServerStuffToggleHud( %val )
{
if (%val)
{
$ServerStuff::ShowHud = !$ServerStuff::ShowHud;
ServerStuffHud.setVisible($ServerStuff::ShowHud);
if ($ServerStuff::ShowHud) ServerStuffUpdateHud();
}
}
function ServerStuffUpdateHud()
{
$SSServerName = MissionCallback.getServerName();
SSServerName.setValue($SSServerName);
$SSServerIP = MissionCallback.getServerAddress();
SSServerIP.setValue($SSServerIP);
$SSServerMapName = MissionCallback.getMissionName();
SSServerMapName.setValue($SSServerMapName);
$SSServerMod = MissionCallback.getServerMod();
$SSServerMapType = MissionCallback.getMissionType();
SSServerMapType.setValue($SSServerMod @ " - " @ $SSServerMapType);
}
function ServerStuffUpdatePing()
{
$ServerStuff::PingNum++;
$ServerStuff::TotalPing = $ServerStuff::TotalPing+$ServerStuff::CurrentPing;
$ServerStuff::AvPing = mFloor($ServerStuff::TotalPing / $ServerStuff::PingNum);
if($ServerStuff::CurrentPing > $ServerStuff::MaxPing || $ServerStuff::MaxPing == 0)
$ServerStuff::MaxPing = $ServerStuff::CurrentPing;
if($ServerStuff::CurrentPing < $ServerStuff::MinPing || $ServerStuff::MinPing == 0)
$ServerStuff::MinPing = $ServerStuff::CurrentPing;
SSCurPing.setValue($ServerStuff::
[email protected]" / "@$ServerStuff::
[email protected]"%");
SSAvPing.setValue($ServerStuff::
[email protected]" / "@$ServerStuff::
[email protected]"%");
SSMinPing.setValue($ServerStuff::
[email protected]" / "@$ServerStuff::
[email protected]"%");
SSMaxPing.setValue($ServerStuff::
[email protected]" / "@$ServerStuff::
[email protected]"%");
if ($ServerStuffPingSchedule != 0) cancel($ServerStuffPingSchedule);
$ServerStuffPingSchedule = schedule(2500, 0, ServerStuffUpdatePing);
}
function ServerStuffUpdatePL()
{
commandToServer( 'getScores' );
$ServerStuff::PLNum++;
$ServerStuff::CurrentPL = $ClientRep.packetLoss;
$ServerStuff::TotalPL = $ServerStuff::TotalPL+$ServerStuff::CurrentPL;
$ServerStuff::AvPL = mFloor($ServerStuff::TotalPL / $ServerStuff::PLNum);
if($ServerStuff::CurrentPL > $ServerStuff::MaxPL || $ServerStuff::MaxPL == 0)
$ServerStuff::MaxPL = $ServerStuff::CurrentPL;
if($ServerStuff::CurrentPL < $ServerStuff::MinPL || $ServerStuff::MinPL == 0)
$ServerStuff::MinPL = $ServerStuff::CurrentPL;
if ($ServerStuffPLSchedule != 0) cancel($ServerStuffPLSchedule);
$ServerStuffPLSchedule = schedule(5000, 0, ServerStuffUpdatePL);
}
function ServerStuffUpdateFPS()
{
$ServerStuff::FPSNum++;
$ServerStuff::TotalFPS = $ServerStuff::TotalFPS+$ServerStuff::CurrentFPS;
$ServerStuff::AvFPS = mFloor($ServerStuff::TotalFPS / $ServerStuff::FPSNum);
if($ServerStuff::CurrentFPS > $ServerStuff::MaxFPS || $ServerStuff::MaxFPS == 0)
$ServerStuff::MaxFPS = $ServerStuff::CurrentFPS;
if($ServerStuff::CurrentFPS < $ServerStuff::MinFPS || $ServerStuff::MinFPS == 0)
$ServerStuff::MinFPS = $ServerStuff::CurrentFPS;
SSCurFPS.setValue($ServerStuff::CurrentFPS);
SSAvFPS.setValue($ServerStuff::AvFPS);
SSMinFPS.setValue($ServerStuff::MinFPS);
SSMaxFPS.setValue($ServerStuff::MaxFPS);
if ($ServerStuffFPSSchedule != 0) cancel($ServerStuffFPSSchedule);
$ServerStuffFPSSchedule = schedule(2500, 0, ServerStuffUpdateFPS);
}
function ServerStuffUpdateTime()
{
$ServerStuff::ServerTimeSec++;
if(strLen($ServerStuff::ServerTimeSec) == 1) $ServerStuff::ServerTimeSec = "0"@$ServerStuff::ServerTimeSec;
if($ServerStuff::ServerTimeSec == 60)
{
$ServerStuff::ServerTimeSec = "0"@0;
$ServerStuff::ServerTimeMin++;
if(strLen($ServerStuff::ServerTimeMin) == 1) $ServerStuff::ServerTimeMin = "0"@$ServerStuff::ServerTimeMin;
}
if($ServerStuff::ServerTimeMin == 60)
{
$ServerStuff::ServerTimeMin = "0"@0;
$ServerStuff::ServerTimeHour++;
if(strLen($ServerStuff::ServerTimeHour) == 1) $ServerStuff::ServerTimeHour = "0"@$ServerStuff::ServerTimeHour;
}
$ServerStuff::ServerTime = $ServerStuff::ServerTimeHour @ ":" @ $ServerStuff::ServerTimeMin @ ":" @ $ServerStuff::ServerTimeSec;
$ServerStuff::MapTimeSec++;
if(strLen($ServerStuff::MapTimeSec) == 1) $ServerStuff::MapTimeSec = "0"@$ServerStuff::MapTimeSec;
if($ServerStuff::MapTimeSec == 60)
{
$ServerStuff::MapTimeSec = "0"@0;
$ServerStuff::MapTimeMin++;
if(strLen($ServerStuff::MapTimeMin) == 1) $ServerStuff::MapTimeMin = "0"@$ServerStuff::MapTimeMin;
}
if($ServerStuff::MapTimeMin == 60)
{
$ServerStuff::MapTimeMin = "0"@0;
$ServerStuff::MapTimeHour++;
if(strLen($ServerStuff::MapTimeHour) == 1) $ServerStuff::MapTimeHour = "0"@$ServerStuff::MapTimeHour;
}
$ServerStuff::MapTime = $ServerStuff::MapTimeHour @ ":" @ $ServerStuff::MapTimeMin @ ":" @ $ServerStuff::MapTimeSec;
SSServerTime.setValue($ServerStuff::ServerTime);
SSMapTime.setValue($ServerStuff::MapTime);
if ($ServerStuffTimeSchedule != 0) cancel($ServerStuffTimeSchedule);
$ServerStuffTimeSchedule = schedule(1000, 0, ServerStuffUpdateTime);
}
function ServerStuffReset()
{
ServerStuffUpdateHud();
error("Resetting Settings");
$ServerStuff::PingNum = 0;
$ServerStuff::CurrentPing = 0;
$ServerStuff::TotalPing = 0;
$ServerStuff::MaxPing = 0;
$ServerStuff::MinPing = 0;
$ServerStuff::AvPing = 0;
$ServerStuff::PLNum = 0;
$ServerStuff::CurrentPL = 0;
$ServerStuff::TotalPL = 0;
$ServerStuff::MaxPL = 0;
$ServerStuff::MinPL = 0;
$ServerStuff::AvPL = 0;
$ServerStuff::FPSNum = 0;
$ServerStuff::CurrentFPS = 0;
$ServerStuff::TotalFPS = 0;
$ServerStuff::MaxFPS = 0;
$ServerStuff::MinFPS = 0;
$ServerStuff::AvFPS = 0;
$ServerStuff::MapTimeSec = "0"@0;
$ServerStuff::MapTimeMin = "0"@0;
$ServerStuff::MapTimeHour = "0"@0;
}
function ServerStuffExportLog()
{
error("Exporting Log");
%SSSave = new FileObject();
%SSSave.openForWrite("logs/");
%SSSave.close();
%SSSave.openForAppend("logs/ServerStuff.log");
%SSSave.appendLine("logs/ServerStuff.log", "");
%SSSave.appendLine("logs/ServerStuff.log", "Log Date: " @ formatTimeString("mm/dd/yy") @ "\tLog Time: " @ formatTimeString("HH:nn:ss"));
%SSSave.appendLine("logs/ServerStuff.log", "Server Name: " @ $SSServerName);
%SSSave.appendLine("logs/ServerStuff.log", "Server IP: " @ $SSServerIP);
%SSSave.appendLine("logs/ServerStuff.log", "Server Map Name: " @ $SSServerMapName);
%SSSave.appendLine("logs/ServerStuff.log", "Server Map Type: " @ $SSServerMod @ " - " @ $SSServerMapType);
%SSSave.appendLine("logs/ServerStuff.log", "Lowest Ping: " @ $ServerStuff::
[email protected]"/"@$ServerStuff::
[email protected]"%" @ "\tLowest FPS: " @ $ServerStuff::MinFPS);
%SSSave.appendLine("logs/ServerStuff.log", "Highest Ping: " @ $ServerStuff::
[email protected]"/"@$ServerStuff::
[email protected]"%" @ "\tHighest FPS: " @ $ServerStuff::MaxFPS);
%SSSave.appendLine("logs/ServerStuff.log", "Average Ping: " @ $ServerStuff::
[email protected]"/"@$ServerStuff::
[email protected]"%" @ "\tAverage FPS: " @ $ServerStuff::AvFPS);
%SSSave.appendLine("logs/ServerStuff.log", "Total Time: " @ $ServerStuff::ServerTime @ "\tMap Time: " @ $ServerStuff::MapTime);
%SSSave.close();
%SSSave.delete();
ServerStuffReset();
}
function ServerStuffExportServerLog()
{
ServerStuffExportLog();
$ServerStuff::ServerTimeSec = "0"@0;
$ServerStuff::ServerTimeMin = "0"@0;
$ServerStuff::ServerTimeHour = "0"@0;
error("Closing Schedules");
if ($ServerStuffTimeSchedule != 0) cancel($ServerStuffTimeSchedule);
if ($ServerStuffFPSSchedule != 0) cancel($ServerStuffFPSSchedule);
if ($ServerStuffPingSchedule != 0) cancel($ServerStuffPingSchedule);
if ($ServerStuffPLSchedule != 0) cancel($ServerStuffPLSchedule);
error("Killing Hud");
if (isObject(ServerStuffHud))
{
playGui.remove(ServerStuffHud);
ServerStuffHud.delete();
}
}
function NetBarHud::infoUpdate(%this, %ping, %packetLoss, %sendPackets, %sendBytes, %receivePackets, %receiveBytes)
{
parent::infoUpdate(%this, %ping, %packetLoss, %sendPackets, %sendBytes, %receivePackets, %receiveBytes);
$ServerStuff::CurrentPing = mFloor(%ping);
$ServerStuff::CurrentFPS = mFloor($fps::real);
}
};
activatePackage(ServerStuff);