Jump to content

table expected got boolean


Best-Killer

Recommended Posts

error : bad argument unpack table expected got boolean (line 11 )

 

local playerVehicles = { }
function createPlayerVehicle ( p, id, marker, warp )
	if ( isElement ( playerVehicles[p] ) ) then
		destroyElement ( playerVehicles[p] )
	end
	
	local spawncord =  getElementData ( source, "SpawnCoordinates" ) 
	local x, y, z, rz  = unpack(spawncord)
	
	local job = getElementData ( source, "SAEGVehicles:JobRestriction" ) or false
	
	playerVehicles[p] = createVehicle ( id, x, y, z, 0, 0, rz )
	exports['SAEGLogs']:outputActionLog ( getPlayerName ( p ).." spawned a(n) "..getVehicleNameFromModel ( id ) )
	--exports['SAEGJobs']:create3DText ( getPlayerName ( p ).."'s Vehicle", { 0, 0, 0.5 }, { 255, 255, 255 }, playerVehicles[p], { 7, true } )
	if ( warp and isElement ( playerVehicles[p] ) ) then
		warpPedIntoVehicle ( p, playerVehicles[p] )
	end
	
	if job then
		setElementData ( playerVehicles[p], "SAEGAntiRestart:VehicleJobRestriction", tostring ( job ) )
		addEventHandler ( "onVehicleStartEnter", playerVehicles[p], checkRestrictions )
	end

	return playerVehicles[p]
end 

 

Link to comment
1 minute ago, LoPollo said:

The arg? If the returned value is still false, then the problem is the same. Can you post the blocks where you set  SpawnCoordinate?

local spawners = { 
	['Free'] = { },
	['Job'] = { }
}
local spawnedVehciles = { }
function createFreeSpawner ( x, y, z, rz, sx, sy, sz )
	local i = #spawners['Free']+1
	local z = z - 1
	local sx, sy, sz = sx or x, sy or y, sz or z+1.5
	local rz = rz or 0
	spawners['Free'][i] = createMarker ( x, y, z, 'cylinder', 2, 255, 255, 255, 120 )
	setElementData ( spawners['Free'][i], "SpawnCoordinates", { sx, sy, sz, rz } )
	setElementData ( spawners['Free'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles['Free'] )
	setElementData ( spawners['Free'][i], "SAEGVehicles:JobRestriction", false )
	addEventHandler ( "onMarkerHit", spawners['Free'][i], onSpawnerHit )
	return spawners['Free'][i]
end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...