1. Animals
  2. Abilities
  3. Conditions
  4. Tool/Weapon
  5. Weapon Mods
  6. Orb
  7. Equipped
  8. Food/Medicine
  9. Furniture/Construction
  10. Color/Pattern
  11. Items
  12. Attributes
  13. Creatures
  14. Blocks
  15. Props
  16. API Types
  17. 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.