GetEntityCoords
сервер GET_ENTITY_COORDS
c
Vector3 GET_ENTITY_COORDS(Entity entity);Gets the current coordinates for a specified entity. This native is used server side when using OneSync.
See GET_ENTITY_COORDS for client side.
Параметры
- entity: The entity to get the coordinates from.
Возвращает
The current entity coordinates.
Примеры
lua
local function ShowCoordinates()
local player = source
local ped = GetPlayerPed(player)
local playerCoords = GetEntityCoords(ped)
print(playerCoords) -- vector3(...)
end
RegisterNetEvent("myCoordinates")
AddEventHandler("myCoordinates", ShowCoordinates)js
onNet('myCoordinates', () => {
const player = global.source; // use (global as any).source for Typescript
const ped = GetPlayerPed(player);
const [playerX, playerY, playerZ] = GetEntityCoords(ped);
console.log(`${playerX}, ${playerY}, ${playerZ}`);
});cs
using static CitizenFX.Core.Native.API;
// ...
// In class constructor
EventHandlers["myCoordinates"] += new Action<Player>(ShowCoordinates);
// Delegate method
private void ShowCoordinates([FromSource]Player player) {
Vector3 playerCoords = GetEntityCoords(player.Character);
// or the preferred use of C# wrapper
Vector3 playerCoords = player.Character.Position;
Debug.WriteLine($"{playerCoords}");
}Страница собрана автоматически из native-decls/GetEntityCoords.md. Нашли ошибку — поправьте исходный файл.