[Abandoned] [FREE] ESX Real Parking v1.4 | Real Life Parking | Parking Anywhere | Optimized

This is the function, but i need help to get it !

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local veh = GetVehiclePedIsTryingToEnter(PlayerPedId())
local window = IsVehicleWindowIntact(veh, 0)
if window then
TriggerEvent(‘esx_nocarjack:setVehicleDoors’)
else
SetVehicleDoorsLocked(veh, 1)
SetVehicleDoorsLockedForAllPlayers(veh, false)
end
end
end)

saving damage is actually a fairly complicated process, especially since it’s dynamic. i’ve seen maybe one script (paid) that claimed to do it successfully. you might have an easier time finding that script and integrating it’s features into this one than getting this developer to implement the save damage functionality. (mentioning cuz i was thinking about doing the same when i can find the time ^_^)

Eh so I used this and when someone left or joined cars would get DUPLICATED and stack on top of each other can you fix this?

Hey Zastaax,
Were you able to fix a solution to this. I am looking at the exporting commands to allow Real Parking to save and set the fuel level and it seems easy to do. But I am have a hard time finding where the car is stored in the script. I am only able to set the fuel to 100 when taking it out but not set it to the last known fuel.

yes it was run fine

I saw a code from someone above, but that code does not work very well,
this code works fine, if you want to use the /park where you want command

go to client.lua Add this below to create the /park chat command

isUsingParkCommand = false
RegisterCommand('park', function(source)
	isUsingParkCommand = true
end, false)

replace the code in client.lua (somewhere on line 373) under
– Logic thread

to this.

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		local pl        = GetEntityCoords(GetPlayerPed(-1))
		local inParking = false
		local parkName  = nil
		for k, v in pairs(Config.ParkingLocations) do
			if pl.x > v.x - v.size and pl.x < v.x + v.size and pl.y > v.y - v.size and pl.y < v.y + v.size and pl.z > v.z - v.height and pl.z < v.z + v.height then
			    inParking = true
				parkName  = k
			end
		end
		if inParking and IsPedInAnyVehicle(GetPlayerPed(-1)) then
			local storedVehicle = GetPedInStoredCar(GetPlayerPed(-1))
			if storedVehicle ~= false then
				DisplayHelpText(_U("drive_out_parking"))
			    if IsControlJustReleased(0, 51) then
					isUsingParkCommand = true
				end
			end
			if isUsingParkCommand then --when you are using the /park command
			    isUsingParkCommand = false --turn it of right now
				if storedVehicle ~= false then
					DoScreenFadeOut(250)
					Wait(500)
					ESX.TriggerServerCallback("esx_realparking:driveCar", function(callback)
						if callback.status then
							DeleteVehicle(storedVehicle.entity)
							DeleteVehicle(GetVehiclePedIsIn(GetPlayerPed(-1)))
							storedVehicle = nil
							Wait(500)
							DriveVehicle(callback.vehData)
							ESX.ShowNotification(callback.message)
						else
							ESX.ShowNotification(callback.message)
						end
						Wait(1000)
						DoScreenFadeIn(250)
					end, storedVehicle)
				else
					local veh = GetVehiclePedIsIn(GetPlayerPed(-1))
					if veh ~= 0 then
						if IsThisModelACar(GetEntityModel(veh)) or IsThisModelABike(GetEntityModel(veh)) or IsThisModelABicycle(GetEntityModel(veh)) then
							local vehProps  = ESX.Game.GetVehicleProperties(veh)
							local vehPos    = GetEntityCoords(veh)
							local vehHead   = GetEntityHeading(veh)
							local engHealth = GetVehicleEngineHealth(veh)
							local bdyHealth = GetVehicleBodyHealth(veh)
							local tnkHealth = GetVehiclePetrolTankHealth(veh)
							LastPlate       = vehProps.plate
							DoScreenFadeOut(250)
							Wait(500)
							ESX.TriggerServerCallback("esx_realparking:saveCar", function(callback)
								if callback.status then
									DeleteVehicle(veh)
									ESX.ShowNotification(callback.message)
								else
									ESX.ShowNotification(callback.message)
								end
								Wait(1000)
								DoScreenFadeIn(250)
							end, {
								location = {x = vehPos.x, y = vehPos.y, z = vehPos.z, h = vehHead},
								props    = vehProps,
								parking  = parkName,
								livery   = GetVehicleLivery(veh),
								health   = {
									engine = engHealth,
									body   = bdyHealth,
									tank   = tnkHealth
								}
							})
						else
							ESX.ShowNotification(_U("only_allow_car"))
						end
					end
				end
			end
		end
	end
