Best-Killer Posted November 26, 2016 Share Posted November 26, 2016 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
Rose Posted November 26, 2016 Share Posted November 26, 2016 (edited) Table created at client-side? Edited November 26, 2016 by Hit+ Link to comment
LoPollo Posted November 26, 2016 Share Posted November 26, 2016 Line 11: yes that's blank space if you mean line 8 it's because the data you retrieve from the source does not exists. i.e. getElementData ( source, "SpawnCoordinates" ) returns false Link to comment
Best-Killer Posted November 26, 2016 Author Share Posted November 26, 2016 21 minutes ago, LoPollo said: Line 11: yes that's blank space if you mean line 8 it's because the data you retrieve from the source does not exists. i.e. getElementData ( source, "SpawnCoordinates" ) returns false i changed it to marker and same problem ahahaha sory yes i mean line 8 Link to comment
LoPollo Posted November 26, 2016 Share Posted November 26, 2016 Just now, Best-Killer said: i changed it to marker and same problem The arg? If the returned value is still false, then the problem is the same. Can you post the blocks where you set SpawnCoordinate? Link to comment
Best-Killer Posted November 26, 2016 Author Share Posted November 26, 2016 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
LoPollo Posted November 26, 2016 Share Posted November 26, 2016 I see you don't call createPlayerVehicle after setting the data (at least... in this block). Make sure that createFreeSpawner is called BEFORE the function createPlayerVehicle is called, so the data does exist Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now