Native referenceRedM

COS

0xD0FFB162F40A139C BUILTIN
FUNCTION SIGNATURE
float COS(float value);
Property Value
Native Name COS
Hash 0xD0FFB162F40A139C
Return Type float
Build 1207
Parameters value (float)

Description: Returns the cosine of the given number.

Parameters

  • value (float) — The number of degrees (in degrees, not radians)

Usage

Lua (Direct):

local result = Cos(value)

Lua (Hash):

local result = Citizen.InvokeNative(0xD0FFB162F40A139C, value)

Examples

-- Get the heading
local heading = GetEntityHeading(PlayerPedId())
local cos = Cos(heading)

-- equivalent in lua
local cosLua = math.cos(heading * (math.pi / 180))
Back to BUILTIN