Beispiel #1
0
        private void UpdatePlayerList()
        {
            GC.Collect();
            int i = 0;

            for (; i < 50; i++)
            {
                if (HackFunctions.getPlayerActive(i))
                {
                    if (playerList.Items.ContainsKey(i.ToString()))
                    {
                        float  playerX   = HackFunctions.getPlayerX(i);
                        float  playerY   = HackFunctions.getPlayerY(i);
                        int    health    = HackFunctions.getPlayerHealth(i);
                        int    maxHealth = HackFunctions.getPlayerMaxHealth(i);
                        string name      = GetPlayerName(i);
                        int    index     = playerList.Items.IndexOfKey(i.ToString());
                        playerList.Items[index].SubItems[1].Text = name;
                        playerList.Items[index].SubItems[2].Text = Convert.ToString(playerX);
                        playerList.Items[index].SubItems[3].Text = Convert.ToString(playerY);
                        playerList.Items[index].SubItems[4].Text = Convert.ToString(health);
                        playerList.Items[index].SubItems[5].Text = Convert.ToString(maxHealth);
                    }
                    else
                    {
                        float  playerX   = HackFunctions.getPlayerX(i);
                        float  playerY   = HackFunctions.getPlayerY(i);
                        int    health    = HackFunctions.getPlayerHealth(i);
                        int    maxHealth = HackFunctions.getPlayerMaxHealth(i);
                        string name      = GetPlayerName(i);
                        playerList.Items.Add(i.ToString(), i.ToString(), 0);
                        playerList.Items[i.ToString()].SubItems.Add(name);
                        playerList.Items[i.ToString()].SubItems.Add(Convert.ToString(playerX));
                        playerList.Items[i.ToString()].SubItems.Add(Convert.ToString(playerY));
                        playerList.Items[i.ToString()].SubItems.Add(Convert.ToString(health));
                        playerList.Items[i.ToString()].SubItems.Add(Convert.ToString(maxHealth));
                    }
                }
                else
                {
                    if (playerList.Items.ContainsKey(i.ToString()))
                    {
                        playerList.Items[playerList.Items.IndexOfKey(i.ToString())].Remove();
                    }
                }
            }
        }