netId: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - ">Posted on October ([0-9]{2})[ a-zA-Z]*, ([0-9]{4})" to ">Posted on $2-10-$1")
 
(41 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 0.50


|0.50|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.63


| Unique ID of object or group. See also: [[BIS_fnc_objectVar]] |= Description
|gr1= Multiplayer
____________________________________________________________________________________________


| '''netId''' var |= Syntax
|descr= Unique ID of object or group.  As this command is MP only, you can use [[BIS_fnc_netId]], which extends the use to SP as well. See also: [[BIS_fnc_objectVar]]


|p1= var: [[Object]] or [[Group]]  |= PARAMETER1 
|s1= [[netId]]  var


| [[String]] |= RETURNVALUE
|p1= var: [[Object]] or [[Group]]


|r1= [[String]]


|x1= <code>_playerNetId = [[netId]] [[player]];</code>|= EXAMPLE1
|x1= <sqf>_playerNetId = netId player;</sqf>


____________________________________________________________________________________________
|seealso= [[objectFromNetId]] [[groupFromNetId]] [[BIS_fnc_objectFromNetId]] [[BIS_fnc_netId]] [[BIS_fnc_groupFromNetId]] [[BIS_fnc_objectVar]]
 
| [[objectFromNetId]] |= SEEALSO
 
|  |= MPBEHAVIOUR
____________________________________________________________________________________________
}}
}}


<h3 style='display:none'>Notes</h3>
<dl class="command_description">
<dl class='command_description'>
<!-- Note Section BEGIN -->


<!-- Note Section END -->
<dt></dt>
</dl>
<dd class="notedate">Posted on 2018-10-19 - 13:40 (UTC)</dd>
 
<dt class="note">[[User:demellion|demellion]]</dt>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on April 2, 2015 - 09:55 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
<dd class="note">
[[netId]] in SP is "". Here is the function that will give you universal [[netId]] that works both in SP and MP
'''NOTE:''' Even if the returned value is in format of '''owner:uniqueid''', it doesn't follow the current ownership of an object ([[owner]] for example).
<code>KK_fnc_netId <nowiki>=</nowiki> {
<br>This command keeps the '''original owner''' of a created object.
[[if]] ([[isMultiplayer]]) [[exitWith]] {[[netId]] _this};
</dd>
[[if]] ([[typeName]] _this !<nowiki>=</nowiki> "OBJECT" || {[[isNull]] _this}) [[exitWith]] {""};
[[if]] ([[isNil]] "KK_globIDs") [[then]] {KK_globIDs <nowiki>=</nowiki> [0]};
[[private]] ["_i", "_cnt", "_netId"];
_i <nowiki>=</nowiki> KK_globIDs [[find]] _this;
[[if]] (_i < 0) [[exitWith]] {
_cnt <nowiki>=</nowiki> (KK_globIDs [[select]] 0) + 1;
KK_globIDs [[set]] [0, _cnt];
_netId <nowiki>=</nowiki> [[format]] ["0:%1", _cnt];
KK_globIDs [[append]] [_netId, _this];
_netId
};
KK_globIDs [[select]] (_i - 1)
};


//example
[[hint]] ([[player]] [[call]] KK_fnc_netId);
</code>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 00:12, 14 May 2023

Hover & click on the images for description

Description

Description:
Unique ID of object or group. As this command is MP only, you can use BIS_fnc_netId, which extends the use to SP as well. See also: BIS_fnc_objectVar
Groups:
Multiplayer

Syntax

Syntax:
netId var
Parameters:
var: Object or Group
Return Value:
String

Examples

Example 1:
_playerNetId = netId player;

Additional Information

See also:
objectFromNetId groupFromNetId BIS_fnc_objectFromNetId BIS_fnc_netId BIS_fnc_groupFromNetId BIS_fnc_objectVar

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on 2018-10-19 - 13:40 (UTC)
demellion
NOTE: Even if the returned value is in format of owner:uniqueid, it doesn't follow the current ownership of an object (owner for example).
This command keeps the original owner of a created object.