Whats the problem with this function?

Hello everybody,

I get every time an error when trying to use this function, but I can find no fault. Please help me.

Function:

function IsPlayerNearChar(char, radius)
	local pos = table.pack(GetCharCoordinates(GetPlayerPed(), _f, _f, _f))
	local pos2 = table.pack(GetCharCoordinates(char, _f, _f, _f))
	local dist = GetDistanceBetweenCoords3D(pos2[1], pos2[2], pos2[3], pos[1], pos[2], pos[3], _f)
	if(dist <= radius) then return true
	else return false
	end
end

Error:

Sorry for my bad english.

There is no native called GetDistanceBetweenCoords3D()

There is this:

GetDistanceBetweenCoords( x1, y1, z1, x2, y2, z2, useZ[true or false]) – Determines if distance will also count in the Z coord

Thanks for the quick reply, but it’s for GTA IV Multiplayer.

https://www.gtamodding.com/wiki/GET_DISTANCE_BETWEEN_COORDS_3D

Try GetDistanceBetweenCoords3d (lowercase D) - also check citizen/natives.lua and citizen/natives_hl.lua.

Natives are mapped to be lowercase except the first character after an underscore.

Also, where are you still playing CitizenFX:IV? :confused:

@hydrogen

You were right. Thanks alot. I playing it on http://citizenfx-reloaded.tk/.