Skip to content

fix: admins missing UI controls when JIP joining - #125

Merged
fank merged 5 commits into
OCAP2:mainfrom
thegamecracks:thegamecracks/fix-jip-admin-connect
Aug 4, 2026
Merged

fix: admins missing UI controls when JIP joining#125
fank merged 5 commits into
OCAP2:mainfrom
thegamecracks:thegamecracks/fix-jip-admin-connect

Conversation

@thegamecracks

@thegamecracks thegamecracks commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Clients connecting to the server with their steam ID in the administrator list or logging in during the lobby don't receive the admin UI controls when joining a mission in progress.

Seemingly in this situation, the PlayerConnected mission EH fires before getUserInfo has a player object to return, resulting in the log:

[OCAP] (recorder) WARNING: getUserInfo unit (index 10) is null for PID 1431421350 (UID: 7656...)

When backing out to the lobby and rejoining, i.e. not fully disconnecting from the server, the EH receives the player object and adds the controls as normal.

To solve this, an OnUserSelectedPlayer EH is added to wait until the player object exists and transfers locality:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#OnUserSelectedPlayer

This is the earliest the player object is known when player joins the server, but it is not local to the user yet, so there is a wait time depending on network connection.

Unlike PlayerConnected EH, OnUserSelectedPlayer does not fire for non-JIP players, so this would ironically break non-JIP admins. OCAP_recorder_fnc_init also documented an edge case where OCAP initialization may occur too late for the PlayerConnected EH to pick up non-JIP players, and so it calls adminUIcontrol there.

However, that code passed str owner _x to getUserInfo which expects a DirectPlayer ID, not a machine network ID. This fixes it to use the correct command, getPlayerID, so both JIP and non-JIP admins receive their controls.

@thegamecracks

Copy link
Copy Markdown
Contributor Author

Also another weird behaviour: #logout will remove admin controls even if the user is already in the administrator list. Not sure if this is considered a bug or is intentional (maybe an admin wants to hide the controls?), but I'll mention it anyway.

fank
fank previously requested changes Aug 4, 2026

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Root-cause research confirms the overall direction: PlayerConnected exposes the network user before getUserInfo is guaranteed to have a player object, and the existing str owner _x fallback used the wrong identifier namespace (machine owner ID rather than DirectPlay ID). Moving the JIP path to OnUserSelectedPlayer and waiting for Local matches Bohemia's documented recommendation.

hemtt check, hemtt build, and the PR's CI build pass. I am requesting changes for the documented objNull terminal path below, because it still leaves affected JIP admins without controls. I also left one non-blocking documentation correction.

Comment thread addons/recorder/fnc_eh_onUserSelectedPlayer.sqf Outdated
Comment thread addons/recorder/fnc_eh_onUserSelectedPlayer.sqf Outdated
Clients connecting to the server with their steam ID in the administrator
list, or logging in during the lobby, don't receive the admin UI controls
when joining a mission in progress.

Seemingly in this situation, the PlayerConnected mission EH fires before
getUserInfo has a player object to return, resulting in the log:
> [OCAP] (recorder) WARNING: getUserInfo unit (index 10) is null for PID 1431421350 (UID: 7656...)

When backing out to the lobby and rejoining, i.e. not fully disconnecting
from the server, the EH receives the player object and adds the controls
as normal.

To solve this, an OnUserSelectedPlayer EH is added to wait until the
player object exists and transfers locality:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#OnUserSelectedPlayer
> This is the earliest the player object is known when player joins the server,
> but it is not local to the user yet, so there is a wait time depending on
> network connection.
Unlike PlayerConnected EH, OnUserSelectedPlayer does not fire
for non-JIP players, so the previous commit ironically broke non-JIP admins.

OCAP_recorder_fnc_init documents an edge case where OCAP initialization may
occur too late for the PlayerConnected EH to pick up non-JIP players,
and so it calls adminUIcontrol there.

However, `getUserInfo` expects a DirectPlayer ID from `getPlayerID`,
not a machine network ID as would be returned by `str owner _x`.
This fixes it to use the correct command.
@thegamecracks
thegamecracks force-pushed the thegamecracks/fix-jip-admin-connect branch from 3cfc130 to eb54987 Compare August 4, 2026 10:55
@thegamecracks
thegamecracks requested a review from fank August 4, 2026 11:20
@thegamecracks

Copy link
Copy Markdown
Contributor Author

Noting that last force push was to rebase main branch into this branch which merged #124.

@fank
fank dismissed their stale review August 4, 2026 11:25

Both requested changes were addressed in commits c259a9e and 0cc7e1a/624ea2e; re-reviewed at 624ea2e.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 624ea2e. Both prior findings are addressed: the documented objNull path now performs a bounded getUserInfo retry with timeout logging, and the non-JIP comment now accurately describes the preInit/postInit timing confirmed by dedicated-server logs. The CBA timeout argument handling matches CBA_fnc_waitUntilAndExecute. hemtt check, hemtt build, and PR CI pass. No further findings.

@fank
fank merged commit acf6043 into OCAP2:main Aug 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants