Mirknir Posted October 28, 2015 Share Posted October 28, 2015 (edited) 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 October 28, 2015 by Mirknir Mirknir My old server: The Thread Link to comment Share on other sites More sharing options...
Grimes Posted October 28, 2015 Share Posted October 28, 2015 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 Server, Scripting 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 More sharing options...
Mirknir Posted October 29, 2015 Author Share Posted October 29, 2015 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 More sharing options...
Yurgon Posted October 29, 2015 Share Posted October 29, 2015 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 More sharing options...
Mirknir Posted October 29, 2015 Author Share Posted October 29, 2015 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. True Mirknir My old server: The Thread Link to comment Share on other sites More sharing options...
Coug4r Posted December 28, 2015 Share Posted December 28, 2015 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 More sharing options...
Coug4r Posted December 30, 2015 Share Posted December 30, 2015 Well... that was faster than expected... For v1.5 will do :) - If man were meant to fly he'd be filled with helium. Link to comment Share on other sites More sharing options...
OzDeaDMeaT Posted August 15, 2020 Share Posted August 15, 2020 How do you get the UCID out of DCS? CPU: i9-12900K @ 4.9Ghz M/B: MSI MEG z690 Ace RAM: 128GB Video Card: MSI RTX 4090 Suprim Liquid X VR: Varjo Aero Link to comment Share on other sites More sharing options...
Grimes Posted August 15, 2020 Share Posted August 15, 2020 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 Server, Scripting 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 More sharing options...
OzDeaDMeaT Posted August 16, 2020 Share Posted August 16, 2020 Thanks mate, I eventually found that the UCID is referenced if you enable SLMOD statistics. CPU: i9-12900K @ 4.9Ghz M/B: MSI MEG z690 Ace RAM: 128GB Video Card: MSI RTX 4090 Suprim Liquid X VR: Varjo Aero Link to comment Share on other sites More sharing options...
Recommended Posts