Well, here is a rough idea of what I want. I need a better way to prime this. This is looping through a collection of player objects obviously I dont want to add the first player objects together just ones that match names throughout the file and then remove the other unneeded player objects from the collection. Its creating the totals for certain items off of one of our servers. I want redundant player names to be totaled and stored in the first instance of that player object. The rest of the redundant players eliminated. Think I wrote to much code today... Been writing code since about midnight last night. Sleepy now Hate when you get going on something sometimes and you can't pull yourself away from it....aaarghhh
Yeah I have it now!Disregard this post.I hate when I post and figure it out right away.
I'm silly im removing objects...I think I have it.But any suggestions I'll take right now...lol.
Visual Basic:
Private Sub TotalPlayers()
Try
Dim i As Integer
Dim x As Integer
With PlayersList
For i = 1 To .GetPLAYERCount
For x = 1 To .GetPLAYERCount Step 1
Dim kills, deaths, teamkills, suicides, objective As Integer
If .GetPLAYERObject(i).Name = .GetPLAYERObject(x).Name Then
kills = Convert.ToInt32(.GetPLAYERObject(i).Kills) + Convert.ToInt32(.GetPLAYERObject(x).Kills)
.GetPLAYERObject(i).Kills = Convert.ToString(kills)
deaths = Convert.ToInt32(.GetPLAYERObject(i).Deaths) + Convert.ToInt32(.GetPLAYERObject(x).Deaths)
.GetPLAYERObject(i).Deaths = Convert.ToString(deaths)
teamkills = Convert.ToInt32(.GetPLAYERObject(i).TeamKills) + Convert.ToInt32(.GetPLAYERObject(x).TeamKills)
.GetPLAYERObject(i).TeamKills = Convert.ToString(teamkills)
suicides = Convert.ToInt32(.GetPLAYERObject(i).Suicides) + Convert.ToInt32(.GetPLAYERObject(x).Suicides)
.GetPLAYERObject(i).Suicides = Convert.ToString(suicides)
objective = Convert.ToInt32(.GetPLAYERObject(i).Objective) + Convert.ToInt32(.GetPLAYERObject(x).Objective)
.GetPLAYERObject(i).Objective = Convert.ToString(objective)
.RemovePlayer(x)
End If
Next
Next
End With
WritePlayers()
Catch ex As Exception
Dim mm As New System.Net.Mail.SmtpClient
mm.Host = "smtp.charter.net"
mm.Send("itower@chartermi.net", "itower@chartermi.net", "error", ex.ToString)
End Try
End Sub
I'm silly im removing objects...I think I have it.But any suggestions I'll take right now...lol.
Last edited: