1. Animals
  2. Abilities
  3. Conditions
  4. Tool/Weapon
  5. Equipped
  6. Food/Medicine
  7. Items
  8. Attributes
  9. Creatures
  10. Blocks
  11. Props
  12. API Types
  13. API Functions

LT_player_index

number LT_player_index(number user)

numberuser The user index (0 to LT_player_count()-1) to get entity index for

SERVER This has no effect if performed on the client (but will work in single player)

Returns the entity index for one of the players in the current game. In single player the only valid user index is 0 and it will always return the current player's entity index. When running on the server, users 0 through one less than the value returned by LT_player_count() are valid. For example, if there are 5 players, you can pass the values 0 through 4 to this function. Passing 2 as the user index will get the third player's entity index. Remember, both user index and entity index values are only safe to use within the same frame, do not rely on saving any of these values.