When I try to get my current coordinates, it always equates to 0, 0, 0?
RegisterCommand('911', function(source, args)
local player = source
local ped = GetPlayerPed(player)
local playerCoords = GetEntityCoords(ped, false)
-- TriggerEvent('callBlip', playerCoords)
print(playerCoords)
end)
Assuming youâre on client, source
is the players server id so you would need to use GetPlayerServerId
and make sure to check it doesnât return -1
If youâre on the client then this is valid (the server has no concept of a âlocal playerâ like the client does, hence anything marked as player/playerSrc would just be their source.) , and you should check to make sure you have one sync on
1 Like
If youâre on client, use this:
local ped = PlayerPedId()
(no need for source)
If youâre on server, code should be fine. If it doesnât work, you could try to move the Register Command to a Client script, then triggering a Server Event with the exact same code. Of course, rather than TriggerEvent âcallBlipâ you should use:
TriggerClientEvent('callBlip', player, playerCoords)
Remember that, when calling TriggerClientEvent, first parameter must be always the target client, so itâs either source (or player, in your case), or -1 for all clients
1 Like