..:D&G:.. Posted December 28, 2013 Share Posted December 28, 2013 I recently tried to help my friend with his vehicle description system that he made, he can set the descriptions for the vehicles, but when he restarts the server the descriptions are not showing anymore, and he also gets some erros: [2013-12-28 01:12:35] WARNING: vehdescription\s_vehicle_descriptions.lua:42: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] [2013-12-28 01:12:35] ERROR: s_vehicle_descriptions.lua:45: attempt to index local 'descriptions' (a userdata value) This is what we have put to load the data from the database: function loadToDescription(descriptions, theVehicle) local dbid = getElementData(theVehicle, "dbid") local acceptedQuerys = { } for i = 1, 5 do local load = exports.mysql:query_free("SELECT * FROM vehicles WHERE description" .. i .. " = '" .. mysql:escape_string( descriptions[i] ) .. "' WHERE id = '".. mysql:escape_string(dbid) .."'") --local load = exports.mysql:query_free("SELECT * FROM vehicles WHERE description1= '" .. newvalue .. "' WHERE id = '".. exports.mysql:escape_string(dbid) .."'") if load then exports['anticheat-system']:loadProtectedElementDataEx(theVehicle, "description:"..i, descriptions[i], true) acceptedQuerys[i] = true end end local counter = 0 for j = 1, #acceptedQuerys do if acceptedQuerys[j] then counter = counter + 1 end end end addEventHandler ( "onResourceStart", getRootElement(), loadToDescription ) Link to comment
Leonard.DC Posted December 28, 2013 Share Posted December 28, 2013 Are this the full code? If not put the full code or anyone can help you Link to comment
Stanley Sathler Posted December 28, 2013 Share Posted December 28, 2013 Did you try change "load" variable name to another name? I don't know, but seems "load" is a reserved name. 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