Difference between revisions of "getPlayerUID"

From Bohemia Interactive Community
Jump to navigation Jump to search
m
m (Text replacement - "ArmA 2: Operation Arrowhead" to "[[{{arma2oa}}]]")
 
(24 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Command|= Comments
+
{{Command|Comments=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| arma2 |= Game name
+
| arma2 |Game name=
  
|1.02|= Game version
+
|1.02|Game version=
 +
 
 +
|arg= global |Multiplayer Arguments=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
|  Return an uniqueID of the given unit as string if it's player and empty value if it's AI. |= Description
+
|  Return an uniqueID of the given unit as string if it's player and empty value if it's AI. The unique ID may be up to 100 characters long and may contain numbers, uppercase letters and underscores (the value can be used to construct a valid variable name by appending to another valid variable name).
 +
<br><br>
 +
Note: while for [[{{arma2}}]] or [[{{arma2oa}}]] until version 1.60 the result always contains a number, it should be always handled as an opaque string. Converting it to a [[Number]] can cause precision problems, as Number cannot accurately represent integers above 16777216 (2^24). Moreover, game versions since [[{{arma2oa}}]] 1.61 provide a non-numeric value as a result.<br/>
 +
<br/>
 +
{{warning | In some cases, the identity of certain player units might fail to propagate to other clients and the server, which causes [[isPlayer]] and [[getPlayerUID]] to incorrectly return <tt>[[false]]</tt> and <tt>""</tt>, respectively, where the affected units are [[not]] [[local]].<ref>https://github.com/michail-nikolaev/task-force-arma-3-radio/issues/1096</ref> Therefore, beware of false negatives.}} |DESCRIPTION=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| '''getPlayerUID''' unit |= Syntax
+
| '''getPlayerUID''' unit |SYNTAX=
 
 
|p1= unit: [[Object]] |= PARAMETER1
 
  
|p2= |= PARAMETER2
+
|p1= unit: [[Object]] |PARAMETER1=  
  
|p3= |= PARAMETER3
+
|p2= |PARAMETER2=  
  
| [[String]] |= RETURNVALUE
+
|p3= |PARAMETER3=  
  
 +
| [[String]] ("_SP_AI_", "_SP_PLAYER_" in SP, "" or UID number string in MP)
 +
|RETURNVALUE=
  
|x1= <code>_uid <nowiki>=</nowiki> '''getPlayerUID''' [[vehicle]] [[player]];</code> |= Example 1
+
|x1= <code>_uid <nowiki>=</nowiki> '''getPlayerUID''' [[player]];</code> |EXAMPLE1=
  
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| |= SEEALSO
+
| [[getPlayerUIDOld]], [[getClientState]], [[getClientStateNumber]] |SEEALSO=  
  
|mp= UID string is returned only in multiplayer.  |= MPBEHAVIOUR
+
|mp=   |MPBEHAVIOUR=  
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
 
}}
 
}}
Line 34: Line 40:
 
<dl class='command_description'>
 
<dl class='command_description'>
 
<!-- Note Section BEGIN -->
 
<!-- Note Section BEGIN -->
 
+
<dd class="notedate">Posted on April 17, 2014 - 22:29
 +
<dt class="note">'''[[User:Master85|Master85]] ([[User talk:Master85|talk]])'''<dd class="note">In Arma 3 the returned string is the steamID64 of the player. <code> _steamProfileUrl <nowiki>= "http://steamcommunity.com/profiles/"</nowiki> + ([[getPlayerUID]] [[player]]);</code>
 
<!-- Note Section END -->
 
<!-- Note Section END -->
 
</dl>
 
</dl>
  
 
<h3 style='display:none'>Bottom Section</h3>
 
<h3 style='display:none'>Bottom Section</h3>
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
+
 
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
+
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Command_Group:_Multiplayer|{{uc:{{PAGENAME}}}}]]

Latest revision as of 00:03, 20 February 2020

Introduced with Arma 2 version 1.021.02
Arguments of this scripting command don't have to be local to the client the command is executed on
Hover & click on the images for descriptions

Description

Description:
Return an uniqueID of the given unit as string if it's player and empty value if it's AI. The unique ID may be up to 100 characters long and may contain numbers, uppercase letters and underscores (the value can be used to construct a valid variable name by appending to another valid variable name).

Note: while for Arma 2 or Arma 2: Operation Arrowhead until version 1.60 the result always contains a number, it should be always handled as an opaque string. Converting it to a Number can cause precision problems, as Number cannot accurately represent integers above 16777216 (2^24). Moreover, game versions since Arma 2: Operation Arrowhead 1.61 provide a non-numeric value as a result.

In some cases, the identity of certain player units might fail to propagate to other clients and the server, which causes isPlayer and getPlayerUID to incorrectly return false and "", respectively, where the affected units are not local.[1] Therefore, beware of false negatives.

Syntax

Syntax:
getPlayerUID unit
Parameters:
unit: Object
Return Value:
String ("_SP_AI_", "_SP_PLAYER_" in SP, "" or UID number string in MP)

Examples

Example 1:
_uid = getPlayerUID player;

Additional Information

See also:
getPlayerUIDOldgetClientStategetClientStateNumber

Notes

i
Only post proven facts here. Report bugs on the feedback tracker. Use the Talk page or the Forums for discussions.

Notes

Posted on April 17, 2014 - 22:29
Master85 (talk)
In Arma 3 the returned string is the steamID64 of the player. _steamProfileUrl = "http://steamcommunity.com/profiles/" + (getPlayerUID player);

Bottom Section