{"hash":"0x1647F1CB","ns":"CFX","name":"GET_ENTITY_COORDS","slug":"GET_ENTITY_COORDS","official":true,"named":true,"luaName":"GetEntityCoords","game":"cfx","apiset":"server","returnType":"Vector3","params":[{"name":"entity","type":"Entity","description":"The entity to get the coordinates from."}],"returnsDescription":"The current entity coordinates.","summary":"Gets the current coordinates for a specified entity.","descriptions":[{"source":"cfx","format":"md","body":"Gets the current coordinates for a specified entity. This native is used server side when using OneSync.\n\nSee [GET_ENTITY_COORDS](#\\_0x3FEF770D40960D5A) for client side."}],"examples":[{"lang":"lua","code":"local function ShowCoordinates()\n    local player = source\n    local ped = GetPlayerPed(player)\n    local playerCoords = GetEntityCoords(ped)\n\n    print(playerCoords) -- vector3(...)\nend\n\nRegisterNetEvent(\"myCoordinates\")\nAddEventHandler(\"myCoordinates\", ShowCoordinates)","source":"cfx"},{"lang":"js","code":"onNet('myCoordinates', () => {\n  const player = global.source; // use (global as any).source for Typescript\n  const ped = GetPlayerPed(player);\n  const [playerX, playerY, playerZ] = GetEntityCoords(ped);\n\n  console.log(`${playerX}, ${playerY}, ${playerZ}`);\n});","source":"cfx"},{"lang":"cs","code":"using static CitizenFX.Core.Native.API;\n// ...\n\n// In class constructor\nEventHandlers[\"myCoordinates\"] += new Action<Player>(ShowCoordinates);\n\n// Delegate method\nprivate void ShowCoordinates([FromSource]Player player) {\n    Vector3 playerCoords = GetEntityCoords(player.Character);\n\n    // or the preferred use of C# wrapper\n    Vector3 playerCoords = player.Character.Position;\n\n    Debug.WriteLine($\"{playerCoords}\");\n}\n","source":"cfx"}],"aliases":[],"enums":[],"related":["0xDF70B41B"],"sources":["cfx"],"doc":3,"url":"https://natives.borderlinerp.com/natives/CFX/GET_ENTITY_COORDS","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/GET_ENTITY_COORDS.md","snippets":{"lua":"local retval = GetEntityCoords(entity)","luaInvoke":"local retval = Citizen.InvokeNative(0x1647f1cb, entity, Citizen.ResultAsVector())","js":"const retval = GetEntityCoords(entity);","jsInvoke":"const retval = Citizen.invokeNative('0x1647f1cb', entity, Citizen.returnResultAnyway(), Citizen.resultAsVector());","csharp":"Vector3 retval = Function.Call<Vector3>((Hash)0x1647f1cb, entity);","notes":[]}}