Best-Killer Posted December 5, 2016 Share Posted December 5, 2016 (edited) function creatMarkerSystem() local GetAllMarker = exports.NGSQL:db_query ( "SELECT * FROM marker_system " ) if ( type ( GetAllMarker ) == "table" and #GetAllMarker > 0 ) then for i = 1, #GetAllMarker do local n = {GetAllMarker[i]["Name"], GetAllMarker[i]["posX"], GetAllMarker[i]["posY"], GetAllMarker[i]["posZ"], GetAllMarker[i]["Alpha"], GetAllMarker[i]["Color"], GetAllMarker[i]["Vehicles"], GetAllMarker[i]["Rotation"], GetAllMarker[i]["Data"]} for ii = 1, #n do n[ ii ] = tostring( n[ ii ] ) end color = fromJSON(n[6]) local marker = createMarker( n[2], n[3], n[4]-1, 'cylinder', 1.25, color[1], color[2], color[3], 255 ) if marker then markers[marker] = {n[1], n[7], n[8], n[9], n[10]} addEventHandler("onMarkerHit", marker, onSpawnerMarkerHit) setElementData(marker, 'id', i ) setElementData(marker,"teamMarker",true) end end end end function onSpawnerMarkerHit(hitPlayer, matchingDimension) if not matchingDimension then return end if getElementType(hitPlayer) == "player" then if isPedInVehicle(hitPlayer) then return end local team = getElementData(source,"teamMarker") if not team then return end local tName = getElementData(hitPlayer,tostring(markers[source][4])) if not tName then return end for i,v in pairs(markers[source][1]) do if v == tName then triggerClientEvent(hitPlayer,"showvehicle",hitPlayer,markers[source][2],source) end end end end Line 28 Edited December 5, 2016 by Best-Killer Worng line Link to comment
LoPollo Posted December 6, 2016 Share Posted December 6, 2016 (edited) well the error says all: markers[source][1] is not a table. markers[source] is a table, maybe you want that? i don't know exaclty what it contains so it's just a guess Edited December 6, 2016 by LoPollo 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