end)

add this to your locale.lua

["drive_out_parking"] = "Press ~INPUT_CONTEXT~ to drive",

and dont forgot the config.lua

Config.ParkingLocations = {

	allparking = {
		x      = 232.11,                               -- Central location X, Y, Z of the parking
		y      = -770.14,                               -- Y
		z      = 30.31,                                 -- Z
		size   = 9999999.0,                                  -- The parking range radius (Horizontal)
		height = 66.10,                                  -- The parking range radius (Vertical)
		name   = "Public Parking",                      -- The name of the parking (blips)
		fee    = 100,                                  -- How much parking fee per day (Real life time), set 0 to disable
		enter  = {x = 212.57, y = -808.48, z = 30.50}, -- The entrance of the parking
		maxcar = 500,
	}
}

So you are good to go by using /park to park and press E to drive again.

Sorry for my bad englisch, its not me main language.

I thought people were interested in this

So i hope this helps you out!

Greetz MaDHouSe

Hey :slight_smile: Nice Script first of all. I would like to paste that into my server but instead of “limit” I use the “weight” system so i cant put the “sql” file into my database. Is there a solution for that or can I just re-write that. Thanks

Hi @ Taqqz!

This script has no weight or limit at all. so you can use it anyway :wink:

or use the trunk or glovebox scirpt for this, and this handle it for you,
this script only add the properties of the vehicle but not the storage,
thats a diffrend script :wink:

if veh ~= 0 then
	if IsThisModelACar(GetEntityModel(veh)) or IsThisModelABike(GetEntityModel(veh)) or IsThisModelABicycle(GetEntityModel(veh)) then
		local vehProps  = ESX.Game.GetVehicleProperties(veh)
		local vehPos    = GetEntityCoords(veh)
		local vehHead   = GetEntityHeading(veh)
		local engHealth = GetVehicleEngineHealth(veh)
     	local bdyHealth = GetVehicleBodyHealth(veh)
		local tnkHealth = GetVehiclePetrolTankHealth(veh)
		LastPlate       = vehProps.plate
		DoScreenFadeOut(250)
		Wait(500)
		ESX.TriggerServerCallback("esx_realparking:saveCar", function(callback)
		if callback.status then
			DeleteVehicle(veh)
			ESX.ShowNotification(callback.message)
		else
    		ESX.ShowNotification(callback.message)
		end
		Wait(1000)
		DoScreenFadeIn(250)
	end, {
     	location = {x = vehPos.x, y = vehPos.y, z = vehPos.z, h = vehHead},
		props    = vehProps,
		parking  = parkName,
		livery   = GetVehicleLivery(veh),
		health   = {
			engine = engHealth,
			body   = bdyHealth,
			tank   = tnkHealth
		}
	})
else
	ESX.ShowNotification(_U("only_allow_car"))
	end
end

See there is not limit or weight, but you can add it if you want, but it make no sence to put it here, because a other script handles this and you dont want duplication code.

Ok perfect because in the main Script there is a SQL with “Parking Card” as an Item and that is with “limit” :smiley:

I have this error

Do you have a solution for that

1 Like

when getting back into my vehicle, and pressing E to pay the fee, i am met with a black loading screen that doesnt end… can anyone help?

how did you “insert the parking card” because i am having the same issue…

hello i have a little error:

SCRIPT ERROR: @esx_realparking/server/main.lua:204: attempt to concatenate a nil value (field ‘lastname’)

handler (@esx_realparking/server/main.lua:16)

how to fix this error pls

if you have the script i can help you, me line of code is diffrend than yours because i change a lot.

turn Config.UsingOldESX = true in your config file

