Jump to content

Getting player object based on name.


Aki

Recommended Posts

There are two lua commands: say and echo. I'm trying to make small script for... reasons. But I'm having hard time to get player object based on name, I have tried various function names on Server() or sender or Player()but none of them was successful. I know that I just need playerIndex from somewhere (based on sender).

 

Thanks in advance.

Link to comment
Share on other sites

  • Boxelware Team

It depends on the context of the script. Client scripts can just call Player(), while server scripts generally have to use Galaxy():findFaction(name). If you're editing a player script on the server, call getParentFaction(), it will return the player.

Link to comment
Share on other sites

Thank you! So it was Galaxy()... Now when I think of it. It makes sense, because playerIndex is faction (some bug report told me about it) and after all our names are faction names. Now I'm angry on myself for not figuring that out.

 

Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...