yTka перед
for ( int i = 0; i < players.Count(); ++i )
добавь
if ( FileExist("$profile:PlayersLogFile.txt") )
{
DeleteFile("$profile:PlayersLogFile.txt");
}
И перед записью данных о всех игроках файл будет очищаться.
А еще желательно добавить проверку на количество игроков, чтобы примерно так получилось:
static void WritePlayersInfo()
{
array<Man> players = new array<Man>; Man player; Man player_test;
GetGame().GetPlayers( players );
if (players.Count() > 0)
{
if ( FileExist("$profile:PlayersLogFile.txt") )
{
DeleteFile("$profile:PlayersLogFile.txt");
}
for ( int i = 0; i < players.Count(); ++i )
{
player_test = players.Get(i);
if( player_test )
{
PlayerIdentity p_identity = player_test.GetIdentity();
string coord_pl = player_test.GetPosition().ToString();
string Name_P = p_identity.GetName();
string UID_P = p_identity.GetPlainId();
WriteFile("$profile:PlayersLogFile.txt", "User name: " + Name_P + " UID: " + UID_P + " Coords: " + coord_pl);
}
}
}
}