Hi, if you do it again, and nothing happens press F8 to look if you have any errors. also take a look in your server window console to see if you see any errors.

thx,

now i have this error
i dont have name in my sql i have lastname

[MariaDB:10.3.27-MariaDB-0+deb10u1] [ERROR] [esx_realparking] An error happens for query “SELECT identifier, name FROM users : []”: ER_BAD_FIELD_ERROR: Unknown column ‘name’ in ‘field list’

Hello everyone!
This is really a very good script, thank you very much for this script, I have read through your comments and I found that there are a lot of errors, most of them spaw car errors.
After a period of tinkering and testing I can give you the following solutions, not necessarily the best, or the most optimal, but it worked for me.

  • In the file config.lua:
    Add an array of parking point coordinates to each parking lot, for example parking lot 1:
parking1 = {
		x      = -304.93497,                               -- Central location X, Y, Z of the parking
		y      = -944.39764,                               -- Y
		z      = 30.08062,                                 -- Z
		size   = 83.0,                                  -- The parking range radius (Horizontal)
		height = 10.0,                                  -- The parking range radius (Vertical)
		name   = "Public Parking",                      -- The name of the parking (blips)
		fee    = 1000,                                  -- How much parking fee per day (Real life time), set 0 to disable
		enter  = {x = -279.25, y = -890.39, z = 30.08}, -- The entrance of the parking
		maxcar = 100,
		ParkingPoint = {
			{x = -343.73581, y = -875.97534, z = 30.08, h = 167.92885},
			{x = -340.0061, y = -876.40546, z = 30.08, h = 167.92885},
			{x = -336.5986, y = -877.28638, z = 30.08, h = 167.92885},
			{x = -333.05185, y = -877.97681, z = 30.08, h = 167.92885},
			{x = -333.05185, y = -877.97681, z = 30.08, h = 167.92885},
			{x = -329.40643, y = -878.63788, z = 30.08, h = 167.92885},
			{x = -325.72147, y = -879.25824, z = 30.08, h = 167.92885},
			{x = -322.13281, y = -880.16846, z = 30.08, h = 167.92885},
			{x = -318.6528, y = -880.93817, z = 30.08, h = 167.92885},
			{x = -314.83218, y = -881.64703, z = 30.08, h = 167.92885},
			{x = -311.01877, y = -882.46844, z = 30.08, h = 167.92885},
			{x = -307.56018, y = -883.28003, z = 30.08, h = 167.92885},
			{x = -303.90115, y = -883.99384, z = 30.08, h = 167.92885},
			{x = -300.29504, y = -884.85364, z = 30.08, h = 167.92885},
			{x = -296.90997, y = -885.5957, z = 30.08, h = 167.92885},
			{x = -292.96146, y = -886.41071, z = 30.08, h = 167.92885},
			{x = -289.48645, y = -887.41724, z = 30.08, h = 167.92885},
			{x = -285.81079, y = -888.4361, z = 30.08, h = 167.92885},
			{x = -338.38742, y = -891.4361, z = 30.08, h = 347.51135},
			{x = -334.72058, y = -891.99463, z = 30.08, h = 347.51135},
			{x = -331.05502, y = -892.71991, z = 30.08, h = 347.51135},
			{x = -327.47842, y = -893.32312, z = 30.08, h = 347.51135},
			{x = -323.94055, y = -894.14526, z = 30.08, h = 347.51135},
			{x = -320.23169, y = -894.90387, z = 30.08, h = 347.51135},
			{x = -316.68259, y = -895.71759, z = 30.08, h = 347.51135},
			{x = -312.95178, y = -896.23035, z = 30.08, h = 347.51135},
			{x = -309.29111, y = -897.10309, z = 30.08, h = 347.51135},
			{x = -283.04089, y = -914.87848, z = 30.08, h = 70.72579},
			{x = -284.12814, y = -918.38263, z = 30.08, h = 70.72579},
			{x = -285.69894, y = -921.81818, z = 30.08, h = 70.72579},
			{x = -308.16644, y = -909.45264, z = 30.08, h = 167.92885},
			{x = -311.78455, y = -908.59283, z = 30.08, h = 167.92885},
			{x = -315.41718, y = -908.10632, z = 30.08, h = 167.92885},
			{x = -319.06088, y = -907.17145, z = 30.08, h = 167.92885},
			{x = -322.60992, y = -906.66125, z = 30.08, h = 167.92885},
			{x = -326.38422, y = -905.72455, z = 30.08, h = 167.92885},
			{x = -330.06064, y = -905.14703, z = 30.08, h = 167.92885},
			{x = -333.66595, y = -904.12952, z = 30.08, h = 167.92885},
			{x = -337.17664, y = -903.45026, z = 30.08, h = 167.92885},
			{x = -340.87711, y = -902.56909, z = 30.08, h = 167.92885},
			{x = -360.58789, y = -889.40771, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -893.06989, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -896.72125, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -900.47247, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -904.11255, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -907.74481, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -911.57758, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -915.3222, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -919.01758, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -922.65698, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -926.40198, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -929.99933, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -933.68976, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -937.40729, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -941.16071, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -944.87872, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -948.60126, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -952.27148, z = 30.08, h = 269.34546},
			{x = -360.58789, y = -956.00195, z = 30.08, h = 269.34546},
			{x = -327.62555, y = -924.50067, z = 30.08, h = 70.72579},
			{x = -328.92523, y = -927.94684, z = 30.08, h = 70.72579},
			{x = -330.24371, y = -931.44763, z = 30.08, h = 70.72579},
			{x = -331.45096, y = -934.98199, z = 30.08, h = 70.72579},
			{x = -332.76382, y = -938.37054, z = 30.08, h = 70.72579},
			{x = -334.01541, y = -941.85681, z = 30.08, h = 70.72579},
			{x = -335.24686, y = -945.39301, z = 30.08, h = 70.72579},
			{x = -336.47186, y = -948.83551, z = 30.08, h = 70.72579},
			{x = -337.54199, y = -952.27197, z = 30.08, h = 70.72579},
			{x = -341.81003, y = -921.61603, z = 30.08, h = 250.13654},
			{x = -342.89572, y = -925.20056, z = 30.08, h = 250.13654},
			{x = -344.27112, y = -928.51434, z = 30.08, h = 250.13654},
			{x = -345.30164, y = -931.9939, z = 30.08, h = 250.13654},
			{x = -326.37164, y = -956.26929, z = 30.08, h = 250.13654},
			{x = -325.4133, y = -952.67749, z = 30.08, h = 250.13654},
			{x = -323.98993, y = -949.32855, z = 30.08, h = 250.13654},
			{x = -322.84402, y = -945.83954, z = 30.08, h = 250.13654},
			{x = -321.55194, y = -942.26611, z = 30.08, h = 250.13654},
			{x = -320.42792, y = -938.91455, z = 30.08, h = 250.13654},
			{x = -319.19061, y = -935.3725, z = 30.08, h = 250.13654},
			{x = -317.6618, y = -931.92798, z = 30.08, h = 250.13654},
			{x = -316.67496, y = -928.37665, z = 30.08, h = 250.13654},
			{x = -307.11111, y = -947.46423, z = 30.08, h = 70.72579},
			{x = -308.18088, y = -950.96991, z = 30.08, h = 70.72579},
			{x = -309.61444, y = -954.36469, z = 30.08, h = 70.72579},
			{x = -310.79379, y = -957.94458, z = 30.08, h = 70.72579},
			{x = -312.24146, y = -961.38483, z = 30.08, h = 70.72579},
			{x = -313.2739, y = -964.88513, z = 30.08, h = 70.72579},
			{x = -343.05774, y = -974.15405, z = 30.08, h = 341.34091},
			{x = -339.54462, y = -975.3172, z = 30.08, h = 341.34091},
			{x = -336.09204, y = -976.51782, z = 30.08, h = 341.34091},
			{x = -332.48206, y = -977.41138, z = 30.08, h = 341.34091},
			{x = -328.96487, y = -978.57477, z = 30.08, h = 341.34091},
			{x = -325.41006, y = -979.86481, z = 30.08, h = 341.34091},
			{x = -321.94101, y = -981.12402, z = 30.08, h = 341.34091},
			{x = -318.67056, y = -982.61591, z = 30.08, h = 341.34091},
			{x = -315.38583, y = -984.05426, z = 30.08, h = 341.34091},
			{x = -312.08813, y = -985.42816, z = 30.08, h = 341.34091},
			{x = -308.0488, y = -986.32593, z = 30.08, h = 341.34091},
			{x = -304.80072, y = -987.79578, z = 30.08, h = 341.34091},
			{x = -301.16653, y = -988.96954, z = 30.08, h = 341.34091},
			{x = -297.73843, y = -990.01654, z = 30.08, h = 341.34091}
		}
	},

