RedM Natives

GET_CURRENT_SCREEN_RESOLUTION

Gets the current screen resolution.

Hash0x337F0116
Runtime nameGetCurrentScreenResolution
NamespaceCFX
SideClient
NameOfficial
Docs

Signature

void GET_CURRENT_SCREEN_RESOLUTION(int* width, int* height);

Parameters

NameTypeDescription
widthint*—
heightint*—

Returns void

Description

Cfx.re native reference

Gets the current screen resolution.

local  width, height = GetCurrentScreenResolution()
print(string.format("Current screen resolution: %dx%d", width, height))

Usage

Lua
local width, height = GetCurrentScreenResolution()

-- always works, by hash
local width, height = Citizen.InvokeNative(0x337f0116, Citizen.PointerValueInt(), Citizen.PointerValueInt())
JavaScript and C#
JavaScript
const [width, height] = GetCurrentScreenResolution();

// by hash
const [width, height] = Citizen.invokeNative('0x337f0116', Citizen.pointerValueInt(), Citizen.pointerValueInt());
C#
var width = new OutputArgument();
var height = new OutputArgument();
Function.Call((Hash)0x337f0116, width, height);
// width.GetResult<int>()
// height.GetResult<int>()
  • Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.

Sources

Cfx.re native reference

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.