To check whether index is actually a player. If index is between 1 and maxclients (maxclients being the current server max slots), then it's a player. If your server has 16 slots, a player's index can't be 17.
It's just a fast way to filter between players and others entities. You can take damage from something other than a player. The code will work only if attacker is a player.