The same goes for other parking lots.

  • In the file client\main.lua:
    Edit the RemoveVehicles function as follows:
    From line 160 to line 186 replace with:
function RemoveVehicles()
	for i, j in pairs(Config.ParkingLocations) do
		for k, v in pairs(Config.ParkingLocations[i].ParkingPoint) do
			local tmpLoc = {
				["x"] = v.x,
				["y"] = v.y,
				["z"] = v.z,
				["h"] = v.h,
			}
			local timeOut  = 0
			local notFound = false
			while notFound == false and timeOut < 3000 do
				local veh, distance = ESX.Game.GetClosestVehicle(tmpLoc)
				local vl = GetEntityCoords(veh)
				if GetDistanceBetweenCoords(vl.x, vl.y, vl.z, v.x, v.y, v.z, true) < 2 then
					if NetworkGetEntityIsLocal(veh) then
						local tmpModel = GetEntityModel(veh)
						SetModelAsNoLongerNeeded(tmpModel)
						DeleteEntity(veh)
					end
				else
					notFound = true
				end
			end
		end
	end
	LocalVehicles = {}
end

From line 275 to line 329 replace with:

-- Check distance

Citizen.CreateThread(function()
	while PlayerIdentifier == nil do
		Citizen.Wait(10)
	end
	while true do
		Wait(0)
		NearParking, DisParking = GetNearParking()
		if NearParking ~= nil then
			NearParkingPoint = GetNearParkingPoint()
			if NearParkingPoint < 50 then
				if not SpawnedVehicles then
					--print("Spawned the vehicles")
					RemoveVehicles()
					TriggerServerEvent("esx_realparking:refreshVehicles", NearParking)
					SpawnedVehicles = true
					Wait(2000)
				end
			else
				if SpawnedVehicles then
					--print("Removed the vehicles")
					RemoveVehicles()
					SpawnedVehicles = false
				end
			end
		end
	end
end)

