netId: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (example) |
Killzone Kid (talk | contribs) No edit summary |
||
Line 38: | Line 38: | ||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands|{{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"> | |||
[[netId]] in SP is "". Here is the function that will give you universal [[netId]] that works both in SP and MP | |||
<code>KK_fnc_netId <nowiki>=</nowiki> { | |||
[[if]] ([[isMultiplayer]]) [[exitWith]] {[[netId]] _this}; | |||
[[private]] "_netId"; | |||
_netId <nowiki>=</nowiki> _this [[getVariable]] "_netId"; | |||
[[if]] ([[isNil]] "_netId") [[then]] { | |||
KK_var_globID <nowiki>=</nowiki> ([[missionNamespace]] [[getVariable]] ["KK_var_globID", 0]) + 1; | |||
_netId <nowiki>=</nowiki> [[format]] ["0:%1", KK_var_globID]; | |||
_this [[setVariable]] ["_netId", _netId]; | |||
}; | |||
_netId | |||
}; | |||
//example | |||
_playerNetId <nowiki>=</nowiki> [[player]] [[call]] KK_fnc_netId; | |||
</code> | |||
</dd> | |||
</dl> | |||
<!-- DISCONTINUE Notes --> |
Revision as of 10:55, 2 April 2015
Description
- Description:
- Unique ID of object or group.
- Groups:
- Uncategorised
Syntax
Examples
Additional Information
- See also:
- objectFromNetId
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
Notes
Bottom Section
- Posted on April 2, 2015 - 09:55 (UTC)
- Killzone Kid
-
netId in SP is "". Here is the function that will give you universal netId that works both in SP and MP
KK_fnc_netId = { if (isMultiplayer) exitWith {netId _this}; private "_netId"; _netId = _this getVariable "_netId"; if (isNil "_netId") then { KK_var_globID = (missionNamespace getVariable ["KK_var_globID", 0]) + 1; _netId = format ["0:%1", KK_var_globID]; _this setVariable ["_netId", _netId]; }; _netId }; //example _playerNetId = player call KK_fnc_netId;