Im new to lua and i dont know how to code a /getpos command i want the command to give me the ingame coordinates where iam. i dont found a /getpos command if u find one please link it
I usually just use lambda for the coords but if you give me one minute i can write you a client get pos if you want.
yes would really appreciat that
RegisterCommand("getpos", function(source, args, raw)
local ped = GetPlayerPed(PlayerId())
local coords = GetEntityCoords(ped, false)
local heading = GetEntityHeading(ped)
Citizen.Trace(tostring("X: " .. coords.x .. " Y: " .. coords.y .. " Z: " .. coords.z .. " HEADING: " .. heading))
end, false)
where do i paste this in?
its a client script.
where do i find citmp-server.yml
i figured it out but one question can u do so i get the pos in chat only for me instead of in console
RegisterCommand("getpos", function(source, args, raw)
local ped = GetPlayerPed(PlayerId())
local coords = GetEntityCoords(ped, false)
local heading = GetEntityHeading(ped)
TriggerEvent("chatMessage", tostring("X: " .. coords.x .. " Y: " .. coords.y .. " Z: " .. coords.z .. " HEADING: " .. heading))
end, false)
hello, this is obviously late but I am wanting to start in java script, whenever I change “local” to “val” it corrects the erros for the variables, but it still shows errors in the trigger event line, I replaced the “…” with a “,” and it took away the errors but am not sure what may be the cause of it not working
RegisterCommand("getpos", () => {
const ped = GetPlayerPed(PlayerId());
const coords = GetEntityCoords(ped, false);
const heading = GetEntityHeading(ped)
emit("chatMessage", `X: ${coords.x} Y: ${coords.y} Z: ${coords.z} H: ${heading}`);
})
Maybe something like this? I don’t remember the chat events anymore so hopefully that still works. I also don’t usually use JS for things like this but