From line 366to line 501 replace with:

-- Logic thread

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		player = PlayerPedId()
		coords = GetEntityCoords(player)
		NearParking, DisParking = GetNearParking()
		if IsPedInAnyVehicle(GetPlayerPed(-1)) then
			if NearParking ~= nil then
				for k, v in pairs(Config.ParkingLocations[NearParking].ParkingPoint) do
					local distance = GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true)
					if distance < 10 then
						
						DrawMarker(27, v.x, v.y, v.z+0.1, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 1.0, 1, 157, 0, 155, 100, false, true, 2, false, nil, nil, false)
						DrawMarker(36, v.x, v.y, v.z+0.3, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 1.0, 1, 157, 0, 155, 100, false, true, 2, false, nil, nil, false)
						if distance < 3.0 then							
							local storedVehicle = GetPedInStoredCar(GetPlayerPed(-1))
							if storedVehicle ~= false then
								DisplayHelpText(string.format(_U("need_parking_fee", storedVehicle.fee)))
							else
								DisplayHelpText(_U("press_to_save"))
							end
							if IsControlJustReleased(0, 51) then
								if storedVehicle ~= false then
									DoScreenFadeOut(250)
									Wait(500)
									ESX.TriggerServerCallback("esx_realparking:driveCar", function(callback)
										if callback.status then
											DeleteVehicle(storedVehicle.entity)
											DeleteVehicle(GetVehiclePedIsIn(GetPlayerPed(-1)))
											storedVehicle = nil
											Wait(500)
											DriveVehicle(callback.vehData)
											ESX.ShowNotification(callback.message)
										else
											ESX.ShowNotification(callback.message)
										end
										Wait(1000)
										DoScreenFadeIn(250)
									end, storedVehicle)
								else
									local veh = GetVehiclePedIsIn(GetPlayerPed(-1))
									if veh ~= 0 then
										if IsThisModelACar(GetEntityModel(veh)) or IsThisModelABike(GetEntityModel(veh)) or IsThisModelABoat(GetEntityModel(veh)) or IsThisModelAHeli(GetEntityModel(veh)) or IsThisModelAPlane(GetEntityModel(veh)) or IsThisModelAQuadbike(GetEntityModel(veh)) or IsThisModelABicycle(GetEntityModel(veh)) or IsThisModelAAmphibious_Car(GetEntityModel(veh)) or IsThisModelAAmphibious_Quadbike(GetEntityModel(veh)) or IsThisModelAConvertible(GetEntityModel(veh)) then
											local vehProps  = ESX.Game.GetVehicleProperties(veh)
											local vehPos    = GetEntityCoords(veh)
											local vehHead   = GetEntityHeading(veh)
											local engHealth = GetVehicleEngineHealth(veh)
											local bdyHealth = GetVehicleBodyHealth(veh)
											local tnkHealth = GetVehiclePetrolTankHealth(veh)
											LastPlate       = vehProps.plate
											DoScreenFadeOut(250)
											Wait(500)
											ESX.TriggerServerCallback("esx_realparking:saveCar", function(callback)
												if callback.status then
													DeleteVehicle(veh)
													ESX.ShowNotification(callback.message)
												else
													ESX.ShowNotification(callback.message)
												end
												Wait(1000)
												DoScreenFadeIn(250)
											end, {
												location = {x = v.x, y = v.y, z = v.z, h = v.h},
												props    = vehProps,
												parking  = NearParking,
												livery   = GetVehicleLivery(veh),
												health   = {
													engine = engHealth,
													body   = bdyHealth,
													tank   = tnkHealth
												}
											})
										else
											ESX.ShowNotification(_U("only_allow_car"))
										end
									end
								end
							end
						end
						
					end
				end
			end
		end
	end
