Skip to content

Add #4498: Expose CPU info with a detectable client opt-out - #5205

Open
x6c85 wants to merge 3 commits into
multitheftauto:masterfrom
x6c85:feature/4498-cpu-info
Open

Add #4498: Expose CPU info with a detectable client opt-out#5205
x6c85 wants to merge 3 commits into
multitheftauto:masterfrom
x6c85:feature/4498-cpu-info

Conversation

@x6c85

@x6c85 x6c85 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds client getCPUInfo() and server getPlayerCPUInfo(player) so scripts can read CPU name, max clock, cores, threads and L1/L2/L3 cache sizes.

Sharing is on by default (allow_cpu_info, Settings → Multiplayer → Allow CPU info). When the player opts out, hardware fields are omitted and the table only contains AllowCPUInfo = false, so a server resource cannot recover the data through a client event.

The client sends PACKET_ID_PLAYER_CPUINFO at join (appended after existing packet ids). The server stores it, fires onPlayerCPUInfo, and getPlayerCPUInfo returns false until that packet arrives (old clients stay false).

-- client
local info = getCPUInfo()
if info.AllowCPUInfo then
    outputChatBox(info.Name)
end

-- server
addEventHandler("onPlayerCPUInfo", root, function(allowed)
    if not allowed then
        kickPlayer(source, "Enable Allow CPU info")
    end
end)

Motivation

Fixes #4498. GPU details are already exposed via dxGetStatus with no opt-out. CPU info is useful for quality presets and for servers that want to reject clients who hide it, similar to screen upload.

Test plan

  1. F8 getCPUInfo() - expect AllowCPUInfo = true plus name, MHz, cores, threads and cache.
  2. Uncheck Allow CPU info, reconnect - client returns only AllowCPUInfo = false; server getPlayerCPUInfo is the same table, not false.
  3. Connect an older client - getPlayerCPUInfo stays false (no packet).
  4. Confirm onPlayerCPUInfo runs after join and can kick when allowed == false.
  5. Cars/other settings tabs still work; Allow CPU info sits under Allow screen upload.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

@FileEX FileEX added the enhancement New feature or request label Aug 21, 2026
@PlatinMTA

Copy link
Copy Markdown
Contributor

I know this is technically not in the scope of this PR, but if this gets merged we should consider an opt-out for sending GPU information from dxGetStatus().

@FileEX

FileEX commented Aug 23, 2026

Copy link
Copy Markdown
Member

I know this is technically not in the scope of this PR, but if this gets merged we should consider an opt-out for sending GPU information from dxGetStatus().

#4535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a way to retrieve CPU information

3 participants