Attempt to index a nil value (local 'coords')

Hello, im trying to install pd-spawn, and i crashed into this problem, i’m really not sure how to solve it

When joining and selecting last position

[    150781] [b2545_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @es_extended/client/functions.lua:369: attempt to index a nil value (local 'coords')^7
[    150781] [b2545_GTAProce]             MainThrd/ ^3> ref^7 (^5@es_extended/client/functions.lua^7:369)
[    150781] [b2545_GTAProce]             MainThrd/ ^3> callback^7 (^5@pd-spawn/client/client.lua^7:61)

this is the pd-spawn/client/main.lua

elseif data.choice == "last" then  
        ESX.Game.Teleport(PlayerPedId(), ESX.PlayerData.coords)
        ... stuff not important for this

and this is the es_extended/client/functions.lua

function ESX.Game.Teleport(entity, coords, cb)
	local vector = type(coords) == "vector4" and coords or type(coords) == "vector3" and vector4(coords, 0.0) or vec(coords.x, coords.y, coords.z, coords.heading or 0.0)

	if DoesEntityExist(entity) then
		RequestCollisionAtCoord(vector.xyz)
		while not HasCollisionLoadedAroundEntity(entity) do
			Wait(0)
		end

		SetEntityCoords(entity, vector.xyz, false, false, false, false)
		SetEntityHeading(entity, vector.w)
	end

	if cb then
		cb()
	end
end

users.position in SQL is varchar(255) with default value {"x":-1038.58,"y":-2737.71,"z":20.17,"heading":333.3} (airport)

im using oxmysql and esx legacy 1.7.0

This script wasn’t updated for 2 years so you will need to figure it out with yourself, because I don’t think someone will help you with outdated script.

it seems to be problem in usage of ESX.Game.Teleport(PlayerPedId(), ESX.PlayerData.coords), and im using newest esx so someone maybe would know.

This error tells us that variable coords in function is nil. Which means that ESX.PlayerData.coords is nil. SQL data is either not being updated or not accessed at all, depends on server.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.