end)
function GetNearParking()
	local near = nil
	local distance = 10000
	for k, v in pairs(Config.ParkingLocations) do
		local pl = GetEntityCoords(GetPlayerPed(-1))
		local cur_distance = GetDistanceBetweenCoords(pl.x, pl.y, pl.z, v.x, v.y, v.z, true)
		if cur_distance < distance then
			distance = cur_distance
			near = k
		end
	end
	return near, distance
end
function GetNearParkingPoint()
	local distance = 10000
	NearParking, DisParking = GetNearParking()
	if NearParking ~= nil then
		for k, v in pairs(Config.ParkingLocations[NearParking].ParkingPoint) do
			local pl = GetEntityCoords(GetPlayerPed(-1))
			local cur_distance = GetDistanceBetweenCoords(pl.x, pl.y, pl.z, v.x, v.y, v.z, true)
			if cur_distance < distance then
				distance = cur_distance
			end
		end
	end
	return distance
end

Previously, every time you exited the parking area, the client deleted all the cars in the designated area! If unfortunately there are vehicles lying outside it will be missed, and the next time the client spaw the vehicles it will be stacked! Now the client will only delete the vehicles located in the designated parking area, and certainly will not miss any vehicles, so stacking will be overcome.

Here is the test video:

Hope the above can be of help to you!
Sorry for my bad English :laughing:

2 Likes

Hi, than you dont have this name row in your database. same as the other error you had, no firstname, it means you dont have this row in your database table.

EDIT:
you can change the name for lastname… and it works just fine…

Hi!, Nice script you make, i have a question, can you not use it in this way?

posX  = vehicles[i].vehicle.location.x+math.random(-1000,1000)--radius example
posY  = vehicles[i].vehicle.location.y+math.random(-1000,1000)--radius example
Z     = vehicles[i].vehicle.location.z+999.0
ground,posZ = GetGroundZFor_3dCoord(posX+.0,posY+.0,Z,1)--set Z pos as on ground
if (ground) then--if ground is foundedd
       -- spawn entity
end

Greetz!