Jump to content

alex17

Members
  • Posts

    302
  • Joined

  • Last visited

Everything posted by alex17

  1. yo te recomiendo mejor nfoserver yo lo he usado y realmente me gusto su servicio ademas de su buen ping D:
  2. vos quiere guardar en su base de dato el numero del color que viene a ser del 0 al 126 ? o quiere guardar el codigo del color como este #ffffff?
  3. puedes usar esta funcion function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end y en tu codigo lo pones asi function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end[ function pintarlo ( player, r, g, b, colorsio, colorsio2) local vehicle = getPedOccupiedVehicle( player ) local data = vehicles[ vehicle ] if vehicle and r and g and b then r1, g1, b1, r2, g2, b2 = getVehicleColor(vehicle, true) if colorsio then local colorsio = RGBToHex(r,g,b) setVehicleColor (vehicle, r, g, b, r2, g2, b2) exports.sql:query_free( "UPDATE vehicles SET color1 = "..colorsio.." WHERE vehicleID = " .. data.vehicleID) end if colorsio2 then local colorsio2 = RGBToHex(r,g,b) setVehicleColor (vehicle, r1, g1, b1, r, g, b) exports.sql:query_free( "UPDATE vehicles SET color2 = "..colorsio2.." WHERE vehicleID = " .. data.vehicleID) end end end addEvent( "onPintura", true ) addEventHandler( "onPintura", getRootElement(), pintarlo)
  4. por que no lo haces así function pintarlo ( player, r, g, b, colorsio, colorsio2) local vehicle = getPedOccupiedVehicle( player ) local data = vehicles[ vehicle ] if vehicle and r and g and b then r1, g1, b1, r2, g2, b2 = getVehicleColor(vehicle, true) if colorsio then local colorsio = r..";"..g..";"..b setVehicleColor (vehicle, r, g, b, r2, g2, b2) exports.sql:query_free( "UPDATE vehicles SET color1 = "..colorsio.." WHERE vehicleID = " .. data.vehicleID) end if colorsio2 then local colorsio2 = r..";"..g..";"..b setVehicleColor (vehicle, r1, g1, b1, r, g, b) exports.sql:query_free( "UPDATE vehicles SET color2 = "..colorsio2.." WHERE vehicleID = " .. data.vehicleID) end end end addEvent( "onPintura", true ) addEventHandler( "onPintura", getRootElement(), pintarlo) y cuando quieras obtener los colores como dice tomas solo usas split
  5. lo estas poniendo mal las llaves {} error colorsio2 = {r, g, b] intenta con esto colorsio2 = {r, g, b}
  6. lo siento me falto algo en el codigo local open = false function abrirlo() if open then removeEventHandler ( "onClientRender", root, reglitas ) open = false else addEventHandler ( "onClientRender", root, reglitas ) open = true end end addEvent( "onReglitas", true ) addEventHandler( "onReglitas", localPlayer, abrirlo )
  7. local open = false function abrirlo() if open then removeEventHandler ( "onClientRender", root, reglitas ) else addEventHandler ( "onClientRender", root, reglitas ) end end addEvent( "onReglitas", true ) addEventHandler( "onReglitas", localPlayer, abrirlo )
  8. te refieres a algo como esto
  9. en esta parte del codigo que es donde guardas la base de datos de donde sacas vehicleID , muestra esa parte . exports.sql:query_free( "UPDATE vehicles SET color1 = "..color1.." WHERE vehicleID = " .. data.vehicleID)
  10. y en que parte guardas el color en rgb del vehiculo
  11. reemplaza esa parte por esto y ya debería funcionarte function Pintarla1(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, "color1", false) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla1) end function Pintarla2(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, false, "color2") removeEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end
  12. mm que raro yo lo probé y me funciona bien
  13. aca te dejo los dos pruebalo si te anda function abrirelpanel() panelcolor = guiCreateWindow(452, 230, 291, 250, "Capas de pintura", false) guiWindowSetSizable(panelcolor, false) capa1 = guiCreateButton(92, 37, 107, 49, "Capa 1", false, panelcolor) capa2 = guiCreateButton(92, 111, 107, 49, "Capa 2", false, panelcolor) Cerrar = guiCreateButton(92, 190, 107, 49, "Cerrar", false, panelcolor) addEventHandler("onClientGUIClick", getRootElement(), onGuiClick) showCursor (true) end addEvent( "onColorC", true ) addEventHandler( "onColorC", localPlayer, abrirelpanel ) function onGuiClick() if source == Cerrar then destroyElement(panelcolor) showCursor (false) elseif source == capa1 then exports.colorblender:openPicker (1, 0, "Capa 1") addEventHandler( "onColorPickerOK", localPlayer, Pintarla1) elseif source == capa2 then exports.colorblender:openPicker (1, 0, "Capa2") addEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end end function Pintarla1(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, true, false) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla1) end function Pintarla2(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, false, true) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end function pintarlo ( player, r, g, b, color1, color2) local vehicle = getPedOccupiedVehicle( player ) local data = vehicles[ vehicle ] if vehicle and r and g and b then r1, g1, b1, r2, g2, b2 = getVehicleColor(vehicle, true) if color1 then exports.sql:query_free( "UPDATE vehicles SET color1 = "..color1.." WHERE vehicleID = " .. data.vehicleID) setVehicleColor (vehicle, r, g, b, r2, g2, b2) end if color2 then exports.sql:query_free( "UPDATE vehicles SET color2 = "..color2.." WHERE vehicleID = " .. data.vehicleID) setVehicleColor (vehicle, r1, g1, b1, r, g, b) end end end addEvent( "onPintura", true ) addEventHandler( "onPintura", getRootElement(), pintarlo)
  14. perdón cometí un error pruebalo nuevamente function abrirelpanel() panelcolor = guiCreateWindow(452, 230, 291, 250, "Capas de pintura", false) guiWindowSetSizable(panelcolor, false) capa1 = guiCreateButton(92, 37, 107, 49, "Capa 1", false, panelcolor) capa2 = guiCreateButton(92, 111, 107, 49, "Capa 2", false, panelcolor) Cerrar = guiCreateButton(92, 190, 107, 49, "Cerrar", false, panelcolor) addEventHandler("onClientGUIClick", getRootElement(), onGuiClick) showCursor (true) end addEvent( "onColorC", true ) addEventHandler( "onColorC", localPlayer, abrirelpanel ) function onGuiClick() if source == Cerrar then destroyElement(panelcolor) showCursor (false) elseif source == capa1 then exports.colorblender:openPicker (1, 0, "Capa 1") addEventHandler( "onColorPickerOK", localPlayer, Pintarla1) elseif source == capa2 then exports.colorblender:openPicker (1, 0, "Capa2") addEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end end function Pintarla1(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, true, false) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla1) end function Pintarla2(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, false, true) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end
  15. si pero en ese caso creo que ya no se podria usar elseif si no te quedaria algo asi function pintarlo ( player, r, g, b, color1, color2) local vehicle = getPedOccupiedVehicle( player ) local data = vehicles[ vehicle ] if vehicle and r and g and b then r1, g1, b1, r2, g2, b2 = getVehicleColor(vehicle, true) if color1 then exports.sql:query_free( "UPDATE vehicles SET color1 = "..color1.." WHERE vehicleID = " .. data.vehicleID) setVehicleColor (vehicle, r, g, b, r2, g2, b2) end if color2 then exports.sql:query_free( "UPDATE vehicles SET color2 = "..color2.." WHERE vehicleID = " .. data.vehicleID) setVehicleColor (vehicle, r1, g1, b1, r, g, b) end end end end addEvent( "onPintura", true ) addEventHandler( "onPintura", getRootElement(), pintarlo) y el client te quedaría algo asi function abrirelpanel() panelcolor = guiCreateWindow(452, 230, 291, 250, "Capas de pintura", false) guiWindowSetSizable(panelcolor, false) capa1 = guiCreateButton(92, 37, 107, 49, "Capa 1", false, panelcolor) capa2 = guiCreateButton(92, 111, 107, 49, "Capa 2", false, panelcolor) Cerrar = guiCreateButton(92, 190, 107, 49, "Cerrar", false, panelcolor) addEventHandler("onClientGUIClick", getRootElement(), cerrarlo) showCursor (true) end addEvent( "onColorC", true ) addEventHandler( "onColorC", localPlayer, abrirelpanel ) function onGuiClick() if source == Cerrar then destroyElement(panelcolor) showCursor (false) elseif source = capa1 then exports.colorblender:openPicker (1, 0, "Capa 1") addEventHandler( "onColorPickerOK", localPlayer, Pintarla1) elseif source = capa2 exports.colorblender:openPicker (1, 0, "Capa2") addEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end end function Pintarla1(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, true, false) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla1) end function Pintarla2(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, false, true) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end
  16. Puedes mostrar la parte donde ejecutas estas dos funciones function Pintarla1(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, color1) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla1) end function Pintarla2(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, color2) removeEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end
  17. No estoy muy seguro de que quieres realmente es algo como esto ? function Pintarla1(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, "rojo") removeEventHandler( "onColorPickerOK", localPlayer, Pintarla1) end function Pintarla2(id, hex, r, g, b) triggerServerEvent ( "onPintura", localPlayer, localPlayer, r,g,b, "verde") removeEventHandler( "onColorPickerOK", localPlayer, Pintarla2) end function pintarlo ( player, r, g, b, pintura ) local vehicle = getPedOccupiedVehicle( player ) if vehicle and r and g and b then r1, g1, b1, r2, g2, b2 = getVehicleColor(vehicle, true) if pintura == "rojo" then setVehicleColor (vehicle, r, g, b, r2, g2, b2) elseif pintura == "verde" then setVehicleColor (vehicle, r1, g1, b1, r, g, b) end end end addEvent( "onPintura", true ) addEventHandler( "onPintura", getRootElement(), pintarlo)
  18. haber si entendí lo que quieres hacer es en ves de poner un numero " 1 o 2 " este una variable por ejemplo " verde, rojo , etc " ?? ?
  19. puedes explicarte mejor que tratas de hacer
  20. ah tienes que añadirle esto removeEventHandler ( "onClientClick", getRootElement(), repararlo) te tiene que quedar algo así function openPanel() addEventHandler ( "onClientRender", root, panelsito ) addEventHandler ( "onClientClick", getRootElement(), repararlo) end addCommandHandler ("panel", openPanel) function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () if isCursorShowing() then else mx,my = x,y end local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function repararlo ( _,state) if state == "down" then if isCursorOnElement ( 440, 297, 146, 32) then triggerServerEvent ( "onReparar", getLocalPlayer() ) removeEventHandler ( "onClientRender", root, panelsito ) elseif isCursorOnElement ( 440, 348, 146, 32 ) then showCursor (true) guiSetVisible (InflarPanel, true) addEventHandler ("onClientGUIClick", getRootElement(), onguiClick) removeEventHandler ( "onClientRender", root, panelsito ) removeEventHandler ( "onClientClick", getRootElement(), repararlo) end end end
  21. mm sigo sin entenderte.. como abres el panel GUI por el dx o tienes una funcion aparte que tambien lo abre ?
  22. +1 polluelo solo trataba de decir que no importa si te pasaron el código o si lo intercambiaste , eso no deja de ser un código robado por lo mismo no puedes andar publicándolo sin autorización del propietario y Kilfmwan es muy infantil de tu parte responder como respondes
  23. Prueba con esto InflarPanel = guiCreateWindow(715, 280, 201, 219, "Inflar ruedas", false) guiWindowSetSizable(InflarPanel, false) guiSetAlpha(InflarPanel, 0.68) DIzquierda = guiCreateButton(9, 34, 71, 39, "Delantera Izquierda", false, InflarPanel) guiSetFont(DIzquierda, "default-bold-small") DDerecha = guiCreateButton(120, 34, 71, 39, "Delantera Derecha", false, InflarPanel) guiSetFont(DDerecha, "default-bold-small") TIzquierda = guiCreateButton(9, 116, 71, 39, "Trasera Izquierda", false, InflarPanel) guiSetFont(TIzquierda, "default-bold-small") TDerecha = guiCreateButton(120, 116, 71, 39, "Trasera Derecha", false, InflarPanel) guiSetFont(TDerecha, "default-bold-small") CerrarPanel = guiCreateButton(48, 178, 99, 31, "Cerrar ", false, InflarPanel) guiSetFont(CerrarPanel, "default-bold-small") guiSetVisible (InflarPanel, false) function onguiClick () if source == CerrarPanel then guiSetVisible (InflarPanel, false) showCursor (false) removeEventHandler ("onClientGUIClick", getRootElement(), onguiClick) elseif source == DIzquierda then triggerServerEvent ( "onInflar1", getLocalPlayer() ) elseif source == DDerecha then triggerServerEvent ( "onInflar2", getLocalPlayer() ) elseif source == TIzquierda then triggerServerEvent ( "onInflar3", getLocalPlayer() ) elseif source == inflartderecha then triggerServerEvent ( "onInflar4", getLocalPlayer() ) end end function panelsito () dxDrawRectangle(344, 266, 334, 316, tocolor(127, 127, 127, 50), false) dxDrawRectangle(344, 179, 334, 87, tocolor(255, 255, 255, 40), false) dxDrawText("Panel Mecánico", 415, 206, 607, 256, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, false, false, false) dxDrawRectangle(344, 582, 334, 23, tocolor(255, 255, 255, 40), false) dxDrawRectangle(441, 297, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawText("Reparar", 440, 297, 587, 330, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawText("Pintar", 440, 348, 587, 381, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawRectangle(441, 349, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawRectangle(441, 406, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawText("Ruedas", 441, 406, 588, 439, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawText("Inflar", 441, 466, 588, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawRectangle(441, 467, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawRectangle(441, 526, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawText("Luces", 441, 525, 588, 558, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) showCursor (true) end function openPanel() addEventHandler ( "onClientRender", root, panelsito ) end addCommandHandler ("panel", openPanel) function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () if isCursorShowing() then else mx,my = x,y end local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function repararlo ( _,state) if state == "down" then if isCursorOnElement ( 440, 297, 146, 32) then triggerServerEvent ( "onReparar", getLocalPlayer() ) removeEventHandler ( "onClientRender", root, panelsito ) elseif isCursorOnElement ( 440, 348, 146, 32 ) then showCursor (true) guiSetVisible (InflarPanel, true) addEventHandler ("onClientGUIClick", getRootElement(), onguiClick) removeEventHandler ( "onClientRender", root, panelsito ) end end end addEventHandler ( "onClientClick", getRootElement(), repararlo)
  24. Modifique unas cuantas cosas que estaban mal pero ya lo probé y funciona avísame si tienes alguna duda function abririnflar () InflarPanel = guiCreateWindow(715, 280, 201, 219, "Inflar ruedas", false) guiWindowSetSizable(InflarPanel, false) guiSetAlpha(InflarPanel, 0.68) DIzquierda = guiCreateButton(9, 34, 71, 39, "Delantera Izquierda", false, InflarPanel) guiSetFont(DIzquierda, "default-bold-small") DDerecha = guiCreateButton(120, 34, 71, 39, "Delantera Derecha", false, InflarPanel) guiSetFont(DDerecha, "default-bold-small") TIzquierda = guiCreateButton(9, 116, 71, 39, "Trasera Izquierda", false, InflarPanel) guiSetFont(TIzquierda, "default-bold-small") TDerecha = guiCreateButton(120, 116, 71, 39, "Trasera Derecha", false, InflarPanel) guiSetFont(TDerecha, "default-bold-small") CerrarPanel = guiCreateButton(48, 178, 99, 31, "Cerrar ", false, InflarPanel) guiSetFont(CerrarPanel, "default-bold-small") showCursor (true) addEventHandler ("onClientGUIClick", getRootElement(), onguiClick) end addEvent( "openInflar", true ) addEventHandler( "opneInflar", localPlayer, abririnflar ) function onguiClick () if source == CerrarPanel then guiSetVisible (InflarPanel, false) showCursor (false) elseif source == DIzquierda then triggerServerEvent ( "onInflar1", getLocalPlayer() ) elseif source == DDerecha then triggerServerEvent ( "onInflar2", getLocalPlayer() ) elseif source == TIzquierda then triggerServerEvent ( "onInflar3", getLocalPlayer() ) elseif source == inflartderecha then triggerServerEvent ( "onInflar4", getLocalPlayer() ) end end function panelsito () dxDrawRectangle(344, 266, 334, 316, tocolor(127, 127, 127, 50), false) dxDrawRectangle(344, 179, 334, 87, tocolor(255, 255, 255, 40), false) dxDrawText("Panel Mecánico", 415, 206, 607, 256, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, false, false, false) dxDrawRectangle(344, 582, 334, 23, tocolor(255, 255, 255, 40), false) dxDrawRectangle(441, 297, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawText("Reparar", 440, 297, 587, 330, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawText("Pintar", 440, 348, 587, 381, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawRectangle(441, 349, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawRectangle(441, 406, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawText("Ruedas", 441, 406, 588, 439, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawText("Inflar", 441, 466, 588, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) dxDrawRectangle(441, 467, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawRectangle(441, 526, 146, 32, tocolor(255, 255, 255, 40), false) dxDrawText("Luces", 441, 525, 588, 558, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "top", false, false, false, false, false) showCursor (true) end function openPanel() addEventHandler ( "onClientRender", root, panelsito ) end addCommandHandler ("panel", openPanel) function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () if isCursorShowing() then else mx,my = x,y end local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function repararlo ( _,state) if state == "down" then if isCursorOnElement ( 440, 297, 146, 32) then triggerServerEvent ( "onReparar", getLocalPlayer() ) removeEventHandler ( "onClientRender", root, panelsito ) elseif isCursorOnElement ( 440, 348, 146, 32 ) then abririnflar () removeEventHandler ( "onClientRender", root, panelsito ) end end end addEventHandler ( "onClientClick", getRootElement(), repararlo)
×
×
  • Create New...