Jump to content

Unique ID for Player over the course of the mission?


Mirknir

Recommended Posts

Hello fellow mission builders!

 

I am making a map script for my server, a script centered around players.

I want to keep info and data for each players over the duration of the map.

 

The problem is: I don't have an unique identifier for players

 

The information I have are:

Unit.getPlayerName: Not unique

Unit.getID: Unique but will not survive a player changing aircrafts and soon, there might be 2 players per unit (L39)

 

Ideally, I would like to get the player Unique Client ID (UCID) or the Client IP address. Both of those would be unique for the session.

 

Any idea of how to reach those information in the mission environnement?

Is there a value I've overlooked that would do the job?

 

As a side note,

How will Unit.getPlayerName work with L39 kind of planes? I guess a seat and seat count will be added in script?

 

Thanks


Edited by Mirknir

Mirknir

My old server:

The Thread

Link to comment
Share on other sites

Ideally, I would like to get the player Unique Client ID (UCID) or the Client IP address. Both of those would be unique for the session.

 

Any idea of how to reach those information in the mission environnement?

Is there a value I've overlooked that would do the job?

 

You have to use the net environment to get UCID or clients IP addresses, at which point it turns into a server side mod. I can't give you a definitive "how to" get that data since the API is still under heavy development with 1.5.

 

As a side note,

How will Unit.getPlayerName work with L39 kind of planes? I guess a seat and seat count will be added in script?

 

That is a good question of which I don't know the answer to. I'll have to test it out and likely file a bug report.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Thanks for the answer.

 

You have to use the net environment to get UCID or clients IP addresses, at which point it turns into a server side mod. I can't give you a definitive "how to" get that data since the API is still under heavy development with 1.5..

 

I see a lot of DCS mission scripts using player name as a way to address players and they won't work properly with players with identical names.

 

I think having an unique ID directly in Unit could be a real good idea to avoid having to transfer scripts to the net env.

The game, map, mission and many scripts are already centered around players so having this unique ID easy to reach in Unit could really be nice.

Also, this would work with the other APIs since:

- Unit is already where we retreive the player name

- Unit is already the argument for a lot of event callback like S_EVENT_PLAYER_ENTER_UNIT

 

If the UCID is not supposed to be visible from there, maybe the CRC32 or CRC64 of it could suffice.

 

 

That is a good question of which I don't know the answer to. I'll have to test it out and likely file a bug report.

 

I think I would try adding a seatIndex, maybe something like this:

Unit.getSeatCount()

Unit.getPlayerName(seatIndex)

Unit.getSeatDesc(seatIndex) if we need more info like the seat type or category

 

Events like S_EVENT_PILOT_DEAD, S_EVENT_PLAYER_ENTER_UNIT... would have an extra seatIndex param

 

Thanks

Mirknir

My old server:

The Thread

Link to comment
Share on other sites

Ideally, I would like to get the player Unique Client ID (UCID) or the Client IP address. Both of those would be unique for the session.

 

I don't think that's true for the IP. Imagine two or more people sharing their Internet connection, LAN party, or people getting routed through proxies.

 

If at all possible, a UCID would be much preferred IMO.

Link to comment
Share on other sites

  • 1 month later...
You have to use the net environment to get UCID or clients IP addresses, at which point it turns into a server side mod. I can't give you a definitive "how to" get that data since the API is still under heavy development with 1.5.

 

 

 

That is a good question of which I don't know the answer to. I'll have to test it out and likely file a bug report.

 

Could you provide us with a method that works on v1.2? Could still take some time before v1.5 is stable/non beta.

-

If man were meant to fly he'd be filled with helium.

Link to comment
Share on other sites

  • 4 years later...

A bit of a thread revive.

 

It only exists in the net environment. So code you run from savedgames/DCS/scripts/hooks/whatever_gameGUI.lua

 

You'd make a callback for onPlayerConnect, onPlayerChangeSlot, or really anything that has an id as part of the function to get their ucid via

ucid = net.get_player_info(id, 'ucid')

 

id being provided by that callback. For example:

 

https://github.com/mrSkortch/DCS-SLmod/blob/master/Scripts/net/Slmodv7_5/SlmodCallbacks.lua#L463

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...