Clean colors and fix player count with new method

This commit is contained in:
raidmax@live.com 2015-05-09 14:03:15 -05:00
parent 5a5dd1ab88
commit 6afbff46f9
4 changed files with 10 additions and 14 deletions

View File

@ -72,7 +72,7 @@ namespace IW4MAdmin
public uint flags;
[FieldOffset(12)]
short type;
public short type;
[FieldOffset(16)]
public IntPtr current;
@ -94,21 +94,13 @@ namespace IW4MAdmin
public struct dvar
{
public String name;
public String description;
public int flags;
short type;
public short type;
public String current;
public String latched;
public String _default;
public int min;
public int max;
}

View File

@ -351,14 +351,12 @@ namespace IW4MAdmin
{
players[cNum] = null;
}
clientnum = statusPlayers.Count;
return true;
}
else
{
Log.Write("Error - Client disconnecting has an invalid client index!", Log.Level.Debug);
clientnum = statusPlayers.Count;
return false;
}
}
@ -628,6 +626,7 @@ namespace IW4MAdmin
if ((DateTime.Now - lastPoll).Milliseconds > 750)
{
int numberRead = 0;
int activeClients = 0;
for (int i = 0; i < players.Count; i++)
{
@ -639,10 +638,13 @@ namespace IW4MAdmin
if (eachClient.state == 0)
removePlayer(i);
else if (eachClient.state > 1)
addPlayer(new Player(eachClient.name, eachClient.steamid.ToString("x16"), i, 0, i, null, 0, Helpers.NET_AdrToString(eachClient.adr).Split(':')[0]));
addPlayer(new Player(Utilities.stripColors(Utilities.cleanChars(eachClient.name)), eachClient.steamid.ToString("x16"), i, 0, i, null, 0, Helpers.NET_AdrToString(eachClient.adr).Split(':')[0]));
if (eachClient.state > 2)
activeClients++;
}
lastPoll = DateTime.Now;
clientnum = activeClients;
}
#endif
@ -1363,6 +1365,7 @@ namespace IW4MAdmin
Macros.Add("WISDOM", Wisdom());
Macros.Add("TOTALPLAYERS", clientDB.totalPlayers());
Macros.Add("TOTALKILLS", totalKills);
Macros.Add("VERSION", IW4MAdmin.Program.Version);
}

View File

@ -353,6 +353,7 @@ namespace IW4MAdmin
else
dvar_actual.latched = dvar_raw.latched.ToString();
dvar_actual.type = dvar_raw.type;
dvar_actual.flags = getIntFromPointer((int)dvar_raw.flags, Handle);
dvar_actual.max = getIntFromPointer((int)dvar_raw.max, Handle);
dvar_actual.min = getIntFromPointer((int)dvar_raw.min, Handle);

View File

@ -1,5 +1,5 @@
60
This server uses ^5IW4M Admin v0.9 ^7get it at ^5raidmax.org
This server uses ^5IW4M Admin v{{VERSION}} ^7get it at ^5raidmax.org/IW4MAdmin
^5IW4M Admin ^7sees ^5YOU!
This server has harvested the information of ^5{{TOTALPLAYERS}} ^7players!
Cheaters are ^1unwelcome ^7 on this server