Tonyx97 Posted August 26, 2013 Share Posted August 26, 2013 Hola a todos, en mi ultimo post me respondió Castillo e intente solucionar mi problema, pero al intentar decir que "rowID" es igual a una ID de un vehículo (Se supone que yo uso rowID como la ID del vehículo), no me da error pero tampoco va: function buyVeh (thePlayer,cmdName,model) if tonumber(model) then local x,y,z = getElementPosition (thePlayer) vehicle = createVehicle ( model, x, y + 2, z ) local created = dbQuery ( getConnection (), "INSERT INTO vehicles SET mdl = ?, owner = ?, x = ?, y = ?, z = ?, rx = ?, ry = ?, rz = ?, health = ?, color1 = ?, color2 = ?", model, getOwner(thePlayer), x, y, z, 0, 0, 0, 1000, 0, 0 ) local id = dbPoll(created, -1) if created then setVehicleColor( vehicle, 0, 0, 0, 0 ) outputDebugString ( ""..model.." bought" ) vehicles [ vehicle ] = { rowID = id["rowID"], mdl = model, owner = getOwner(thePlayer), x = x, y = y, z = z, rx = 0, ry = 0, rz = 0, health = 1000, color1 = 0, color2 = 0 } end end end addCommandHandler("buyveh", buyVeh) Todo esta bien excepto que en " vehicles [ vehicle ] = { rowID = id["rowID"]" aquí no me asigna rowID como lo que le digo, quizás es que no estaré asignándoselo bien y se que no se lo asigna porque al guardar el vehículo, no me lo guarda.. entonces, ¿qué debería hacer? Gracias por leer. Link to comment
Arsilex Posted August 26, 2013 Share Posted August 26, 2013 local id = dbPoll(created, -1) This function checks the progress of a database query. No te devuelve un ID solo te devuelve el el numero de las columnas afectadas... Link to comment
Tonyx97 Posted August 26, 2013 Author Share Posted August 26, 2013 Será eso, solo funcionaría si en el dbQuery se usase el "SELECT"... entonces ni idea Link to comment
Recommended Posts