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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
60 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! ^5IW4M Admin ^7sees ^5YOU!
This server has harvested the information of ^5{{TOTALPLAYERS}} ^7players! This server has harvested the information of ^5{{TOTALPLAYERS}} ^7players!
Cheaters are ^1unwelcome ^7 on this server Cheaters are ^1unwelcome ^7 on this server