How to get X Y Z individually using GetEntityCoords?

while true do
    Wait(0)
	drawNotificationBoat("JUST A MESSAGE TO SEE IF ITS WORKING")
    local playerPos = GetEntityCoords(LocalPed())

	    drawTxt(playerPos,0,1,0.5,0.8,0.6,255,255,255,255)
	     DrawMarker(1,PlayerPos[1],PlayerPos[2],PlayerPos[3],0,0,0,0,0,0,4.001,4.0001,0.5001,0,155,255,200,0,0,0,0)
end

I am trying to get player position displayed on text (which works) and to draw a marker wherever the player is (for testing puposes only) I tried using just:

DrawMarker(1,PlayerPos,0,0,0,0,0,0,4.001,4.0001,0.5001,0,155,255,200,0,0,0,0)

It didn’t work

I tried using:

DrawMarker(1,PlayerPos[1],PlayerPos[2],PlayerPos[3],0,0,0,0,0,0,4.001,4.0001,0.5001,0,155,255,200,0,0,0,0)

It doesn’t work… Is there any way I can get the X Y Z individually to set the DrawMarker correctly?

If I remove the marker drawing code I get on text "Vector and a bunch of numbers as X,Y,Z… I would like to just be able to manipulate each individual coord such as X or Y or Z without the Vector

Lua is case-sensitive. playerPos is not the same as PlayerPos.

local playerPos = GetEntityCoords(LocalPed())
DrawMarker(1, playerPos.x, playerPos.y, playerPos.z,0,0,0,0,0,0,4.001,4.0001,0.5001,0,155,255,200,0,0,0,0)
--or
DrawMarker(1, GetEntityCoords(LocalPed()),0,0,0,0,0,0,4.001,4.0001,0.5001,0,155,255,200,0,0,0,0)
1 Like

thank you I didn’t know about .x .y .z it worked :slight_smile: