added a function to the server for finding player index in order to clean up the code some