Page 1 of 1

How do I detect 1 Player not all of them?

Posted: Fri Jul 14, 2017 9:58 pm
by TaiHuiDo
I need help with detecting 1 player not like Game.GetPlayers(); I need to understand how UniquieID works. Please help fast.

Re: How do I detect 1 Pl;ayer not all of them?

Posted: Mon Jul 17, 2017 5:50 pm
by jamisco
so each player in the game has a unique ID,for example say they are 6 players in the game, player 1 can will have U-ID 1, player 2 will have U-ID 2 and so on... when you call Game.GetPlayer(Unique-ID), you simply use the player's Id to in sense detect the player.... if you want to get the player's Id, you can do this

Code: Select all

            int[] plyr_ID = new int[] { };
            int i = 0;
            foreach (IPlayer plyr in Game.GetPlayers())
            {
                plyr_ID[i] = plyr.UniqueID;
                i++;
            }
additionally, if you are in map editor, you can simply hover over the spawn player icon to get the unique ID ... its called ID not unique ID in map editor
as shown in this picture

Re: How do I detect 1 Pl;ayer not all of them?

Posted: Mon Jul 17, 2017 9:22 pm
by TaiHuiDo
LOVE U MAN!