Arsilex Posted September 10, 2012 Share Posted September 10, 2012 Bueno necesito ayuda con esto function openall (player, commandName, modelo) local models = getElementsByType("vehicle") for index, autos in pairs(models) do if ( getElementModel(autos) == tonumber(modelo)) then local vehicleID = vehicles[ vehicle ] and vehicles[ vehicle ].vehicleID if vehicleID and ( vehicleID < 0 or exports.sql:query_free( "UPDATE vehicles SET locked = 1 - locked WHERE vehicleID = " .. vehicleID ) ) then setVehicleLocked( vehicle, not isVehicleLocked( vehicle ) ) return true end return false else outputChatBox( "No se encontro el coche", player, 255,0,0, true) end end end addCommandHandler("abrircoches", openall) lo que quiero es que en vezde poner el modelo que solo ponga abrircoches y se abran los coches de los siguentes ID 431--Bus 574--Sweeper 420--Taxi 438--Cabbie Es posible Link to comment
Castillo Posted September 10, 2012 Share Posted September 10, 2012 local models = { [ 431 ] = true, [ 574 ] = true, [ 420 ] = true, [ 438 ] = true } function openall ( player ) for index, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if ( models [ getElementModel ( vehicle ) ] ) then local vehicleID = vehicles [ vehicle ] and vehicles [ vehicle ].vehicleID if ( vehicleID and ( vehicleID < 0 or exports.sql:query_free( "UPDATE vehicles SET locked = 1 - locked WHERE vehicleID = " .. vehicleID ) ) ) then setVehicleLocked ( vehicle, not isVehicleLocked ( vehicle ) ) end end end end addCommandHandler ( "abrircoches", openall ) Link to comment
Arsilex Posted September 10, 2012 Author Share Posted September 10, 2012 Gracias Solidsnake14 voy a probarlo Link to comment
Arsilex Posted September 10, 2012 Author Share Posted September 10, 2012 No me funciono y no me sale ningún error Link to comment
Castillo Posted September 10, 2012 Share Posted September 10, 2012 Copialo de nuevo, habias puesto "autos", pero tendria que haber sido "vehicle" en el for-loop. Link to comment
Arsilex Posted September 10, 2012 Author Share Posted September 10, 2012 sigue sin funcionar Link to comment
Arsilex Posted September 10, 2012 Author Share Posted September 10, 2012 Gracias Solidsnake14 me sirvió Link to comment
Recommended Posts