Jump to content

Emnadai

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Emnadai

  1. does not create any market or seller x = 2169.82, y = 1687.11, Z = 10.82
  2. HELP, I HAVE A DRUG PANEL IN SPANISH, BUT YOU WILL UNDERSTAND, I NEED HELP WHEN PURCHASING, SO THAT THE USER WHO HAS 0 MONEY, A RED MESSAGE APPEARS IN THE CHAT THAT HE SHOULD HAVE MONEY, TO THE ONE WHO HAS IT, LET HIM BUY, AND HIS PRODUCT GOES TO THE F2 PANEL THAT WE HAVE ALREADY CREATED, BUT WHEN WE BUY, NO "PRODUCT" GOES TO OUR F2 PANEL EITHER AND WE CAN USE IT- CLIENT.LUA local inventario = { ["THC"] = 0, ["LSD"] = 0, ["Cocaina"] = 0, ["Heroina"] = 0 } local productosVendedor = {"THC", "LSD", "Cocaina", "Heroina"} local precios = { ["THC"] = 500, ["LSD"] = 500, ["Cocaina"] = 500, ["Heroina"] = 500 } local ventana, lista, usarButton, cerrarButton -- Función para abrir el menú de compra function abrirMenuDeCompra() ventana = guiCreateWindow(0.3, 0.3, 0.4, 0.5, "Menu de Compra", true) lista = guiCreateGridList(0.1, 0.2, 0.8, 0.5, true, ventana) local columnaProducto = guiGridListAddColumn(lista, "Producto", 0.6) local columnaPrecio = guiGridListAddColumn(lista, "Precio", 0.3) for i, producto in ipairs(productosVendedor) do local row = guiGridListAddRow(lista) guiGridListSetItemText(lista, row, columnaProducto, producto, false, false) guiGridListSetItemText(lista, row, columnaPrecio, "$"..precios[producto], false, false) end local comprarButton = guiCreateButton(0.1, 0.75, 0.8, 0.1, "Comprar Producto", true, ventana) guiSetProperty(comprarButton, "NormalTextColour", "FF0000FF") -- Botón en rojo cerrarButton = guiCreateButton(0.1, 0.88, 0.8, 0.1, "Cerrar", true, ventana) guiSetProperty(cerrarButton, "NormalTextColour", "FFFFFFFF") -- Botón de cerrar -- Evento para comprar productos addEventHandler("onClientGUIClick", comprarButton, function() local selectedItem = guiGridListGetSelectedItem(lista) if selectedItem ~= -1 then local producto = guiGridListGetItemText(lista, selectedItem, columnaProducto) triggerServerEvent("comprarProducto", resourceRoot, producto) end end, false) addEventHandler("onClientGUIClick", cerrarButton, function() if isElement(ventana) then destroyElement(ventana) showCursor(false) end end, false) showCursor(true) end addEvent("abrirMenuDeCompra", true) addEventHandler("abrirMenuDeCompra", resourceRoot, abrirMenuDeCompra) -- Función para agregar el producto al inventario del jugador function agregarProductoAlInventario(producto) if inventario[producto] then inventario[producto] = inventario[producto] + 1 else inventario[producto] = 1 end actualizarPanelDeInventario() end addEvent("agregarProductoAlInventario", true) addEventHandler("agregarProductoAlInventario", resourceRoot, agregarProductoAlInventario) -- Función para mostrar mensaje de compra fallida function mostrarMensajeCompraFallida() outputChatBox("No tienes suficiente dinero para comprar este producto.", 255, 0, 0, true) end addEvent("mostrarMensajeCompraFallida", true) addEventHandler("mostrarMensajeCompraFallida", resourceRoot, mostrarMensajeCompraFallida) -- Función para mostrar mensaje de compra exitosa function mostrarMensajeCompraExitosa(producto) outputChatBox("Compra exitosa de " .. producto .. ". ¡Gracias por tu compra!", 0, 255, 0, true) end addEvent("mostrarMensajeCompraExitosa", true) addEventHandler("mostrarMensajeCompraExitosa", resourceRoot, mostrarMensajeCompraExitosa) -- Función para abrir/cerrar el panel de inventario (F2) function togglePanelDeInventario() if isElement(ventana) then destroyElement(ventana) showCursor(false) else ventana = guiCreateWindow(0.3, 0.3, 0.4, 0.5, "Inventario de Drogas", true) lista = guiCreateGridList(0.1, 0.2, 0.8, 0.5, true, ventana) local columnaProducto = guiGridListAddColumn(lista, "Producto", 0.6) local columnaCantidad = guiGridListAddColumn(lista, "Cantidad", 0.3) for i, producto in ipairs(productosVendedor) do local row = guiGridListAddRow(lista) guiGridListSetItemText(lista, row, columnaProducto, producto, false, false) local cantidad = inventario[producto] or 0 guiGridListSetItemText(lista, row, columnaCantidad, tostring(cantidad), false, false) if cantidad == 0 then guiGridListSetItemColor(lista, row, columnaCantidad, 255, 255, 255) -- Texto blanco else guiGridListSetItemColor(lista, row, columnaCantidad, 0, 0, 0) -- Texto negro end end usarButton = guiCreateButton(0.1, 0.75, 0.8, 0.1, "Usar Producto", true, ventana) guiSetProperty(usarButton, "NormalTextColour", "FF0000FF") -- Botón en rojo cerrarButton = guiCreateButton(0.1, 0.88, 0.8, 0.1, "Cerrar", true, ventana) guiSetProperty(cerrarButton, "NormalTextColour", "FFFFFFFF") -- Botón de cerrar addEventHandler("onClientGUIClick", usarButton, function() local selectedItem = guiGridListGetSelectedItem(lista) if selectedItem ~= -1 then local producto = guiGridListGetItemText(lista, selectedItem, columnaProducto) if inventario[producto] > 0 then usarProducto(producto) inventario[producto] = inventario[producto] - 1 actualizarPanelDeInventario() else outputChatBox("Debes ir al vendedor para comprar " .. producto, 255, 0, 0, true) end end end, false) addEventHandler("onClientGUIClick", cerrarButton, function() if isElement(ventana) then destroyElement(ventana) showCursor(false) end end, false) showCursor(true) end end bindKey("F2", "down", togglePanelDeInventario) -- Función para usar el producto seleccionado function usarProducto(producto) if producto == "THC" then outputChatBox("Usaste THC", 255, 0, 0, true) -- Aplica efectos de THC elseif producto == "LSD" then outputChatBox("Usaste LSD", 0, 255, 0, true) -- Aplica efectos de LSD elseif producto == "Cocaina" then outputChatBox("Usaste Cocaina", 255, 255, 0, true) -- Aplica efectos de Cocaina elseif producto == "Heroina" then outputChatBox("Usaste Heroina", 128, 0, 128, true) -- Aplica efectos de Heroina end end -- Función para actualizar el panel de inventario function actualizarPanelDeInventario() if isElement(ventana) then destroyElement(ventana) togglePanelDeInventario() end end SERVER.LUA -- Crea un vendedor en una ubicación específica local vendedor = createPed(50, 2165.93, 1696.37, 10.82) -- Congela el vendedor para que no se mueva ni muera setElementFrozen(vendedor, true) setElementData(vendedor, "invincible", true) -- Crea un marker (área de interacción) cerca del vendedor local marketMarker = createMarker(2165.93, 1696.37, 10.10, "cylinder", 1.5, 255, 0, 0, 150) -- Función para mostrar el menú de compra function mostrarMenuDeCompra(player) triggerClientEvent(player, "abrirMenuDeCompra", resourceRoot) end -- Función para manejar la compra de productos function comprarProducto(player, producto) local precio = 500 if getPlayerMoney(player) >= precio then takePlayerMoney(player, precio) triggerClientEvent(player, "agregarProductoAlInventario", resourceRoot, producto) triggerClientEvent(player, "mostrarMensajeCompraExitosa", resourceRoot, producto) else triggerClientEvent(player, "mostrarMensajeCompraFallida", resourceRoot) end end -- Evento para mostrar el menú de compra cuando el jugador entra en el marker addEventHandler("onMarkerHit", marketMarker, function(player) if getElementType(player) == "player" then mostrarMenuDeCompra(player) end end) -- Evento para manejar la compra de productos addEvent("comprarProducto", true) addEventHandler("comprarProducto", resourceRoot, comprarProducto) -- Hacer al ped invulnerable addEventHandler("onPedWasted", root, function() if source == vendedor then cancelEvent() end end) addEventHandler("onClientPedDamage", root, function() if source == vendedor then cancelEvent() end end)
  3. Necesito un panel de gang, pero. Funcional ya probe los de mta resource y no existe.
  4. check the meta.xml of resource2
  5. Try reinstalling your gta or changing your gta file. Second/ You must delete your mtasa with all resources, maybe you have configured some key or bind command to exit or pause keys
  6. In the mta configuration, in binds, make sure you have the keys correctly configured and if the error persists, log in as admin, and remove the resource from the server or directly from the console.
  7. Emnadai

    ¿Shop?

    Hi, I want to know how I can make when the user enters a market the store appears (Panel)
  8. Emnadai

    ¿Tienda?

    Como puedo hacer que mi market cuando el usuario ingrese hay mi tienda aparezca un panel... ¿Alguien me explica?
  9. Emnadai

    race error

    Hello everyone, is that I have a prolema in my server which is that when someone dies the rest dies the same is in race. Does anyone help me with this?
  10. Buenos dias o noches , alguien tiene ese "Resource" que lo que hace es dejar tus ramplas juntas e exactas
×
×
  • Create New...