Jump to content

vallejo

Members
  • Posts

    95
  • Joined

  • Last visited

Everything posted by vallejo

  1. Mira lo q tengo hasta el momento, solamente me crea la primera posición que tomo y de repeso no me muestra la GUI: marcadores ={} function Marcador(thePlayer) triggerClientEvent(thePlayer, "mostrarPanel", thePlayer) -- Utilizamos un evento Client end ----------Crear Marcador y comprobamos si es administrador--------------------- function crearMarcador(thePlayer, cmd) local obtCuent = getAccountName(getPlayerAccount(thePlayer)) -- Obtenemos el nombre de la cuenta if isObjectInACLGroup("user."..obtCuent, aclGetGroup("Admin")) then -- Comparamos si esta en el grupo de administradores LeerTxt() for i=1, #marcadores do local x, y, z = unpack(marcadores) --tipo, tamano, r, g, b, a local marc = createMarker( x, y, z, "cylinder", 2, 0 ,255, 0, 155, root ) addEventHandler("onMarkerHit", marc, Marcador) --Llamamos la funcion Marcador cuando un jugador toca el marker end end end addEvent("p", true) addEventHandler("p", root, crearMarcador) addCommandHandler("crea", crearMarcador) function crearTxt(thePlayer) ------------------- Creamos el archivo y lo escribimos ---------------------------------- local x, y, z = getElementPosition(thePlayer) -- Obtenemos la posición del jugador local position = math.floor(x) .. ", " .. math.floor(y) ..", ".. math.floor(z-1) ..",\r\n" -- Convertimos a enteros if fileExists ( "posicion.txt" ) then local file = fileOpen("posicion.txt") fileSetPos ( file, fileGetSize ( file ) ) fileWrite(file, position) fileClose(file) else local file = fileCreate("posicion.txt") fileWrite(file, position) fileClose(file) end end addCommandHandler("c", crearTxt) function LeerTxt(Player) local hFile = fileOpen("posicion.txt", true) if hFile then local buffer buffer = fileRead(hFile, 10000) strtable = split(buffer, ",") for i = 1, #strtable do marcadores[i] = tostring(strtable[i]) outputChatBox("test"..marcadores[i], Player) end fileClose(hFile) else outputConsole("Unable to open test.txt") end end
  2. si funciona, lo que busco es que cuando yo ponga un marker tome la posición mia y luego la escriba y genere el marcador en esa posición pero obviamente la posición la quiero guardar en el .txt y extraerla de hay.
  3. Ahora quiero extraer los datos del archivo y almacenarlos en una tabla. marcadores ={} function LeerTxt(Player) local hFile = fileOpen("posicion.txt", true) if hFile then local buffer buffer = fileRead(hFile, 10000) -- ... read the next 500 bytes... for i, #buffer do marcadores[i] = split(valor, ",") outputConsole(marcadores[i], Player) end -- ... and output them to the console fileClose(hFile) -- close the file once we're done with it else outputConsole("Unable to open test.txt") end end
  4. como puedo asignarle la información a una tabla?
  5. Ya lo había desarrollado.
  6. Como puedo escribir la posición de un jugador en un archivo .txt Aquí capturo la posición pero no se como pasarlo. local x,y,z = getElementPosition(thePlayer)
  7. marcadores ={ { 1536, -1670, 13, "cylinder", 1.5, 0 ,255, 0, 155 }, { 1536, -1676, 13, "cylinder", 1.5, 0 ,255, 0, 155 }, } for i=1, #marcadores do local x, y, z, tipo, tamano, r, g, b, a = unpack( marcadores ) createMarker( x, y, z, tipo, tamano, r, g, b, a ) end Utilizo esto y me sale error en el argumento 1, ademas el código como lo paso no funciona tiene error en la linea. marker[ i ] = createMarker( x, y, z, tipo, tamano, r, g, b, a )
  8. Me explicss para que sirve el unpack y aclararme, dudas y darme un significado de cada uso thePlayer localPlayer source client root getRootElement resourceRootElement, si me equivoco en alguno me corrigen
  9. Me podrías indicar como, yo tengo esto: local marker = createMarker(1536.7890625, -1670.009765625, 13.3828125, "cylinder", 1.5, 0 ,255, 0, 155) local marker = createMarker(1536.970703125, -1676.1572265625, 13.3828125, "cylinder", 1.5, 0 ,255, 0, 155) function Marcador(thePlayer, marker) triggerClientEvent(thePlayer, "mirarPanel", thePlayer) -- Utilizamos un evento Client end addEventHandler("onMarkerHit", marker, Marcador)
  10. Este es el código, lo tengo del lado del client: Error: function vehicle() if getElementType(localPlayer) == "player" then if isPedInVehicle(localPlayer)==true then return end if isElement( veh ) then destroyElement( veh ) end local x,y,z = getElementPosition(localPlayer) veh = createVehicle(462, x, y, z) warpPedIntoVehicle(client, veh) end end
  11. Buenas noches, me gustaría saber como puedo hacer que en mi mapa tengo múltiples marker, y cada que entre a cada uno de ellos que están ubicados en diferentes partes me abra siempre el mismo GUI.
  12. Buenas tardes, tengo este bind de la gui y el DxDrawText entonces quiero que cuando se presiones sea disable el DxDraw Text ya que lo unico que desaparece es la Gui gracias. GUIEditor = { staticimage = {} } ventanaP = guiCreateStaticImage(0.31, 0.24, 0.38, 0.53, ":ArmasVenta/imagenes/Fondo.png", true) guiSetAlpha(ventanaP, 0.53) GUIEditor.staticimage[1] = guiCreateStaticImage(0.02, 0.08, 0.15, 0.18, ":ArmasVenta/imagenes/DEAGLE1icon.png", true, ventanaP) GUIEditor.staticimage[2] = guiCreateStaticImage(0.18, 0.08, 0.15, 0.18, ":ArmasVenta/imagenes/sawnicon.png", true, ventanaP) GUIEditor.staticimage[3] = guiCreateStaticImage(0.34, 0.08, 0.15, 0.18, ":ArmasVenta/imagenes/m4icon.png", true, ventanaP) ComprarArma = guiCreateButton(0.32, 0.92, 0.17, 0.06, "Comprar arma", true, ventanaP) guiSetProperty(ComprarArma, "NormalTextColour", "FF48FE08") DeagleRadio = guiCreateRadioButton(0.04, 0.27, 0.10, 0.04, "Deagle", true, ventanaP) guiSetFont(DeagleRadio, "default-bold-small") Cerrar = guiCreateButton(0.51, 0.92, 0.17, 0.06, "Cerrar", true, ventanaP) guiSetProperty(Cerrar, "NormalTextColour", "FF48FE08") SawnRadio = guiCreateRadioButton(0.21, 0.27, 0.09, 0.04, "Sawn", true, ventanaP) guiSetFont(SawnRadio, "default-bold-small") guiRadioButtonSetSelected(SawnRadio, true) M4Radio = guiCreateRadioButton(0.38, 0.27, 0.06, 0.04, "M4", true, ventanaP) guiSetFont(M4Radio, "default-bold-small") guiSetVisible(ventanaP, false) local screenW, screenH = guiGetScreenSize() function text() dxDrawText("Armas Comunidad Latina", (screenW * 0.2771) - 1, (screenH * 0.1673) - 1, (screenW * 0.7279) - 1, (screenH * 0.2369) - 1, tocolor(218, 44, 10, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("Armas Comunidad Latina", (screenW * 0.2771) + 1, (screenH * 0.1673) - 1, (screenW * 0.7279) + 1, (screenH * 0.2369) - 1, tocolor(218, 44, 10, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("Armas Comunidad Latina", (screenW * 0.2771) - 1, (screenH * 0.1673) + 1, (screenW * 0.7279) - 1, (screenH * 0.2369) + 1, tocolor(218, 44, 10, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("Armas Comunidad Latina", (screenW * 0.2771) + 1, (screenH * 0.1673) + 1, (screenW * 0.7279) + 1, (screenH * 0.2369) + 1, tocolor(218, 44, 10, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("Armas Comunidad Latina", screenW * 0.2771, screenH * 0.1673, screenW * 0.7279, screenH * 0.2369, tocolor(254, 254, 254, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false) end function abrirCerrar() -- Por medio del comando cerramos la GUI if (guiGetVisible(ventanaP) == false) then addEventHandler ( "onClientRender", root, text ) -- keep the text visible with onClientRender. guiSetVisible(ventanaP, true) showCursor(true) else guiSetVisible(ventanaP, false) showCursor(false) end end bindKey("f3","down",abrirCerrar) addEventHandler("onClientGUIClick", Cerrar, abrirCerrar, false)
  13. Buenos días me gustaría que alguien me colaborara explicándome en que momento debo usar funciones de Client side, y en que momento de Server side quiero tener esos conceptos claros porque en muchas ocasiones me confunde.
  14. Man hay un problema, cada vez que algún jugador presiona F1 sea cual sea se le abre el panel, si estamos tu y yo en un servidor y tu presionas F1 se me abre a mi también el panel.
  15. Pero aclarame cual es la diferencia entre los resourceRoot, root, client, thePlayer, localPlayer y cuando se usa.
  16. Esto es lo que tengo por parte del client function () local seleccion = guiGridListGetItemText (Listado, guiGridListGetSelectedItem(Listado), 1) if seleccion == TC[1] then -- Historia CL local InfHis = fileOpen("txt/HistoriaCL.txt", true) --Abrimos archivos local lHis = fileRead(InfHis, 20000) -- Leemos el archivo guiSetText(MemoInf, lHis) fileClose(InfHis) -- Cerramos archivos elseif seleccion == TC[2] then --Reglas local InfReg = fileOpen("txt/Reglamentos.txt", true) local lReg = fileRead(InfReg, 20000) guiSetText(MemoInf, lReg) fileClose(InfReg) elseif seleccion == TC[3]then -- Administradores local InfAdm = fileOpen("txt/Administradores.txt", true) local lAdm = fileRead(InfAdm, 20000) guiSetText(MemoInf, lAdm) fileClose(InfAdm) elseif seleccion == TC[4]then -- Comandos local InfCom = fileOpen("txt/Comandos.txt", true) local lCom = fileRead(InfCom, 20000) guiSetText(MemoInf, lCom) fileClose(InfCom) elseif seleccion == TC[5]then -- Donaciones local InfDon = fileOpen("txt/Donaciones.txt", true) local lDon = fileRead(InfDon, 20000) guiSetText(MemoInf, lDon) fileClose(InfDon) elseif seleccion == TC[6]then -- Contactos local InfCon = fileOpen("txt/Contactos.txt", true) local lCon = fileRead(InfCon, 20000) guiSetText(MemoInf, lCon) fileClose(InfCon) end end) triggerServerEvent("onPanel", localPlayer) function abrirPcerrarP () -- Aqui en esta funcion abrimos y cerramos la GUI con un bind if not guiGetVisible(VentanaP) then -- Si la ventana no es visible entonces guiSetVisible(VentanaP, true) -- Se muestre en pantalla la ventana showCursor(true) -- Activa el cursor else guiSetVisible(VentanaP, false) showCursor(false) end end bindKey("f1", "down", abrirPcerrarP) --Bind con la tecla F7 function btnCerrarP () -- Cerramos la GUI con el boton guiSetVisible(VentanaP , false) -- si la ventana es visible se cierra showCursor(false) --Desactiva el cursor end addEventHandler("onClientGUIClick", btnCerrar, btnCerrarP, false ) -- Al hacer clic funciona el boton
  17. También lo probé así y no funciona.
  18. Buenas me gustaría saber como puedo hacer que una GUI este des-habilitada antes de loguear un player, Ejemplo: El jugador entra al servidor pero no se ha logueado y tengo un panel bind al F1 quiero que mientras el usuario no este logueado no abra el panel F1 que solo lo haga cuando este logueado. Esta lineas tengo hechas pero no me anda. Server function AbrirS(Player) cuenta = getPlayerAccount (Player) if isGuestAccount (cuenta) then outputConsole ("Debes de registrarte para visualizar el panel", Player) end end addEvent( "onPanel", true ) addEventHandler("onPanel", root, AbrirS) Client triggerServerEvent("onPanel", localPlayer) Pero quiero saber en que parte iría el trigger..!
  19. Añade un contador que cuando entregue sume 1 C=0 C=c+1
  20. Recuerda cerrar el servidor para agregar. Hace poco me paso lo mismo y lo solucione.
  21. Buenas me gustaría saber como puedo asignarle la información a un memo estoy utilizando BD pero no me quiere dar, la información la guarda bien en la base de datos a la hora de leer o asignar no funciona sale en blanco. BDAct = dbConnect("sqlite", "archivoAct/arcAct.db") dbExec(BDAct, "CREATE TABLE IF NOT EXISTS Actualizacion (fecha TEXT PRIMARY KEY, Descripcion TEXT)") -- Creando tabla y BD function consultarArc(thePlayer) local info = dbExec(BDAct, "SELECT * FROM Actualizacion") triggerClientEvent("Evento", source, info) end addEvent("onConsultar", true) addEventHandler("onConsultar", root, consultarArc) -- Visible para todos y la parte del cliente: VentanaP = guiCreateWindow(0.20, 0.20, 0.57, 0.60, "Actualizaciones del servidor", true) guiWindowSetSizable(VentanaP, false) guiSetAlpha(VentanaP, 0.76) btnCerrar = guiCreateButton(0.91, 0.05, 0.05, 0.06, "X", true, VentanaP) -- Boton guiSetFont(btnCerrar, "default-bold-small") guiSetProperty(btnCerrar, "NormalTextColour", "FFFE0000") MemoAct = guiCreateMemo(0.01, 0.41, 0.97, 0.57, "", true, VentanaP) -- Memo guiMemoSetReadOnly(MemoAct, true) logo = guiCreateStaticImage(0.09, 0.13, 0.81, 0.24, ":PanelActualizacion/imagen/LogoCl.png", true, VentanaP) -- Logo de CL guiSetVisible(VentanaP, false) -- Hacemos la ventana invisible porque si no lo hacemos es visible siempre addCommandHandler("actualizacion",function () guiSetVisible(VentanaP, true) showCursor(true) end) function btnCerrarP () -- Cerramos la GUI con el boton guiSetVisible(VentanaP , false) -- si la ventana es visible se cierra showCursor(false) --Desactiva el cursor end addEventHandler("onClientGUIClick", btnCerrar, btnCerrarP, false ) -- Al hacer clic funciona el boton function cargInf(info) guiSetText(MemoAct, info) end addEvent("Evento", true) addEventHandler("Evento", root, cargInf)
  22. Ya lo arregle, solo que me borra la información ya almacenada en el .txt como puedo solucionarlo.
  23. Es raro no me quiere escribir nada en el archivo no entiendo porque.
×
×
  • Create New...