Jump to content

Welcome to the Forum!

The best place to exchange builds and ideas! Vote for the best ideas and suggestions here.

Join the Avorion Discord!

Connect with other passionate players and talk about the latest news.
Discord

DLC Avorion Into the Rift Out Now!

Now available on Steam!
Steam

player.id property is not consumable from Lua.


General Inaptitude
 Share

Recommended Posts

Hello,

 

I was working on a command to output player information but ran into quite the snag trying to consume the PlayerId field property from the Player (server) object. However, I have tried everything I can think of, but it just will not work.

 

Other fields on the player object seem to consume just fine from the code I just wrote @ https://github.com/Joeppie/AvorionAdminScripts/blob/master/playerinfolist.lua

 

The following things do not work:

 

/run print (Player().id.id)

/run print (Player().id.name)

 

error: 'attempt to index UserData value'

 

for k, v in pairs(getmetatable(Player().id)) do
    print(k, type(v))
end

error: table is nil.

 

A 'normal' pairs construction  to try and consume the player.id fields also does not work.

 

The following does work:

 

/run print(Player().id)

 

outputs 'PlayerId'

 

I am unsure what to make of this, it might be that there are some things missing in the game code which expose the UserData PlayerId properly to the game?

 

If this is a bug, it would be nice to fix, since right now admins have a hard time understanding which steam ID is associated with a player unless they look into the log file to see when people logged in to (attempt) to correlate steam IDs with user names.

 

Steam nowadays allows you to delete your previous usernames, and Avorion does continue to use the original name someone has logged in with for the entire lifespan of the save file. This can mean that people can hide behind a different name.

 

Thank you for your time, and thank you @ Rinart73 for helping diagnose this problem.

- Inaptitude

Link to comment
Share on other sites

Thanks for the confirmation this will be fixed!

 

It makes life a lot easier, especially when there are little bugs around that make a <server>  say things like "Your non responsiveness is interpreted as a hostile act". I was seriously hunting for a trolling Steam player/user!  ;D

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
 Share

×
×
  • Create New...