Jump to content

Wananazo

Members
  • Posts

    26
  • Joined

  • Last visited

Posts posted by Wananazo

  1. It does not show the marker in the game, well I try to make a marker for conquest but I don't know what I need to make it work well

     

    -- Configuraciones
    local tiempoDeDisputa = 90 -- Tiempo en segundos para disputa del marker
    local tiempoCierre = 2 * 24 * 60 * 60 -- Tiempo en segundos para cerrar el marker (2 días)
    local aclPermitidos = { -- ACL permitidos para tomar el marker
        ["admin"] = true,
        ["vip"] = true,
        ["jugadorpremium"] = true
    }
    
    -- Coordenadas del marker (¡ajusta estos valores a tus necesidades!)
    local x = -371.26409912109 -- coordenada x ,,
    local y = -1048.9447021484 -- coordenada y
    local z = 59.283256530762  -- coordenada z
    
    -- Variables globales
    local marker = nil
    local tiempoRestante = tiempoDeDisputa
    
    -- Función para actualizar el tiempo restante en pantalla
    function actualizarTiempoRestante()
        if isElement(marker) then
            setElementData(marker, "tiempoRestante", tiempoRestante)
        end
    end
    
    -- Función para notificar que el marker está siendo tomado
    function notificarTomandoMarker(jugador)
        outputChatBox("¡" .. getPlayerName(jugador) .. " está tomando el marker!", root, 255, 165, 0) -- Mensaje en chat
    end
    
    -- Función para notificar que el marker se cerró
    function notificarMarkerCerrado()
        outputChatBox("El marker ha sido cerrado.", root, 255, 0, 0) -- Mensaje en chat
    end
    
    -- Función para notificar que el marker abrió después de los 2 días
    function notificarMarkerAbierto()
        outputChatBox("El marker ha sido abierto nuevamente.", root, 0, 255, 0) -- Mensaje en chat
    end
    
    -- Función para tomar el marker
    function tomarMarker(jugador)
        local acl = getPlayerACL(jugador)
        if not aclPermitidos[acl] then
            outputChatBox("No tienes permiso para tomar el marker.", jugador, 255, 0, 0) -- Mensaje en chat al jugador
            return
        end
    
        if not isElement(marker) then
            marker = createMarker(x, y, z - 1, "cylinder", 5, 255, 165, 0, 150) -- Crear el marker en la posición (x, y, z) con color naranja y forma cilíndrica
            setElementData(marker, "tiempoRestante", tiempoDeDisputa) -- Establecer el tiempo restante inicial
            setElementVisibleTo(marker, root, true) -- Hacer que el marker sea visible para todos los jugadores
            setTimer(cerrarMarker, tiempoCierre * 1000, 1) -- Cerrar el marker después de tiempoCierre segundos
            notificarMarkerAbierto()
        end
    
        notificarTomandoMarker(jugador)
    end
    
    -- Función para cerrar el marker
    function cerrarMarker()
        destroyElement(marker)
        marker = nil
        notificarMarkerCerrado()
        tiempoRestante = tiempoDeDisputa -- Reiniciar el tiempo restante
        actualizarTiempoRestante()
    end
    
    -- Función para actualizar el tiempo restante cada segundo
    function actualizarTiempo()
        tiempoRestante = tiempoRestante - 1
        actualizarTiempoRestante()
    
        if tiempoRestante <= 0 then
            cerrarMarker()
        end
    end
    
    -- Inicializar el script
    addEventHandler("onResourceStart", resourceRoot, function()
        setTimer(actualizarTiempo, 1000, tiempoDeDisputa)
    end)
    
    -- Asignar la función tomarMarker al evento onMarkerHit
    addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension)
        if isElement(marker) and source == marker and getElementType(hitElement) == "player" then
            tomarMarker(hitElement)
        end
    end)
    
    -- Avisar al ACL policial cuando el marker está siendo tomado
    function avisarPolicial()
        for _, jugador in ipairs(getElementsByType("player")) do
            local acl = getPlayerACL(jugador)
            if acl == "policial" then
                outputChatBox("¡El marker está siendo tomado!", jugador, 255, 0, 0) -- Mensaje en chat al policía
            end
        end
    end
    
    -- Asignar la función avisarPolicial al evento onMarkerHit
    addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension)
        if isElement(marker) and source == marker and getElementType(hitElement) == "player" then
            avisarPolicial()
        end
    end)


     

  2. watching a tutorial I achieved this by comparing it with another script, I really don't know if it turned out well

    I would like to know what I would add to the clientside here I leave the clientside so that they can add it to me and indicate the function to be able to understand it thanks
     

    Serverside

     

    function maletero(estado, playerSource, vehicle, item, qntd)
        if estado == "guardar" then
            if GiveAndTakeAndGetItem("get", playerSource, item) >= qntd then
                if not isTimer(acao[playerSource]) then
                    acao[playerSource] = setTimer(function() end, 1300, 1)
                    setPedAnimation(playerSource, "POLICE", "CopTraf_Away", 1300, true, false, false, false, _, true)
                    setTimer(function()
                        PlaySound3D(playerSource, "trash", 20)
                        GiveAndTakeAndGetItem("take", playerSource, item, qntd)
                        exports._infobox:addNotification(playerSource, "Guardaste "..qntd.."x '"..realName[item][1].."'", "success")
                        local name = getPlayerName(playerSource)
                        local id = getElementData(playerSource, "ID") or "N/A"
                        exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nVehículo: "..getVehicleName(vehicle).."\nAcción: "..estado)
                        for _, players in pairs(getElementsByType("player")) do
                            if players ~= playerSource then
                                local x, y, z = getElementPosition(playerSource)
                                local x2, y2, z2 = getElementPosition(players)
                                if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
                                    local name = getPlayerName(playerSource)
                                    local id = getElementData(playerSource, "ID") or "N/A"
                                    outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") guardó "..qntd.."x '"..realName[item][1].."' en el maletero del vehículo cercano a ti.", players, 30, 144, 255, true)
                                end
                            end
                        end
                        if not bau[vehicle] then
                            bau[vehicle] = {}
                        end
                        if bau[vehicle][item] then
                            bau[vehicle][item][1] = bau[vehicle][item][1] + tonumber(qntd)
                        else
                            bau[vehicle][item] = {}
                            bau[vehicle][item][1] = tonumber(qntd)
                        end
                    end, 1300, 1)
                end
            else
                exports._infobox:addNotification(playerSource, "No posees la cantidad indicada de este item", "error")
            end
        elseif estado == "pegar" then
            if bau[vehicle] then
                if bau[vehicle][item] then
                    if bau[vehicle][item][1] >= qntd then
                        if GiveAndTakeAndGetItem("give", playerSource, item, qntd) then
                            bau[vehicle][item][1] = bau[vehicle][item][1] - qntd
                            if bau[vehicle][item][1] <= 0 then
                                bau[vehicle][item] = nil
                            end
                            exports._infobox:addNotification(playerSource, "Tomaste "..qntd.."x '"..realName[item][1].."' del maletero del vehículo", "success")
                            local name = getPlayerName(playerSource)
                            local id = getElementData(playerSource, "ID") or "N/A"
                            exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nVehículo: "..getVehicleName(vehicle).."\nAcción: "..estado)
                            for _, players in pairs(getElementsByType("player")) do
                                if players ~= playerSource then
                                    local x, y, z = getElementPosition(playerSource)
                                    local x2, y2, z2 = getElementPosition(players)
                                    if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
                                        local name = getPlayerName(playerSource)
                                        local id = getElementData(playerSource, "ID") or "N/A"
                                        outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") tomó "..qntd.."x '"..realName[item][1].."' del maletero de un vehículo cercano a ti.", players, 30, 144, 255, true)
                                    end
                                end
                            end
                        else
                            exports._infobox:addNotification(playerSource, "No tienes capacidad en la mochila para tomar este item", "error")
                        end
                    else
                        exports._infobox:addNotification(playerSource, "El maletero del vehículo no posee la cantidad indicada de este item", "error")
                    end
                else
                    exports._infobox:addNotification(playerSource, "El maletero del vehículo no posee este item", "error")
                end
            else
                exports._infobox:addNotification(playerSource, "El vehículo no tiene maletero", "error")
            end
        end
    end
    addEvent("maletero", true)
    addEventHandler("maletero", resourceRoot, maletero)

    Clientside:
     

    function maletero(estado, playerSource, vehicle, item, qntd)
        if estado == "guardar" then
            if GiveAndTakeAndGetItem("get", playerSource, item) >= qntd then
                if not isTimer(acao[playerSource]) then
                    acao[playerSource] = setTimer(function() end, 1300, 1)
                    setPedAnimation(playerSource, "POLICE", "CopTraf_Away", 1300, true, false, false, false, _, true)
                    setTimer(function()
                        PlaySound3D(playerSource, "trash", 20)
                        GiveAndTakeAndGetItem("take", playerSource, item, qntd)
                        exports._infobox:addNotification(playerSource, "Guardaste "..qntd.."x '"..realName[item][1].."'", "success")
                        local name = getPlayerName(playerSource)
                        local id = getElementData(playerSource, "ID") or "N/A"
                        exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nVehículo: "..getVehicleName(vehicle).."\nAcción: "..estado)
                        for _, players in pairs(getElementsByType("player")) do
                            if players ~= playerSource then
                                local x, y, z = getElementPosition(playerSource)
                                local x2, y2, z2 = getElementPosition(players)
                                if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
                                    local name = getPlayerName(playerSource)
                                    local id = getElementData(playerSource, "ID") or "N/A"
                                    outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") guardó "..qntd.."x '"..realName[item][1].."' en el maletero del vehículo cercano a ti.", players, 30, 144, 255, true)
                                end
                            end
                        end
                        if not bau[vehicle] then
                            bau[vehicle] = {}
                        end
                        if bau[vehicle][item] then
                            bau[vehicle][item][1] = bau[vehicle][item][1] + tonumber(qntd)
                        else
                            bau[vehicle][item] = {}
                            bau[vehicle][item][1] = tonumber(qntd)
                        end
                    end, 1300, 1)
                end
            else
                exports._infobox:addNotification(playerSource, "No posees la cantidad indicada de este item", "error")
            end
        elseif estado == "pegar" then
            if bau[vehicle] then
                if bau[vehicle][item] then
                    if bau[vehicle][item][1] >= qntd then
                        if GiveAndTakeAndGetItem("give", playerSource, item, qntd) then
                            bau[vehicle][item][1] = bau[vehicle][item][1] - qntd
                            if bau[vehicle][item][1] <= 0 then
                                bau[vehicle][item] = nil
                            end
                            exports._infobox:addNotification(playerSource, "Tomaste "..qntd.."x '"..realName[item][1].."' del maletero del vehículo", "success")
                            local name = getPlayerName(playerSource)
                            local id = getElementData(playerSource, "ID") or "N/A"
                            exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nVehículo: "..getVehicleName(vehicle).."\nAcción: "..estado)
                            for _, players in pairs(getElementsByType("player")) do
                                if players ~= playerSource then
                                    local x, y, z = getElementPosition(playerSource)
                                    local x2, y2, z2 = getElementPosition(players)
                                    if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
                                        local name = getPlayerName(playerSource)
                                        local id = getElementData(playerSource, "ID") or "N/A"
                                        outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") tomó "..qntd.."x '"..realName[item][1].."' del maletero de un vehículo cercano a ti.", players, 30, 144, 255, true)
                                    end
                                end
                            end
                        else
                            exports._infobox:addNotification(playerSource, "No tienes capacidad en la mochila para tomar este item", "error")
                        end
                    else
                        exports._infobox:addNotification(playerSource, "El maletero del vehículo no posee la cantidad indicada de este item", "error")
                    end
                else
                    exports._infobox:addNotification(playerSource, "El maletero del vehículo no posee este item", "error")
                end
            else
                exports._infobox:addNotification(playerSource, "El vehículo no tiene maletero", "error")
            end
        end
    end
    addEvent("maletero", true)
    addEventHandler("maletero", resourceRoot, maletero)




     

  3. elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    			local veiculo = getElementData(playerSource, "Vehicle:Owner")
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 2.5 then
    						local counter = 0
    						for seat, player in pairs(getVehicleOccupants(clickedWorld)) do
        						counter = counter + 1
    						end
    						if counter < 1 then
    							if getElementData(clickedWorld, "Locked") then
    								acao[playerSource] = setTimer(function() end, 9, 1)
    								PlaySound3D(playerSource, "vehicle-alarm2", "all")
    								--GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    								
    								 --recuerda poner la alarma 
    								--setElementFrozen(playerSource, true)
    								--setElementFrozen(clickedWorld, true)
    								--setPedAnimation(playerSource, "CAMERA", "piccrch_take", 90000, true, false, false, false, _, true)
    								--triggerClientEvent(playerSource, "progressBar", playerSource, 90000)
    								--blip[clickedWorld] = createBlipAttachedTo(clickedWorld, 36)
    								--setElementVisibleTo(blip[clickedWorld], root, false)
    								for _, players in pairs(getElementsByType("player")) do
    									--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup(ACL_VEH)) then
    										--exports._infobox:addNotification(players, "[ESTACIÓN]: Reporte de robo de vehículo en curso, el lugar de ocurrencia fue indicado en su GPS", "warning")
    										--setElementVisibleTo(blip[clickedWorld], players, true)
    									end
    								
    								--setTimer(function()
    									--setPedAnimation(playerSource, nil)
    									--setElementFrozen(playerSource, false)
    									--setElementFrozen(clickedWorld, false)
    									--destroyElement(blip[clickedWorld])
    									--blip[clickedWorld] = nil
    									local random = math.random(1)
    									if random == 1 then
    										setElementData(clickedWorld, "Locked", false) 
    										setVehicleLocked(clickedWorld, false)
    										exports._infobox:addNotification(playerSource, "Vehiculo Desbloqueado", "success")
    										local name = getPlayerName(playerSource)
    										local ID1 = getElementData(playerSource, "ID") or "N/A"
    										local model = getElementModel(clickedWorld)
    										exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nDueño: "..name.." ["..ID1.."]\nVehiculo: "..model)
    									else
    										exports._infobox:addNotification(playerSource, "Has quitado el seguro a tu vehiculo", "error")
    									end
    								
    							else
    								exports._infobox:addNotification(playerSource, "Este vehiculo ya esta desbloqueado", "error")
    							end
    						else
    							exports._infobox:addNotification(playerSource, "El vehiculo requiere estar vacio para poder abrirlo", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    			end

    I managed to put together this script, surely it has its errors, I am learning a bit clumsy, I would like it to have the function of sonar vehicle-alarm2 to block but I have not been able to do it
     

  4. 
    -----------------------------------------------------------------------------------------------------------------------------------------
    inventario = {}
    timerStart = {}
    gates = {}
    boxes = {}
    acao = {}
    item = {}
    arma = {}
    capacete = {}
    maleta = {}
    mascara = {}
    som = {}
    flor = {}
    tempo = {}
    cigarro = {}
    algemado = {}
    algemando = {}
    blip = {}
    curado = {}
    timerAlgema = {}
    bau = {}
    -----------------------------------------------------------------------------------------------------------------------------------------
    for i, v in pairs(GatePositions) do
    	gates[i] = createObject(GatePositions[i][2], GatePositions[i][3], GatePositions[i][4], GatePositions[i][5], 0, 0, GatePositions[i][11])
    end
    for i, v in pairs(BoxPositions) do
        boxes[i] = createObject(1227, BoxPositions[i][3], BoxPositions[i][4], BoxPositions[i][5]-0.2, BoxPositions[i][6], BoxPositions[i][7], BoxPositions[i][8])
        setElementData(boxes[i], "IsBox", BoxPositions[i][1])
        bau[BoxPositions[i][1]] = {}
        setElementInterior(boxes[i], BoxPositions[i][9])
        setElementDimension(boxes[i], BoxPositions[i][10])
    end
    -----------------------------------------------------------------------------------------------------------------------------------------
    function giveItem(playerSource, commandName, id, item, qntd)
    	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Vice-Presidente")) then
    		if not qntd then return exports._infobox:addNotification(playerSource, "Utilice: /giveitem ID ITEM CANTIDAD", "error") end
    		for i, v in pairs(getElementsByType("player")) do
    			if getElementData(v, "ID") == tonumber(id) then
    				if GiveAndTakeAndGetItem("give", v, item, qntd) then
    					exports._infobox:addNotification(playerSource, "Diste "..qntd.."x '"..(realName[item][1]).."' Para el jugador "..getPlayerName(v), "success")
    					exports._infobox:addNotification(v, "Recibiste "..qntd.."x '"..(realName[item][1]).."' del Admin "..getPlayerName(playerSource), "info")
    					local name = getPlayerName(playerSource)
    					local ID1 = getElementData(playerSource, "ID") or "N/A"
    					local name2 = getPlayerName(v)
    					local ID2 = getElementData(v, "ID") or "N/A"
    					exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nItem: "..item.."\nCantidad: "..qntd.."\nOperación: Give")
    				else
    					exports._infobox:addNotification(playerSource, "El Jugador no tiene espacio en la mochila o dicho articulo no existe", "error")
    				end
    			end
    		end
    	end
    end
    addCommandHandler("giveitem", giveItem)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function takeItem(playerSource, commandName, id, item, qntd)
    	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Vice-Presidente")) then
    		if not id then return exports._infobox:addNotification(playerSource, "Utilice: /takeitem ID ITEM", "error") end
    		for i, v in pairs(getElementsByType("player")) do
    			if getElementData(v, "ID") == tonumber(id) then
    				if (qntd) then
    					if GiveAndTakeAndGetItem("take", v, item, tonumber(qntd)) then
    						exports._infobox:addNotification(playerSource, "Removiste "..qntd.."x '"..(realName[item][1]).."' del inventario del jugador "..getPlayerName(v), "success")
    						exports._infobox:addNotification(v, "El Admin "..getPlayerName(playerSource).." removió "..qntd.."x '"..(realName[item][1]).."' de tu inventario", "warning")
    						local name = getPlayerName(playerSource)
    						local ID1 = getElementData(playerSource, "ID") or "N/A"
    						local name2 = getPlayerName(v)
    						local ID2 = getElementData(v, "ID") or "N/A"
    						exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nItem: "..item.."\nCantidad: "..qntd.."\nOperación: Take")
    					else
    						exports._infobox:addNotification(playerSource, "El jugador no posee "..qntd.."x este item en su mochila o el item informado no existe", "error")
    					end
    				else
    					if GiveAndTakeAndGetItem("take", v, item, "all") then
    						exports._infobox:addNotification(playerSource, "Removiste todo '"..(realName[item][1]).."' del inventario del jugador "..getPlayerName(v), "success")
    						exports._infobox:addNotification(v, "El Admin "..getPlayerName(playerSource).." removió el item '"..(realName[item][1]).."' de tu inventario", "warning")
    						local name = getPlayerName(playerSource)
    						local ID1 = getElementData(playerSource, "ID") or "N/A"
    						local name2 = getPlayerName(v)
    						local ID2 = getElementData(v, "ID") or "N/A"
    						exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nItem: "..item.."\nCantidad: All\nOperación: Take")
    					else
    						exports._infobox:addNotification(playerSource, "El jugador no posee este item en su mochila o el item informado no existe", "error")
    					end
    				end
    			end
    		end
    	end
    end
    addCommandHandler("takeitem", takeItem)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function resetInv(playerSource, commandName, id)
    	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Vice-Presidente")) then
    		if not id then return exports._infobox:addNotification(playerSource, "Utilice: /takeitem ID ITEM", "error") end
    		for i, v in pairs(getElementsByType("player")) do
    			if getElementData(v, "ID") == tonumber(id) then
    				for index = #inventario[v], 1, -1 do
    					local item = inventario[v][index][1]
    					if not itensCantRemoved[item] then
    						GiveAndTakeAndGetItem("take", v, item, "all")
    					end
    				end
    				exports._infobox:addNotification(playerSource, "Reiniciaste el Inventario del Jugador "..getPlayerName(v), "success")
    				exports._infobox:addNotification(v, "El Admin "..getPlayerName(playerSource).." reinicio su inventario", "warning")
    				local name = getPlayerName(playerSource)
    				local ID1 = getElementData(playerSource, "ID") or "N/A"
    				local name2 = getPlayerName(v)
    				local ID2 = getElementData(v, "ID") or "N/A"
    				exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nStaff: "..name.." ["..ID1.."]\nJugador: "..name2.." ["..ID2.."]\nOperación: Reset")
    			end
    		end
    	end
    end
    addCommandHandler("resetinv", resetInv)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function GiveAndTakeAndGetItem(tipo, playerSource, item, qntd)
    	if realName[item] then
    		if tipo == "give" then
        		local peso = 0
        		local maxPeso = 30
        		for i, v in pairs(pesoItens) do
            		for index, value in pairs(inventario[playerSource]) do
                		if inventario[playerSource][index][1] == i then
                    		peso = peso + (pesoItens[i][1] * inventario[playerSource][index][2])
                		end
            		end
        		end
        		if getElementData(playerSource, "ouro") then
    				maxPeso = 30
    			elseif getElementData(playerSource, "platina") then
    				maxPeso = 40
    			elseif getElementData(playerSource, "diamante") then
    				maxPeso = 50
    			else
    				maxPeso = 25
    			end
        		if (peso + (pesoItens[item][1] * qntd)) <= maxPeso then
    				local count = false
    				for i, v in pairs(inventario[playerSource]) do
    					if inventario[playerSource][i][1] == item then
    						count = true
    					end
    				end
    				if count then
    					for i, v in pairs(inventario[playerSource]) do
    						if inventario[playerSource][i][1] == item then
    							inventario[playerSource][i][2] = inventario[playerSource][i][2] + tonumber(qntd)
    							triggerClientEvent(playerSource, "refresh", resourceRoot, inventario[playerSource])
    							return true
    						end
    					end
    				else
    					if #inventario[playerSource] < 30 then
    						local edit = {item, tonumber(qntd)}
    						table.insert(inventario[playerSource], edit)
    						triggerClientEvent(playerSource, "refresh", resourceRoot, inventario[playerSource])
    						return true
    					else
    						return false
    					end
    				end
    			else
    				return false
    			end
    		elseif tipo == "take" then
    			for i, v in pairs(inventario[playerSource]) do
    				if inventario[playerSource][i][1] == item then
    					if tostring(qntd) == "all" then
    						table.remove(inventario[playerSource], i)
    						removeItem(playerSource, item)
    					else
    						if inventario[playerSource][i][2] >= tonumber(qntd) then
    							inventario[playerSource][i][2] = inventario[playerSource][i][2] - tonumber(qntd)
    						else
    							return false
    						end
    					end
    					if inventario[playerSource][i] then
    						if inventario[playerSource][i][2] <= 0 then
    							table.remove(inventario[playerSource], i)
                        		removeItem(playerSource, item)
    						end
    					end
    					triggerClientEvent(playerSource, "refresh", resourceRoot, inventario[playerSource])
    					return true
    				end
    			end
    		elseif tipo == "get" then
    			for i, v in pairs(inventario[playerSource]) do
    				if inventario[playerSource][i][1] == item then
    					if inventario[playerSource][i][2] > 0 then
    						return inventario[playerSource][i][2]
    					else
    						return 0
    					end
    				end
    			end
    			return 0
    		end
    	end
    end
    
    function formatItens(table, type)
    	TableItens = table
    	if #TableItens ~= 0 then
    		if type == "bau" then
    			for i,v in ipairs(TableItens) do
    				local Item = v.Item
    				local Quantidade = v.Quantidade
    				TableItens[i].Nome = realName[Item][1]
    				TableItens[i].Peso = pesoItens[Item][1] 
    			end
    		else
    			for i,v in ipairs(TableItens) do
    				local Item = v[1]
    				local Quantidade = v[2]
    				TableItens[i][3] = realName[Item][1]
    				TableItens[i][4] = pesoItens[Item][1]
    			end
    		end
    	end
    	return TableItens
    end
    
    function getItensPlayer(player)
    	return (inventario[player] and formatItens(inventario[player]) or {})
    end
    -----------------------------------------------------------------------------------------------------------------------------------------
    function use(playerSource, itemUsed)
        if itemUsed == "suco" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(1544, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.26, -0.05, 0.14, 34, 108, 4)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(5, 10)
          				local sede = getElementData(playerSource, "sede") or 0
    					setElementData(playerSource, "sede", sede + random)
    					if getElementData(playerSource, "sede") > 100 then
    						setElementData(playerSource, "sede", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "refrigerante" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(2601, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
    				setObjectScale(item[playerSource], 0.9)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, 0.04, 0.06, 46, 110, -14)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(20, 35)
          				local sede = getElementData(playerSource, "sede") or 0
    					setElementData(playerSource, "sede", sede + random)
    					if getElementData(playerSource, "sede") > 100 then
    						setElementData(playerSource, "sede", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "whisky" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(1520, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true) 
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.25, 0.01, 0.11, 44, 100, -4)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(25, 30)
          				local sede = getElementData(playerSource, "sede") or 0
    					setElementData(playerSource, "sede", sede + random)
    					if getElementData(playerSource, "sede") > 100 then
    						setElementData(playerSource, "sede", 100)
    					end
          			end, 3000, 1)
          		end
          	else-- 
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error") --
          	end
        elseif itemUsed == "leite2" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(1484, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, -0.02, 0.13, 22, 132, 12)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local sede = getElementData(playerSource, "sede") or 0
    					setElementData(playerSource, "sede", sede + 50)
    					if getElementData(playerSource, "sede") > 100 then
    						setElementData(playerSource, "sede", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
         elseif itemUsed == "redbull" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(2601, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
    				setObjectScale(item[playerSource], 0.9)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, 0.04, 0.06, 46, 110, -14)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(50, 60)
          				local sede = getElementData(playerSource, "Energy") or 0
    					setElementData(playerSource, "Energy", sede + random)
    					if getElementData(playerSource, "Energy") > 100 then
    						setElementData(playerSource, "Energy", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
         elseif itemUsed == "monster" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(2601, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
    				setObjectScale(item[playerSource], 0.9)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, 0.04, 0.06, 46, 110, -14)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(10, 15)
          				local sede = getElementData(playerSource, "Energy") or 0
    					setElementData(playerSource, "Energy", sede + random)
    					if getElementData(playerSource, "Energy") > 100 then
    						setElementData(playerSource, "Energy", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "whisky" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(1520, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.25, 0.01, 0.11, 44, 100, -4)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(25, 30)
          				local sede = getElementData(playerSource, "sede") or 0
    					setElementData(playerSource, "sede", sede + random)
    					if getElementData(playerSource, "sede") > 100 then
    						setElementData(playerSource, "sede", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "leite2" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(1484, x, y, z)
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "VENDING", "VEND_Drink2_P", 3000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "drink", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 11, -0.01, -0.02, 0.13, 22, 132, 12)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local sede = getElementData(playerSource, "sede") or 0
    					setElementData(playerSource, "sede", sede + 50)
    					if getElementData(playerSource, "sede") > 100 then
    						setElementData(playerSource, "sede", 100)
    					end
          			end, 3000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "burrito" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(2769, x, y, z)
    				acao[playerSource] = setTimer(function() end, 5000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "FOOD", "EAT_Burger", 5000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "eat", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, 0.06, 0.03, 0.02, 50, 74, -88)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(5, 10)
          				local hunger = getElementData(playerSource, "hunger") or 0
          				local fezes = getElementData(playerSource, "fezes") or 0
    					setElementData(playerSource, "hunger", hunger + random)
    					setElementData(playerSource, "fezes", fezes + random)
    					if getElementData(playerSource, "fezes") > 100 then
    						setElementData(playerSource, "fezes", 100)
    					end
    					if getElementData(playerSource, "hunger") > 100 then
    						setElementData(playerSource, "hunger", 100)
    						setPedStat(playerSource, 21, getPedStat(playerSource, 21) + 100)
    					end
          			end, 5000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "pizza" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
          			local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(2702, x, y, z)
    				acao[playerSource] = setTimer(function() end, 5000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
    				setObjectScale(item[playerSource], 0.8)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "FOOD", "EAT_Pizza", 5000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "eat", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, -3.4694469519536e-18, 0.08, 0.05, -6, 251.5, 10)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(30, 45)
          				local hunger = getElementData(playerSource, "hunger") or 0
          				local fezes = getElementData(playerSource, "fezes") or 0
    					setElementData(playerSource, "hunger", hunger + random)
    					setElementData(playerSource, "fezes", fezes + random)
    					if getElementData(playerSource, "fezes") > 100 then
    						setElementData(playerSource, "fezes", 100)
    					end
    					if getElementData(playerSource, "hunger") > 100 then
    						setElementData(playerSource, "hunger", 100)
    						setPedStat(playerSource, 21, getPedStat(playerSource, 21) + 150)
    					end
          			end, 5000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "hamburguer" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				local x, y, z = getElementPosition(playerSource)
    				item[playerSource] = createObject(2703, x, y, z)
    				acao[playerSource] = setTimer(function() end, 5000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			local dim = getElementDimension(playerSource)
          			local int = getElementInterior(playerSource)
          			setElementDimension(item[playerSource], dim)
          			setElementInterior(item[playerSource], int)
          			setPedAnimation(playerSource, "FOOD", "EAT_Burger", 5000, false, true, false, false, _, true)
          			PlaySound3D(playerSource, "eat", 15)
          			exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, -0.02, 0.06, 0.05, -14, 8, -18)
          			setTimer(function()
          				destroyElement(item[playerSource])
          				item[playerSource] = nil
          				local random = math.random(25, 30)
          				local hunger = getElementData(playerSource, "hunger") or 0
          				local fezes = getElementData(playerSource, "fezes") or 0
    					setElementData(playerSource, "hunger", hunger + random)
    					setElementData(playerSource, "fezes", fezes + random)
    					if getElementData(playerSource, "fezes") > 100 then
    						setElementData(playerSource, "fezes", 100)
    					end
    					if getElementData(playerSource, "hunger") > 100 then
    						setElementData(playerSource, "hunger", 100)
    						setPedStat(playerSource, 21, getPedStat(playerSource, 21) + 200)
    					end
          			end, 5000, 1)
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "corda" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				triggerClientEvent(playerSource, "progressBar", playerSource, 1000)
    				acao[playerSource] = setTimer(function() 
    					exports["[MOD]Gang"]:algemar(playerSource)
    				end, 1000, 1)
    				--triggerClientEvent(playerSource, "MST.Notify",playerSource, "success", "Você segurou e amarrou")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5)
    		end
    	elseif itemUsed == "medatickets" then
    		local moedas = getElementData(source,"moneycoins") or 0
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				acao[playerSource] = setTimer(function() end, 3000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    				local random = math.random(1, 3)
    				local moedas = getElementData(playerSource, "moneycoins") or 0
    				setElementData(playerSource, "moneycoins", moedas + random)
    				exports._infobox:addNotification(playerSource, "Has intercambiado Medatickets por Medcoins a tu billetera", "success", "tienes mas "..random.." Diamantes en tu cuenta", 8)
    			end
    		else
    			exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5)
    		end
    	elseif itemUsed == "cartao123" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    				acao[playerSource] = setTimer(function() end, 1000, 1)
    				exports._infobox:addNotification(playerSource, "ve a PigPen no le digas a nadie (Corazón en el mapa)", "success", "", 8)
    			end
    		end
    	elseif itemUsed == "vip1" then
    		if getElementData(playerSource, "ouro") == false then
    			if getElementData(playerSource, "platina") == false then
    				if getElementData(playerSource, "diamante") == false then
    					if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    						if not isTimer(acao[playerSource]) then
    							if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    							acao[playerSource] = setTimer(function() end, 1000, 1)
    							GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    							setElementData(playerSource, "ouro", true)
    							exports._infobox:addNotification(playerSource, "VIP", "success", "Eres un nuevo VIP ORO por 30 dias", 5)
    							if GiveAndTakeAndGetItem("get", playerSource, "ouros1") == 0 then
    								exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "ouros1", 1)
    							end
    						end
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5)
    			end
    		end
    	elseif itemUsed == "vip2" then
    		if not getElementData(playerSource, "platina") then
    			if not getElementData(playerSource, "diamante") then
    				if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    					if not isTimer(acao[playerSource]) then
    						if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    						acao[playerSource] = setTimer(function() end, 1000, 1)
    						GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    						setElementData(playerSource, "ouro", false)
    						setElementData(playerSource, "platina", true)
    						exports._infobox:addNotification(playerSource, "VIP", "success", "Eres un nuevo Platinum VIP por 30 días", 5)
    						if GiveAndTakeAndGetItem("get", playerSource, "platinas1" or "ouros1") == 0 then
    							exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "ouros1", 1)
    							exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "platinas1", 1)
    						end
    					end
    				end
    			end
    		else
    			exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5)
    		end
    	elseif itemUsed == "vip3" then
    		if getElementData(playerSource, "diamante") == false then
    			if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    				if not isTimer(acao[playerSource]) then
    					if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    					acao[playerSource] = setTimer(function() end, 1000, 1)
    					GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    					setElementData(playerSource, "ouro", false)
    					setElementData(playerSource, "platina", false)
    					setElementData(playerSource, "diamante", true)
    					exports._infobox:addNotification(playerSource, "VIP", "success", "Eres un nuevo Diamond VIP por 30 días", 5)
    					if GiveAndTakeAndGetItem("get", playerSource, "diamantes1" or "platinas1" or "ouros1") == 0 then
    						exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "ouros1", 1)
    						exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "platinas1", 1)
    						exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "diamantes1", 1)
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "inventario", "error", "No tienes "..realName[itemUsed][1].." en tu inventario", 5)
    			end
    		end
    		------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    elseif itemUsed == "adesivogrunge" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "padrao") -- MP5
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "padrao") -- Five
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "padrao") -- AK
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "padrao") -- M4
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "padrao") -- UZI
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "padrao") -- KARAMBIT
    
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "dangerak" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "danger") -- AK
    			end, 2000, 1)
    		end
    	else
    		exports.a_infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "dangerm4" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports.a_infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "danger") -- M4
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "dangermp5" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "danger") -- MP5
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "dangerfive" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "danger") -- Five
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "dangerkarambit" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "danger") -- KARAMBIT
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "dangeruzi" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "danger") -- UZI
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "ouros1" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "os1") -- MP5
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "os1") -- Five
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "os1") -- AK
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "os1") -- M4
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "os1") -- UZI
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "os1") -- KARAMBIT
    
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "platinas1" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "ps1") -- MP5
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "ps1") -- Five
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "ps1") -- AK
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "ps1") -- M4
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "ps1") -- M4
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "ps1") -- KARAMBIT
    
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    elseif itemUsed == "diamantes1" then
    	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    		if not isTimer(acao[playerSource]) then
    			if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    			triggerClientEvent(playerSource, "progressBar", playerSource, 2000)
    			acao[playerSource] = setTimer(function()
    				exports._infobox:addNotification(playerSource, "La pegatina ha sido aplicada", "info", "has colocado la pegatina al arma!", 5)
    
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 29, "ds1") -- MP5
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 23, "ds1") -- Five
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 30, "ds1") -- AK
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 31, "ds1") -- M4
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 32, "ds1") -- M4
    				exports['paintjob_weapons']:loadWeaponSkin(playerSource, 4, "ds1") -- KARAMBIT
    
    			end, 2000, 1)
    		end
    	else
    		exports._infobox:addNotification(playerSource, "inventario", "error", "No posees "..realName[itemUsed][1].." En tu inventario", 5)
    	end
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    elseif itemUsed == "colete" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if getPedArmor(playerSource) < 100 then
    					acao[playerSource] = setTimer(function() end, 2300, 1)
    					GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          				setPedAnimation(playerSource, "POLICE", "plc_drgbst_01", 2300, false, true, false, false, _, true)
          				setTimer(function()
          					setPedArmor(playerSource, 100)
          				end, 2300, 1)
          			else
          				exports._infobox:addNotification(playerSource, "Ya estas usando un '"..realName[itemUsed][1].."'", "error")
          			end
          		end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "faca" or itemUsed == "picareta" or itemUsed == "cutelo" or itemUsed == "taco" or itemUsed == "cassetete" or itemUsed == "pa" then
        	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
        		if not isTimer(acao[playerSource]) then
        			if not arma[playerSource] then
        				setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true)
        				arma[playerSource] = itemUsed
        				giveWeapon(playerSource, weapons[itemUsed][1], 1, true)
        				PlaySound3D(playerSource, "put", 15)
    					toggleControl(playerSource, "next_weapon", false)
    					toggleControl(playerSource, "previous_weapon", false)
        			else
        				if arma[playerSource] == itemUsed then
        					arma[playerSource] = nil
        					takeWeapon(playerSource, weapons[itemUsed][1])
        					PlaySound3D(playerSource, "put", 15)
    						toggleControl(playerSource, "next_weapon", true)
    						toggleControl(playerSource, "previous_weapon", true)
        				else
        					exports._infobox:addNotification(playerSource, "Ya tienes un arma en las manos", "error")
        				end
        			end
        		end
        	else
        		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
        	end
        elseif itemUsed == "taser" then
        	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
        		if not isTimer(acao[playerSource]) then
        			if not arma[playerSource] then
        				arma[playerSource] = itemUsed
        				giveWeapon(playerSource, weapons[itemUsed][1], 30, true)
        				PlaySound3D(playerSource, "pick", 15)
    					setPedAnimation(playerSource, "BUDDY", "buddy_reload", 1300, false, true, false, false, _, true)
    					toggleControl(playerSource, "next_weapon", false)
    					toggleControl(playerSource, "previous_weapon", false)
        			else
        				if arma[playerSource] == itemUsed then
        					arma[playerSource] = nil
        					takeWeapon(playerSource, weapons[itemUsed][1])
        					PlaySound3D(playerSource, "put", 15)
    						toggleControl(playerSource, "next_weapon", true)
    						toggleControl(playerSource, "previous_weapon", true)
        				else
        					exports._infobox:addNotification(playerSource, "Ya tienes un arma en las manos", "error")
        				end
        			end
        		end
        	else
        		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
        	end
        elseif itemUsed == "glock" or itemUsed == "deagle" or itemUsed == "escopeta" or itemUsed == "tec9" or itemUsed == "mp5" or itemUsed == "ak47" or itemUsed == "m4a1" or itemUsed == "awm" then
        	if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
        		if not isTimer(acao[playerSource]) then
        			if not arma[playerSource] then
        				local ammo = GiveAndTakeAndGetItem("get", playerSource, weapons[itemUsed][2]) or 0
        				if ammo > 0 then
        					giveWeapon(playerSource, weapons[itemUsed][1], ammo + 1, true)
        					GiveAndTakeAndGetItem("take", playerSource, weapons[itemUsed][2], "all")
        				else
        					giveWeapon(playerSource, weapons[itemUsed][1], 1, true)
        				end
        				setControlState(playerSource, "fire", false)
        				setControlState(playerSource, "action", false)
        				PlaySound3D(playerSource, "pick", 15)
        				arma[playerSource] = itemUsed
    					setPedAnimation(playerSource, "BUDDY", "buddy_reload", 1300, false, true, false, false, _, true)
    					toggleControl(playerSource, "next_weapon", false)
    					toggleControl(playerSource, "previous_weapon", false)
        			else
        				if arma[playerSource] == itemUsed then
        					local ammo = getPedTotalAmmo(playerSource, weapons[itemUsed][3]) or 0
        					if ammo > 1 then
        						GiveAndTakeAndGetItem("give", playerSource, weapons[itemUsed][2], ammo - 1)
        					end
        					PlaySound3D(playerSource, "put", 15)
        					takeWeapon(playerSource, weapons[itemUsed][1])
        					arma[playerSource] = nil
    						toggleControl(playerSource, "next_weapon", true)
    						toggleControl(playerSource, "previous_weapon", true)
        				else
        					exports._infobox:addNotification(playerSource, "Ya tienes un arma en las manos", "error")
        				end
        			end
        		end
        	else
        		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
        	end
    	elseif itemUsed == "kit_reparo" or itemUsed == "gasolina" or itemUsed == "pneu" or itemUsed == "lockpick" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' hacia un vehiculo proximo para usarlo.", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "algema" or itemUsed == "kitmedico" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' en un jugador próximo para usarlo.", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "chaves" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Clic y arrastralo a '"..realName[itemUsed][1].."' una puerta o portón proximo para abrirlo.", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "drill" or itemUsed == "dinamite" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' en una puerta proxima para usarlo.", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "llavesauto" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Clic y arrastralo a '"..realName[itemUsed][1].."' a tu vehiculo para abrirlo.", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "pendrive" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Clic y arrastralo '"..realName[itemUsed][1].."' en un panel de control proximo para usarlo.", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "celular" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			exports._infobox:addNotification(playerSource, "Presione la tecla 'F1' Para usar '"..realName[itemUsed][1].."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "dado" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local random = math.random(1, 4)
    			if random ~= 2 then
    				local random2 = math.random(1, 6)
    				for i, v in pairs(getElementsByType("player")) do
    					local x1, y1, z1 = getElementPosition(playerSource)
    					local x2, y2, z2 = getElementPosition(v)
    					if getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) <= 10 then
    						outputChatBox("[DADO]:#FFFFFF "..random2, v, 30, 144, 255, true)
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Los dados cayeron lejos y usted los perdió", "error")
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    			end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "radinho" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				PlaySound3D(playerSource, "radio-toggle", 15)
    				if not getElementData(playerSource, "Radinho") then
    					setElementData(playerSource, "Radinho", true)
    				else
    					setElementData(playerSource, "Radinho", false)
    				end
    			end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "presente" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    				local random = math.random(1, 6)
    				for i, v in ipairs(tablePresente) do
    					if i == random then
    						if tablePresente[i][1] ~= 5000 and tablePresente[i][1] ~= 20000 then
    							GiveAndTakeAndGetItem("give", playerSource, tablePresente[i][1], 1)
    							exports._infobox:addNotification(playerSource, "Abriste un regalo VIP y ganaste un '"..realName[tablePresente[i][1]][1].."'", "success")
    						else
    							givePlayerMoney(playerSource, tablePresente[i][1])
    							exports._infobox:addNotification(playerSource, "Abriste un regalo VIP y ganaste $"..tablePresente[i][1], "money")
    						end
    					end
    				end
    			end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "capacete" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 800, 1)
    				if isElement(capacete[playerSource]) then
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
                			destroyElement(capacete[playerSource])
                			capacete[playerSource] = nil
                			setElementData(playerSource, "Capacete", false)
            			end, 800, 1)
            		else
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				capacete[playerSource] = createObject(1937, x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(capacete[playerSource], int)
                			setElementDimension(capacete[playerSource], dim)
                			setElementData(playerSource, "Capacete", true)
                			exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 1, 0, 0.026, 0, 0, 270, 0)
            			end, 800, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
         elseif itemUsed == "mochila1" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 800, 1)
    				if isElement(capacete[playerSource]) then
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
                			destroyElement(capacete[playerSource])
                			capacete[playerSource] = nil
                			setElementData(playerSource, "Capacete", false)
            			end, 800, 1)
            		else
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				capacete[playerSource] = createObject(1945, x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(capacete[playerSource], int)
                			setElementDimension(capacete[playerSource], dim)
                			setElementData(playerSource, "Capacete", true)
                			exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 3, 0, -0.17, 0.07, 0, 0, 0)
            			end, 800, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end	
          elseif itemUsed == "mochila2" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 800, 1)
    				if isElement(capacete[playerSource]) then
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
                			destroyElement(capacete[playerSource])
                			capacete[playerSource] = nil
                			setElementData(playerSource, "mochila", false)
            			end, 800, 1)
            		else
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				capacete[playerSource] = createObject(1948, x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(capacete[playerSource], int)
                			setElementDimension(capacete[playerSource], dim)
                			setElementData(playerSource, "mochila", true)
                			exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 3, 0, -0.005, -0.18, 0, 0, 90)
            			end, 800, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
          elseif itemUsed == "mochila3" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 800, 1)
    				if isElement(capacete[playerSource]) then
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
                			destroyElement(capacete[playerSource])
                			capacete[playerSource] = nil
                			setElementData(playerSource, "mochila", false)
            			end, 800, 1)
            		else
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				capacete[playerSource] = createObject(1949, x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(capacete[playerSource], int)
                			setElementDimension(capacete[playerSource], dim)
                			setElementData(playerSource, "mochila", true)
                			exports.bone_attach:attachElementToBone(capacete[playerSource], playerSource, 3, 0, -0.17, 0.07, 0, 0, 0)
            			end, 800, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end					
    	elseif itemUsed == "porco" or itemUsed == "criatura" or itemUsed == "capeta" or itemUsed == "caveira" or itemUsed == "macaco" or itemUsed == "cavalo" or itemUsed == "touro" or itemUsed == "sacola" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 800, 1)
    				if isElement(mascara[playerSource]) then
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
                			destroyElement(mascara[playerSource])
                			mascara[playerSource] = nil
            			end, 800, 1)
            		else
            			setPedAnimation(playerSource, "goggles", "goggles_put_on", 800, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				mascara[playerSource] = createObject(masks[itemUsed][1], x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(mascara[playerSource], int)
                			setElementDimension(mascara[playerSource], dim)
                			exports.bone_attach:attachElementToBone(mascara[playerSource], playerSource, 1, -0.003, 0, -0.6, 0, 0, 90)
            			end, 800, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    
    	elseif itemUsed == "som" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(som[playerSource]) then
                		destroyElement(som[playerSource])
                		som[playerSource] = nil
            		else
            			setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				som[playerSource] = createObject(2226, x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(som[playerSource], int)
                			setElementDimension(som[playerSource], dim)
                			exports.bone_attach:attachElementToBone(som[playerSource], playerSource, 11, 0, 0, 0.4, 180, 0, 180)
                		end, 500, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "maleta" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(maleta[playerSource]) then
                		destroyElement(maleta[playerSource])
                		maleta[playerSource] = nil
            		else
            			setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				maleta[playerSource] = createObject(1210, x, y, z)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			setElementInterior(maleta[playerSource], int)
                			setElementDimension(maleta[playerSource], dim)
                			exports.bone_attach:attachElementToBone(maleta[playerSource], playerSource, 11, -3.4694469519536e-18, 0.095, 0.3, -6, -184, 0)
                		end, 500, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    	elseif itemUsed == "flor" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				if isElement(flor[playerSource]) then
                		destroyElement(flor[playerSource])
                		flor[playerSource] = nil
            		else
            			setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true)
            			setTimer(function()
            				local x, y, z = getElementPosition(playerSource)
            				local dim = getElementDimension(playerSource)
            				local int = getElementInterior(playerSource)
                			flor[playerSource] = createObject(325, x, y, z)
                			setElementInterior(flor[playerSource], int)
                			setElementDimension(flor[playerSource], dim)
                			exports.bone_attach:attachElementToBone(flor[playerSource], playerSource, 12, 0, 0, 0, 0, 270, 0)
                		end, 500, 1)
            		end
            	end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "bandagem" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 5000, 1)
    				GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
          			setPedAnimation(playerSource, "BOMBER", "BOM_Plant_Loop", 5000, true, false, false, false, _, true)
                	setTimer(function()
                		local health = getElementHealth(playerSource)
                		setElementHealth(playerSource, health + 20)
                		setPedAnimation(playerSource, nil)
                	end, 5000, 1)
    			end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "cigarro" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			if GiveAndTakeAndGetItem("get", playerSource, "isqueiro") >= 1 then
    				if not isTimer(acao[playerSource]) then
    					if not isElement(cigarro[playerSource]) then
    						local x, y, z = getElementPosition(playerSource)
    						local int = getElementInterior(playerSource)
    						local dim = getElementDimension(playerSource)
    						cigarro[playerSource] = createObject(1485, x, y, z)
    						setElementInterior(cigarro[playerSource], int)
    						setElementDimension(cigarro[playerSource], dim)
    						acao[playerSource] = setTimer(function() end, 7000, 1)
    						GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    						setPedAnimation(playerSource, "GANGS", "smkcig_prtl", 7000, false, true, false, false, _, true)
    						exports.bone_attach:attachElementToBone(cigarro[playerSource], playerSource, 12, -0.03, 0.06, 0.04, 30, -50, -24)
    						local random = math.random(1, 10)
    						if random == 1 then
    							GiveAndTakeAndGetItem("take", playerSource, "isqueiro", 1)
    						end
    						setTimer(function()
    							exports._infobox:addNotification(playerSource, "Presione 'X' para fumar", "info")
    							bindKey(playerSource, "x", "down", fumarCigarro)
    							setTimer(function()
    								destroyElement(cigarro[playerSource])
    								cigarro[playerSource] = nil
    								unbindKey(playerSource, "x", "down", fumarCigarro)
    							end, 60000*3, 1)
    						end, 7000, 1)
    					else
    						exports._infobox:addNotification(playerSource, "Ya estas fumando un cigarro", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "No posees 'Mechero' en tu inventario", "error")
    			end
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "adrenalina" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			GiveAndTakeAndGetItem("take", playerSource, itemUsed, 1)
    			setPedAnimation(playerSource, "BOMBER", "BOM_Plant_Loop", 10000, true, false, false, false, _, true)
    			setTimer(function()
    				if isTimer(acao[playerSource]) then killTimer(acao[playerSource]) end
    				setElementFrozen(playerSource, false)
    				setElementHealth(playerSource, 100)
    				setPedArmor(playerSource, 100)
    				setPedAnimation(playerSource, nil)
    				toggleAllControls(playerSource, true)
    				if getElementData(playerSource, "Desmaiado") then
    					triggerEvent("Desmaiado", root, playerSource, false)
    				end
    				local name = getPlayerName(playerSource)
    				local ID1 = getElementData(playerSource, "ID") or "N/A"
    				exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..ID1.."]\nAcción: Usó el item 'Inyección de Adrenalina'")
    				for _, players in pairs(getElementsByType("player")) do
    					if players ~= playerSource then
    						local x, y, z = getElementPosition(playerSource)
    						local x2, y2, z2 = getElementPosition(players)
    						if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							outputChatBox("[INFO]:#FFFFFF El jugador "..name.."#FFFFFF ("..id..") usó una '"..realName[itemUsed][1].."'", players, 30, 144, 255, true)
    						end
    					end
    				end
    			end, 10000, 1)
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "identidade" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			exports._infobox:addNotification(playerSource, "[IDENTIDAD]  •  Nombre: '"..name.."', Nº: '"..id.."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "cnha" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			local categoria = getElementData(playerSource, "CNHA") or "A"
    			exports._infobox:addNotification(playerSource, "[LICENCIA]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "cnhb" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			local categoria = getElementData(playerSource, "CNHB") or "B"
    			exports._infobox:addNotification(playerSource, "[LICENCIA]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "cnhc" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			local categoria = getElementData(playerSource, "CNHC") or "C"
    			exports._infobox:addNotification(playerSource, "[LICENCIA]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "cnhd" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			local categoria = getElementData(playerSource, "CNHD") or "D"
    			exports._infobox:addNotification(playerSource, "[LICENCIA]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "cnhaero" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			local categoria = getElementData(playerSource, "CNHE") or "E"
    			exports._infobox:addNotification(playerSource, "[LICENCIA]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
        elseif itemUsed == "porte" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			exports._infobox:addNotification(playerSource, "[PORTE DE ARMA]  •  Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
          	end
    		elseif itemUsed == "distintivo" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    			local name = getPlayerName(playerSource)
    			local id = getElementData(playerSource, "ID") or "N/A"
    			exports._infobox:addNotification(playerSource, "[Placa Policial]  •  Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info")
          	else
          		exports._infobox:addNotification(playerSource, "No posees '"..realName[itemUsed][1].."' en tu inventario", "error")
    				end
    		end
    end
    addEvent("Use", true)
    addEventHandler("Use", resourceRoot, use)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function trade(tipo, arg2, arg3, arg4)
    	if tipo == "make" then --tipo, source, player, tabela
    		setElementData(arg3, "Trading", arg4)
    		exports._infobox:addNotification(arg3, "Recibiste una propuesta de venta, abre el inventario para Aceptar o Rechazar", "info")
    		triggerClientEvent(arg3, "refreshTrading", resourceRoot)
    	elseif tipo == "accept" then --tipo, source, tabela
    		removeElementData(arg2, "Trading")
    		if GiveAndTakeAndGetItem("get", arg3[1][1], arg3[2][1]) >= arg3[3][1] then
    			if arg3[4][1] > 0 then
    				if getPlayerMoney(arg2) >= arg3[4][1] then
    					if GiveAndTakeAndGetItem("give", arg2, arg3[2][1], arg3[3][1]) then
    						if GiveAndTakeAndGetItem("take", arg3[1][1], arg3[2][1], arg3[3][1]) then
    							takePlayerMoney(arg2, arg3[4][1])
    							givePlayerMoney(arg3[1][1], arg3[4][1])
    							exports._infobox:addNotification(arg2, "Aceptaste el comercio y pagaste $"..arg3[4][1], "money")
    							exports._infobox:addNotification(arg3[1][1], "El jugador aceptó comerciar contigo e Recibiste $"..arg3[4][1], "money")
    							local name = getPlayerName(arg2)
    							local ID1 = getElementData(arg2, "ID") or "N/A"
    							local name2 = getPlayerName(arg3[1][1])
    							local ID2 = getElementData(arg3[1][1], "ID") or "N/A"
    							exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nVendedor: "..name2.." ["..ID2.."]\nComprador: "..name.." ["..ID1.."]\nItem: "..arg3[2][1].."\nCantidad: "..arg3[3][1].."\nValor: $"..arg3[4][1])
    						else
    							exports._infobox:addNotification(arg2, "El jugador no posee el item en su mochila", "error")
    							exports._infobox:addNotification(arg3[1][1], "No tienes el item en tu mochila", "error")
    						end
    					else
    						exports._infobox:addNotification(arg2, "No tienes espacio en la mochila", "error")
    						exports._infobox:addNotification(arg3[1][1], "El comprador no tiene espacio en la mochila", "error")
    					end
    				else
    					exports._infobox:addNotification(arg2, "No tienes dinero suficiente", "error")
    					exports._infobox:addNotification(arg3[1][1], "El comprador no tiene dinero suficiente", "error")
    				end
    			else
    				if GiveAndTakeAndGetItem("give", arg2, arg3[2][1], arg3[3][1]) then
    					if GiveAndTakeAndGetItem("take", arg3[1][1], arg3[2][1], arg3[3][1]) then
    						exports._infobox:addNotification(arg2, "Aceptaste comerciar con el jugador", "success")
    						exports._infobox:addNotification(arg3[1][1], "El jugador aceptó comerciar contigo", "success")
    						local name = getPlayerName(arg2)
    						local ID1 = getElementData(arg2, "ID") or "N/A"
    						local name2 = getPlayerName(arg3[1][1])
    						local ID2 = getElementData(arg3[1][1], "ID") or "N/A"
    						exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nVendedor: "..name2.." ["..ID2.."]\nComprador: "..name.." ["..ID1.."]\nItem: "..arg3[2][1].."\nCantidad: "..arg3[3][1].."\nValor: $0")
    					else
    						exports._infobox:addNotification(arg2, "El jugador no posee el item en su mochila", "error")
    						exports._infobox:addNotification(arg3[1][1], "No tienes el item en tu mochila", "error")
    					end
    				else
    					exports._infobox:addNotification(arg2, "No tienes espacio en la mochila", "error")
    					exports._infobox:addNotification(arg3[1][1], "El comprador no tiene espacio en la mochila", "error")
    				end
    			end
    		else
    			exports._infobox:addNotification(arg2, "El jugador no posee el item en su mochila", "error")
    			exports._infobox:addNotification(arg3[1][1], "No tienes el item en tu mochila", "error")
    		end
    	elseif tipo == "decline" then --tipo, source, tabela
    		removeElementData(arg2, "Trading")
    		exports._infobox:addNotification(arg2, "Rechazaste comerciar con el jugador", "success")
    		exports._infobox:addNotification(arg3[1][1], "El comprador rechazó comerciar contigo", "error")
    	elseif tipo == "distance" then --tipo, source, tabela
    		removeElementData(arg2, "Trading")
    		exports._infobox:addNotification(arg2, "No se puede aceptar comerciar por que estas lejos del vendedor", "error")
    		exports._infobox:addNotification(arg3[1][1], "No se puede aceptar comerciar por que estas lejos del comprador", "error")
    	end
    end
    addEvent("Trade", true)
    addEventHandler("Trade", resourceRoot, trade)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function action(playerSource, clickedWorld, itemActioned)
    	if itemActioned == "chaves" and getElementType(clickedWorld) == "object" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isTimer(acao[playerSource]) then
    				local x, y, z = getElementPosition(playerSource)
    				local ex, ey, ez = getElementPosition(clickedWorld)
    				if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then
    					for i, v in pairs(gates) do
    						if v == clickedWorld then
    							if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(GatePositions[i][1])) then
    								if GatePositions[i][10] == "closed" then
    									moveObject(clickedWorld, GatePositions[i][9], GatePositions[i][6], GatePositions[i][7], GatePositions[i][8])
    									GatePositions[i][10] = "opened"
    									tempo[clickedWorld] = setTimer(function()
    										moveObject(clickedWorld, GatePositions[i][9], GatePositions[i][3], GatePositions[i][4], GatePositions[i][5])
    										GatePositions[i][10] = "closed"
    									end, 10000, 1)
    								elseif GatePositions[i][10] == "opened" then
    									moveObject(clickedWorld, GatePositions[i][9], GatePositions[i][3], GatePositions[i][4], GatePositions[i][5])
    									GatePositions[i][10] = "closed"
    									if isTimer(tempo[clickedWorld]) then
    										killTimer(tempo[clickedWorld])
    									end
    								end
    							else
    								exports._infobox:addNotification(playerSource, "No tienes llaves de ese portón (No tienes permisos)", "error")
    							end
    						end
    					end
    				else
    					exports._infobox:addNotification(playerSource, "Estas muy lejos del protón", "error")
    				end
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "kit_reparo" and getElementType(clickedWorld) == "vehicle" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 3 then
    						local counter = 0
    						for seat, player in pairs(getVehicleOccupants(clickedWorld)) do
        						counter = counter + 1
    						end
    						if counter < 1 then
    							if not getElementData(clickedWorld, "Engine") then
    								if getElementHealth(clickedWorld) < 1000 then
    									if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Mecanico")) then
    										acao[playerSource] = setTimer(function() end, 14000, 1)
    										if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    										local x, y, z = getElementPosition(playerSource)
    										item[playerSource] = createObject(1938, x, y, z - 0.65, 0, 90, 0)
    										setElementCollisionsEnabled(item[playerSource], false)
    										PlaySound3D(playerSource, "repair", "all")
    										GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    										triggerClientEvent(playerSource, "progressBar", playerSource, 14000)
    										setElementFrozen(playerSource, true)
    										setElementFrozen(clickedWorld, true)
    										local _, _, rot = getElementRotation(playerSource)
    										setElementRotation(playerSource, _, _, rot + 180)
    										setPedAnimation(playerSource, "CAR", "fixn_car_loop", 14000, true, false, false, false, _, true)
    										setTimer(function()
    											destroyElement(item[playerSource])
    											item[playerSource] = nil
    											fixVehicle(clickedWorld)
    											setVehicleDamageProof(clickedWorld, false)
    											setElementFrozen(clickedWorld, false)
    											setElementFrozen(playerSource, false)
    											local exp = math.random(expRepair1, expRepair2)
    											if getElementData(playerSource, "VIP") then
    												local xp = (exp + (exp/4))
    												triggerEvent("GiveExp", playerSource, playerSource, xp)
    											else
    												triggerEvent("GiveExp", playerSource, playerSource, exp)
    											end
    											exports._infobox:addNotification(playerSource, "Reparaste el Automovil ", "success")
    										end, 14000, 1)
    									end
    								else
    									exports._infobox:addNotification(playerSource, "El vehiculo no tiene ningun daño para ser reparado", "error")
    								end
    							else
    								exports._infobox:addNotification(playerSource, "El vehiculo necesita estar apagado para ser reparado", "error")
    							end
    						else
    							exports._infobox:addNotification(playerSource, "No debe haber nadie en el vehiculo para poder ser reparado", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    --------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------
    		elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    			local veiculo = getElementData(playerSource, "Vehicle:Owner")
    			if veiculo then 
    			if getElementData(veiculo, "Player:Owner") == source then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then
    						if not getElementData(clickedWorld, "engine") then
    					local trancar = getElementData(clickedWorld, "Vehicle:Owner")
    					outputChatBox(" ", source)
    					outputChatBox("• Veículo destrancado", source)
    					for i, players in ipairs(getElementsByType("player")) do
    						local x, y, z = getElementPosition(playerSource)
    						local ex, ey, ez = getElementPosition(clickedWorld)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then
    							triggerClientEvent(players, "lockBikeSound", players, veiculo)
    							setVehicleOverrideLights(veiculo, 2)
    							setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1)
    						end
    					end
    					end
    					end
    				else
    					setElementData(veiculo, "Locked", true)
    					outputChatBox(" ", source)
    					outputChatBox("• Veículo trancado", source)
    					for i, players in ipairs(getElementsByType("player")) do
    						local x, y, z = getElementPosition(players)
    						local ex, ey, ez = getElementPosition(veiculo)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then
    							triggerClientEvent(players, "lockBikeSound", players, veiculo)
    							setTimer(triggerClientEvent, 600, 1, players, "lockBikeSound", players, veiculo)
    							setVehicleOverrideLights(veiculo, 2)
    							setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1)
    							setTimer(setVehicleOverrideLights, 600, 1, veiculo, 2)
    							setTimer(setVehicleOverrideLights, 900, 1, veiculo, 1)
    						end
    					end
    				end
    			else
    				exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error")
    			end
    		else
    			exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error")
    		end
    	end
    end
    --------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------
    	elseif itemActioned == "pneu" and getElementType(clickedWorld) == "vehicle" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 3 then
    						local counter = 0
    						for seat, player in pairs(getVehicleOccupants(clickedWorld)) do
        						counter = counter + 1
    						end
    						if counter < 1 then
    							if not getElementData(clickedWorld, "Engine") then
    								local r1, r2, r3, r4 = getVehicleWheelStates(clickedWorld)
    								if r1 ~= 0 or r2 ~= 0 or r3 ~= 0 or r4 ~= 0 then
    									if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Mecanico")) then
    										acao[playerSource] = setTimer(function() end, 14000, 1)
    										if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    										local x, y, z = getElementPosition(playerSource)
    										item[playerSource] = createObject(1025, x, y, z - 0.85, 0, 90, 0)
    										setObjectScale(item[playerSource], 0.8)
    										setElementCollisionsEnabled(item[playerSource], false)
    										PlaySound3D(playerSource, "repair", 100)
    										GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    										triggerClientEvent(playerSource, "progressBar", playerSource, 14000)
    										setElementFrozen(playerSource, true)
    										setElementFrozen(clickedWorld, true)
    										local _, _, rot = getElementRotation(playerSource)
    										setElementRotation(playerSource, _, _, rot + 180)
    										setPedAnimation(playerSource, "CAR", "fixn_car_loop", 14000, true, false, false, false, _, true)
    										setTimer(function()
    											destroyElement(item[playerSource])
    											item[playerSource] = nil
    											setVehicleWheelStates(clickedWorld, 0, 0, 0, 0)
    											setElementFrozen(clickedWorld, false)
    											setElementFrozen(playerSource, false)
    											local exp = math.random(expPneu1, expPneu2)
    											if getElementData(playerSource, "VIP") then
    												local xp = (exp + (exp/4))
    												triggerEvent("GiveExp", playerSource, playerSource, xp)
    											else
    												triggerEvent("GiveExp", playerSource, playerSource, exp)
    											end
    											exports._infobox:addNotification(playerSource, "Cambiaste las llantas del vehiculo", "success")
    										end, 14000, 1)
    									end
    								else
    									exports._infobox:addNotification(playerSource, "El vehiculo no presenta ninguna llanta desinflada", "error")
    								end
    							else
    								exports._infobox:addNotification(playerSource, "El vehiculo necesita estar apagado para poder cambiar la llanta", "error")
    							end
    						else
    							exports._infobox:addNotification(playerSource, "El vehiculo necesita estar vacio para poder cambiar la llanta", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "gasolina" and getElementType(clickedWorld) == "vehicle" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 3 then
    						local counter = 0
    						for seat, player in pairs(getVehicleOccupants(clickedWorld)) do
        						counter = counter + 1
    						end
    						if counter < 1 then
    							if not getElementData(clickedWorld, "Engine") then
    								local gas = getElementData(clickedWorld, "Gasolina") or 0
    								if gas < 100 then
    									acao[playerSource] = setTimer(function() end, 15000, 1)
    									if isElement(item[playerSource]) then destroyElement(item[playerSource]) item[playerSource] = nil end
    									local x, y, z = getElementPosition(playerSource)
    									item[playerSource] = createObject(1650, x, y, z)
    									GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    									triggerClientEvent(playerSource, "progressBar", playerSource, 15000)
    									setElementFrozen(playerSource, true)
    									setElementFrozen(clickedWorld, true)
    									setPedAnimation(playerSource, "CASINO", "Slot_Plyr", -1, true, false, false, false)
    									setTimer(setPedAnimationSpeed, 700, 1, playerSource, "Slot_Plyr", 0)
    									exports.bone_attach:attachElementToBone(item[playerSource], playerSource, 12, -0.01, 0.15, 0.05, -48, 62, 140)
    									setTimer(function()
    										setPedAnimation(playerSource, nil)
    										destroyElement(item[playerSource])
    										item[playerSource] = nil
    										setElementData(clickedWorld, "Gasolina", 100)
    										setElementFrozen(clickedWorld, false)
    										setElementFrozen(playerSource, false)
    										exports._infobox:addNotification(playerSource, "Llenaste el tanque del vehiculo", "success")
    									end, 15000, 1)
    								else
    									exports._infobox:addNotification(playerSource, "El vehiculo ya tiene el tanque lleno", "error")
    								end
    							else
    								exports._infobox:addNotification(playerSource, "El vehiculo requiere estar apagado para poder llenarlo", "error")
    							end
    						else
    							exports._infobox:addNotification(playerSource, "El vehiculo requiere estar sin pasajeros para poder llenarlo", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "algema" and getElementType(clickedWorld) == "player" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(ACL_PM)) then
    							if not algemado[clickedWorld] then
    								if isElement(item[clickedWorld]) then destroyElement(item[clickedWorld]) item[clickedWorld] = nil end
    								local x, y, z = getElementPosition(clickedWorld)
    								item[clickedWorld] = createObject(331, x, y, z)
    								setObjectScale(item[clickedWorld], 1.2)
    								acao[clickedWorld] = setTimer(function() end, 60000*30, 1)
    								GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    								GiveAndTakeAndGetItem("give", playerSource, "chaves", 1)
    								setPedAnimation(playerSource, "CASINO", "dealone", 1000, true, false, false, false, _, true)
    								setPedAnimation(clickedWorld, "GANGS","prtial_gngtlkA", 1, false, false, false, true, _, true)
    								setTimer(function()
    									setPedAnimationSpeed(clickedWorld, "prtial_gngtlkA", 0)
    									setTimer(function()
    										setPedAnimationProgress(clickedWorld, "prtial_gngtlkA", 0.2)
    									end, 500, 1)
    								end, 800, 1)
    								toggleControl(clickedWorld, "sprint", false)
    								toggleControl(clickedWorld, "walk", false)
    								toggleControl(clickedWorld, "jump", false)
    								toggleControl(clickedWorld, "fire", false)
    								toggleControl(clickedWorld, "action", false)
    								toggleControl(clickedWorld, "crouch", false)
    								toggleControl(clickedWorld, "aim_weapon", false)
    								toggleControl(clickedWorld, "enter_exit", false)
    								setControlState(clickedWorld, "walk", true)
    								algemado[clickedWorld] = playerSource
    								algemando[playerSource] = clickedWorld
    								exports._infobox:addNotification(playerSource, "Esposaste a un supuesto criminal. Usa tus llaves para soltarlo nuevamente", "success")
    								exports._infobox:addNotification(clickedWorld, "Você foi algemado pelo policial "..getPlayerName(playerSource), "warning")
    								exports.bone_attach:attachElementToBone(item[clickedWorld], clickedWorld, 12, 0.09, 0.03, 0.14, -30, 126, -86)
    								timerAlgema[clickedWorld] = setTimer(function()
    									setPedAnimation(clickedWorld, "GANGS","prtial_gngtlkA", 1, false, false, false, true, _, true)
    									setPedAnimationSpeed(clickedWorld, "prtial_gngtlkA", 0)
    									setPedAnimationProgress(clickedWorld, "prtial_gngtlkA", 0.2)
    								end, 500, 0)
    							else
    								exports._infobox:addNotification(playerSource, "Si objetivo ya esta esposado", "error")
    							end
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos de tu objetivo", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar a '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "chaves" and getElementType(clickedWorld) == "player" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						if algemado[clickedWorld] then
    							if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(ACL_PM)) then
    								if isElement(item[clickedWorld]) then destroyElement(item[clickedWorld]) item[clickedWorld] = nil end
    								if isTimer(acao[clickedWorld]) then killTimer(acao[clickedWorld]) end
    								if isTimer(timerAlgema[clickedWorld]) then killTimer(timerAlgema[clickedWorld]) timerAlgema[clickedWorld] = nil end
    								GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    								GiveAndTakeAndGetItem("give", playerSource, "algema", 1)
    								setPedAnimation(clickedWorld, "CASINO", "dealone", -1, false)
    								setTimer(setPedAnimation, 50, 1, clickedWorld, nil)
    								toggleAllControls(clickedWorld, true)
    								setControlState(clickedWorld, "walk", false)
    								exports._infobox:addNotification(playerSource, "Le quitaste las esposas a el criminal", "success")
    								exports._infobox:addNotification(clickedWorld, "El policia "..getPlayerName(playerSource).."#FFFFFF te quitó las esposas", "info")
    								local pm = algemado[clickedWorld]
    								algemando[pm] = nil
    								algemado[clickedWorld] = nil
    							end
    						end
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar as '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "kitmedico" and getElementType(clickedWorld) == "player" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) and not isPedInVehicle(clickedWorld) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						if getElementData(clickedWorld, "Desmaiado") then
    							if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Medico")) then
    								acao[playerSource] = setTimer(function() end, 20000, 1)
    								setElementFrozen(playerSource, true)
    								GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    								setPedAnimation(playerSource, "MEDIC", "CPR", 20000, true, false, false, false, _, true)
    								triggerClientEvent(playerSource, "progressBar", playerSource, 20000)
    								setTimer(function()
    									triggerEvent("Desmaiado", root, clickedWorld, false)
    									setElementFrozen(playerSource, false)
    									if isTimer(acao[clickedWorld]) then killTimer(acao[clickedWorld]) end
    									exports._infobox:addNotification(playerSource, "Has reanimado a un Ciudadano "..getPlayerName(clickedWorld), "success")
    									exports._infobox:addNotification(clickedWorld, "Fuiste reanimado (RSP) por un paramedico", "info")
    									local name = getPlayerName(playerSource)
    									local ID1 = getElementData(playerSource, "ID") or "N/A"
    									local name2 = getPlayerName(clickedWorld)
    									local ID2 = getElementData(clickedWorld, "ID") or "N/A"
    									exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nEMERGENCIAS: "..name.." ["..ID1.."]\nPaciente: "..name2.." ["..ID2.."]")
    									if curado[playerSource] ~= clickedWorld then
    										local money = math.random(moneySamu1, moneySamu2)
    										givePlayerMoney(playerSource, money)
    										exports._infobox:addNotification(playerSource, "Recibiste "..money.." pesos", "money")
    										local exp = math.random(expSamu1, expSamu2)
    										if getElementData(playerSource, "VIP") then
    											local xp = (exp + (exp/4))
    											triggerEvent("GiveExp", playerSource, playerSource, xp)
    										else
    											triggerEvent("GiveExp", playerSource, playerSource, exp)
    										end
    									end
    									curado[playerSource] = clickedWorld
    								end, 20000, 1)
    							end
    						else
    							exports._infobox:addNotification(playerSource, "Este ciudadano no requiere ser auxiliado", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos del ciudadano indicado", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "lockpick" and getElementType(clickedWorld) == "vehicle" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 2.5 then
    						local counter = 0
    						for seat, player in pairs(getVehicleOccupants(clickedWorld)) do
        						counter = counter + 1
    						end
    						if counter < 1 then
    							if getElementData(clickedWorld, "Locked") then
    								acao[playerSource] = setTimer(function() end, 90000, 1)
    								GiveAndTakeAndGetItem("take", playerSource, itemActioned, 1)
    								PlaySound3D(playerSource, "vehicle-alarm", "all")
    								setElementFrozen(playerSource, true)
    								setElementFrozen(clickedWorld, true)
    								setPedAnimation(playerSource, "CAMERA", "piccrch_take", 90000, true, false, false, false, _, true)
    								triggerClientEvent(playerSource, "progressBar", playerSource, 90000)
    								blip[clickedWorld] = createBlipAttachedTo(clickedWorld, 36)
    								setElementVisibleTo(blip[clickedWorld], root, false)
    								for _, players in pairs(getElementsByType("player")) do
    									if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup(ACL_PM)) then
    										exports._infobox:addNotification(players, "[ESTACIÓN]: Reporte de robo de vehículo en curso, el lugar de ocurrencia fue indicado en su GPS", "warning")
    										setElementVisibleTo(blip[clickedWorld], players, true)
    									end
    								end
    								setTimer(function()
    									setPedAnimation(playerSource, nil)
    									setElementFrozen(playerSource, false)
    									setElementFrozen(clickedWorld, false)
    									destroyElement(blip[clickedWorld])
    									blip[clickedWorld] = nil
    									local random = math.random(1, 2)
    									if random == 1 then
    										setElementData(clickedWorld, "Locked", false)
    										setVehicleLocked(clickedWorld, false)
    										exports._infobox:addNotification(playerSource, "¿Conseguiste forzar el vehículo", "success")
    										local name = getPlayerName(playerSource)
    										local ID1 = getElementData(playerSource, "ID") or "N/A"
    										local model = getElementModel(clickedWorld)
    										exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nCriminal: "..name.." ["..ID1.."]\nVehiculo: "..model)
    									else
    										exports._infobox:addNotification(playerSource, "No conseguiste forzar el vehiculo", "error")
    									end
    								end, 90000, 1)
    							else
    								exports._infobox:addNotification(playerSource, "Este vehiculo ya esta desbloqueado", "error")
    							end
    						else
    							exports._infobox:addNotification(playerSource, "El vehiculo requiere estar vacio para poder ser forzado", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "Estas muy lejos del vehiculo", "error")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "porte" and getElementType(clickedWorld) == "player" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						local name = getPlayerName(playerSource)
    						local id = getElementData(playerSource, "ID") or "N/A"
    						exports._infobox:addNotification(clickedWorld, "[PORTE DE ARMA]  •  Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info")
    						exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "cnha" and getElementType(clickedWorld) == "player" then
    			if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    				if not isPedInVehicle(playerSource) then
    					if not isTimer(acao[playerSource]) then
    						local x, y, z = getElementPosition(playerSource)
    						local ex, ey, ez = getElementPosition(clickedWorld)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    							if getElementData(playerSource, "license:moto") then
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							local categoria = getElementData(playerSource, "CNHA") or "A"
    						exports._infobox:addNotification(clickedWorld, "[Licencia]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
    						exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end
    			end	
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    		elseif itemActioned == "cnhb" and getElementType(clickedWorld) == "player" then
    			if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    				if not isPedInVehicle(playerSource) then
    					if not isTimer(acao[playerSource]) then
    						local x, y, z = getElementPosition(playerSource)
    						local ex, ey, ez = getElementPosition(clickedWorld)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    							if getElementData(playerSource, "license:auto") then
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							local categoria = getElementData(playerSource, "CNHB") or "B"
    							exports._infobox:addNotification(clickedWorld, "[Licencia]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
    							exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end
    			end	
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    		elseif itemUsed == "cnhc" and getElementType(clickedWorld) == "player" then
    			if not clickedWorld then exports._infobox:addNotification(playerSource, "inventario", "error", "Não tem niguem priximo a você", 5) return end
    			if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    				if not isPedInVehicle(playerSource) then
    					if not isTimer(acao[playerSource]) then
    						local x, y, z = getElementPosition(playerSource)
    						local ex, ey, ez = getElementPosition(clickedWorld)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    							if getElementData(playerSource, "license:gruz") then
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							local categoria = getElementData(playerSource, "CNHC") or "C"
    							exports._infobox:addNotification(clickedWorld, "[Licencia]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
    							exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end
    			end	
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    			end
    			elseif itemUsed == "cnhd" and getElementType(clickedWorld) == "player" then
    			if not clickedWorld then exports._infobox:addNotification(playerSource, "inventario", "error", "Não tem niguem priximo a você", 5) return end
    			if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    				if not isPedInVehicle(playerSource) then
    					if not isTimer(acao[playerSource]) then
    						local x, y, z = getElementPosition(playerSource)
    						local ex, ey, ez = getElementPosition(clickedWorld)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    							if getElementData(playerSource, "license:pass") then
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							local categoria = getElementData(playerSource, "CNHD") or "D"
    							exports._infobox:addNotification(clickedWorld, "[Licencia]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
    							exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end
    			end	
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    			end
    			elseif itemUsed == "cnhaero" and getElementType(clickedWorld) == "player" then
    			if not clickedWorld then exports._infobox:addNotification(playerSource, "inventario", "error", "Não tem niguem priximo a você", 5) return end
    			if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
    				if not isPedInVehicle(playerSource) then
    					if not isTimer(acao[playerSource]) then
    						local x, y, z = getElementPosition(playerSource)
    						local ex, ey, ez = getElementPosition(clickedWorld)
    						if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    							if getElementData(playerSource, "license:air") then
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							local categoria = getElementData(playerSource, "CNHE") or "E"
    							exports._infobox:addNotification(clickedWorld, "[Licencia]  •  Nombre: '"..name.."', Nº: '"..id.."', categoria: '"..categoria.."'", "info")
    							exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end
    			end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    			end
    -------------------------------------------------------------------------------------------------------------		
    	elseif itemActioned == "identidade" and getElementType(clickedWorld) == "player" then --Comienza
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						local name = getPlayerName(playerSource)
    						local id = getElementData(playerSource, "ID") or "N/A"
    						local wanted = getPlayerWantedLevel(playerSource)
    						exports._infobox:addNotification(clickedWorld, "[IDENTIDAD]  •  Nombre: '"..name.."', Nº: '"..id.."', Antecedentes Penales: '"..wanted.."'", "info")
    						exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end --Termina
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end 
    		elseif itemActioned == "distintivo" and getElementType(clickedWorld) == "player" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						local name = getPlayerName(playerSource)
    						local id = getElementData(playerSource, "ID") or "N/A"
    						exports._infobox:addNotification(clickedWorld, "[Placa Policial]  •  Nombre: '"..name.."', Nº: '"..id.."', situación: 'Válido'", "info")
    						exports._infobox:addNotification(playerSource, "Mostraste '"..realName[itemActioned][1].."' para "..getPlayerName(clickedWorld), "success")
    					end
    				end 
    	
    				else
    				    exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para mostar su '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end	-- -----------------------------------------------------------------------
    	elseif itemActioned == "dinamite" and getElementType(clickedWorld) == "object" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						if getElementData(clickedWorld, "Bank:Gate1") then
    							triggerEvent("Banco:Iniciar", root, playerSource)
    						end
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "pendrive" and getElementType(clickedWorld) == "object" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						if getElementData(clickedWorld, "Bank:Pass") then
    							triggerEvent("Banco:Hackear", root, playerSource)
    						end
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	elseif itemActioned == "drill" and getElementType(clickedWorld) == "object" then
    		if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
    			if not isPedInVehicle(playerSource) then
    				if not isTimer(acao[playerSource]) then
    					local x, y, z = getElementPosition(playerSource)
    					local ex, ey, ez = getElementPosition(clickedWorld)
    					if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
    						if getElementData(clickedWorld, "Bank:Gate3") then
    							triggerEvent("Banco:Furadeira", root, playerSource)
    						end
    					end
    				end
    			else
    				exports._infobox:addNotification(playerSource, "Necesitas estar fuera del vehiculo para usar '"..realName[itemActioned][1].."'", "error")
    			end
    		else
    			exports._infobox:addNotification(playerSource, "No posees '"..realName[itemActioned][1].."' en tu inventario", "error")
    		end
    	end
    end
    addEvent("Action", true)
    addEventHandler("Action", resourceRoot, action)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function trash(playerSource, item, qntd)
    	if GiveAndTakeAndGetItem("get", playerSource, item) >= qntd then
    		if not isPedInVehicle(playerSource) then
    			if not isTimer(acao[playerSource]) then
    				acao[playerSource] = setTimer(function() end, 1300, 1)
    				setPedAnimation(playerSource, "POLICE", "CopTraf_Away", 1300, true, false, false, false, _, true)
    				setTimer(function()
    					PlaySound3D(playerSource, "trash", 20)
    					GiveAndTakeAndGetItem("take", playerSource, item, qntd)
    					exports._infobox:addNotification(playerSource, "Has desechado "..qntd.."x '"..realName[item][1].."'", "success")
    					local name = getPlayerName(playerSource)
    					local id = getElementData(playerSource, "ID") or "N/A"
    					exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nAcción: Desechó basura")
    					for _, players in pairs(getElementsByType("player")) do
    						if players ~= playerSource then
    							local x, y, z = getElementPosition(playerSource)
    							local x2, y2, z2 = getElementPosition(players)
    							if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
    								local name = getPlayerName(playerSource)
    								local id = getElementData(playerSource, "ID") or "N/A"
    								outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") Desechó "..qntd.."x '"..realName[item][1].."' en una papelera cercana a usted.", players, 30, 144, 255, true)
    							end
    						end
    					end
    				end, 1300, 1)
    			end
    		end
    	else
    		exports._infobox:addNotification(playerSource, "No posees la cantidad indicada de este item", "error")
    	end
    end
    addEvent("Trash", true)
    addEventHandler("Trash", resourceRoot, trash)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function box(estado, playerSource, gang, item, qntd)
    	if estado == "guardar" then
    		for i, v in pairs(BoxPositions) do
    			if BoxPositions[i][1] == gang then
    				if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(BoxPositions[i][2])) then
    					if GiveAndTakeAndGetItem("get", playerSource, item) >= qntd then
    						if not isPedInVehicle(playerSource) then
    							if not isTimer(acao[playerSource]) then
    								acao[playerSource] = setTimer(function() end, 1300, 1)
    								setPedAnimation(playerSource, "POLICE", "CopTraf_Away", 1300, true, false, false, false, _, true)
    								setTimer(function()
    									PlaySound3D(playerSource, "trash", 20)
    									GiveAndTakeAndGetItem("take", playerSource, item, qntd)
    									exports._infobox:addNotification(playerSource, "Guardaste "..qntd.."x '"..realName[item][1].."'", "success")
    									local name = getPlayerName(playerSource)
    									local id = getElementData(playerSource, "ID") or "N/A"
    									exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nBaul: "..gang.."\nAcción: "..estado)
    									for _, players in pairs(getElementsByType("player")) do
    										if players ~= playerSource then
    											local x, y, z = getElementPosition(playerSource)
    											local x2, y2, z2 = getElementPosition(players)
    											if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
    												local name = getPlayerName(playerSource)
    												local id = getElementData(playerSource, "ID") or "N/A"
    												outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") guardo "..qntd.."x '"..realName[item][1].."' cercano a usted.", players, 30, 144, 255, true)
    											end
    										end
    									end
    									if bau[gang][item] then
    										bau[gang][item][1] = bau[gang][item][1] + tonumber(qntd)
    									else
    										bau[gang][item] = {}
    										bau[gang][item][1] = tonumber(qntd)
    									end
    								end, 1300, 1)
    							end
    						end
    					else
    						exports._infobox:addNotification(playerSource, "No posees la cantidad indicada de este item", "error")
    					end
    				end
    			end
    		end
    	elseif estado == "pegar" then
    		for i, v in pairs(BoxPositions) do
    			if BoxPositions[i][1] == gang then
    				if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(BoxPositions[i][2])) then
    					if bau[gang][item] then
    						if bau[gang][item][1] >= qntd then
    							if GiveAndTakeAndGetItem("give", playerSource, item, qntd) then
    								bau[gang][item][1] = bau[gang][item][1] - qntd
    								if bau[gang][item][1] <= 0 then
    									bau[gang][item] = nil
    								end
    								exports._infobox:addNotification(playerSource, "Colocaste "..qntd.."x '"..realName[item][1].."'", "success")
    								local name = getPlayerName(playerSource)
    								local id = getElementData(playerSource, "ID") or "N/A"
    								exports["[MOD]Logs"]:CreateLog("[INVENTARIO]\nJugador: "..name.." ["..id.."]\nItem: "..item.."\nCantidad: "..qntd.."\nBaul: "..gang.."\nAcción: "..estado)
    								for _, players in pairs(getElementsByType("player")) do
    									if players ~= playerSource then
    										local x, y, z = getElementPosition(playerSource)
    										local x2, y2, z2 = getElementPosition(players)
    										if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) <= 30 then
    											local name = getPlayerName(playerSource)
    											local id = getElementData(playerSource, "ID") or "N/A"
    											outputChatBox("[INFO]:#FFFFFF El jugador #FFFF00"..name.."#FFFFFF ("..id..") puso "..qntd.."x '"..realName[item][1].."' en un baul cercano a ti.", players, 30, 144, 255, true)
    										end
    									end
    								end
    							else
    								exports._infobox:addNotification(playerSource, "No tienes capacidad en la mochila para sacar este item", "error")
    							end
    						else
    							exports._infobox:addNotification(playerSource, "El baul no posee la cantidad indicada de este item", "error")
    						end
    					else
    						exports._infobox:addNotification(playerSource, "El baul no posee este item", "error")
    					end
    				end
    			end
    		end
    	end
    end
    addEvent("Box", true)
    addEventHandler("Box", resourceRoot, box)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function click(button, state, playerSource)
    	if button == "left" and state == "down" then
            if getElementType(source) == "object" then
            	if getElementModel(source) == 1227 then
            	    for i, v in pairs(boxes) do
            	        if v == source then
            	            local x, y, z = getElementPosition(playerSource)
            	            local ex, ey, ez = getElementPosition(source)
            	            if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 1.5 then
            	            	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup(BoxPositions[i][2])) then
            	            		local gangBox = BoxPositions[i][1]
            	                	triggerClientEvent(playerSource, "RenderBox", resourceRoot, bau[gangBox], gangBox)
            	                end
            	            end
            	        end
            	    end
            	end
            end
        end
    end
    addEventHandler("onElementClicked", root, click)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function fumarCigarro(source)
    	if isElement(cigarro[source]) then
    		if not isTimer(acao[source]) then
    			acao[source] = setTimer(function() end, 7000, 1)
    			setPedAnimation(source, "GANGS", "smkcig_prtl", 7000, false, true, false, false, _, true)
    		end
    	end
    end
    -----------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------
    function onLogin(_, account)
    	if not isGuestAccount(account) then
    		timerStart[source] = setTimer(function(source)
    			inventario[source] = {}
    			if getAccountData(account, "Inventario") then
    				local itens = fromJSON(getAccountData(account, "Inventario"))
    				for index, value in pairs(itens) do
    					if realName[itens[index][1]] then
    						table.insert(inventario[source], value)
    					end
    				end
    			end
    			triggerClientEvent(source, "refresh", resourceRoot, inventario[source])
    		end, 10000, 1, source)
    	end
    end
    addEventHandler("onPlayerLogin", root, onLogin)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function onQuit()
    	local account = getPlayerAccount(source)
    	if not isGuestAccount(account) then
    		if not isTimer(timerStart[source]) then
    			local itens = toJSON(inventario[source])
    			setAccountData(account, "Inventario", itens)
    			takeAllWeapons(source)
    			acao[source] = nil
    			arma[source] = nil
    			algemado[source] = nil
    			algemando[source] = nil
    			curado[source] = nil
    			inventario[source] = nil
    			if isTimer(timerAlgema[source]) then killTimer(timerAlgema[source]) timerAlgema[source] = nil end
    			if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end
    			if isElement(capacete[source]) then destroyElement(capacete[source]) capacete[source] = nil setElementData(source, "Capacete", false) end
    			if isElement(mascara[source]) then destroyElement(mascara[source]) mascara[source] = nil end
    			if isElement(maleta[source]) then destroyElement(maleta[source]) maleta[source] = nil end
    			if isElement(som[source]) then destroyElement(som[source]) som[source] = nil end
    			if isElement(flor[source]) then destroyElement(flor[source]) flor[source] = nil end
    			if isElement(cigarro[source]) then destroyElement(cigarro[source]) cigarro[source] = nil end
    			if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end
    			if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end
    			if isElement(item[source]) then destroyElement(item[source]) item[source] = nil end
    		end
    	end
    end
    addEventHandler("onPlayerQuit", root, onQuit)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function onStart()
    	for i, players in pairs(getElementsByType("player")) do
    		timerStart[players] = setTimer(function()
    			local account = getPlayerAccount(players)
    			if not isGuestAccount(account) then
    				inventario[players] = {}
    				if getAccountData(account, "Inventario") then
    					local itens = fromJSON(getAccountData(account, "Inventario"))
    					for index, value in pairs(itens) do
    						if realName[itens[index][1]] then
    							table.insert(inventario[players], value)
    						end
    					end
    				end
    				triggerClientEvent(players, "refresh", resourceRoot, inventario[players])
    			end
    		end, 10000, 1)
    	end
    	for i, v in pairs(bau) do
    		local data = executeSQLQuery("SELECT * FROM Baú WHERE gang = ?", i)
    		if data and type(data) == "table" and #data ~= 0 then
    			data[1].valor = fromJSON(data[1].valor)
    			for index, value in pairs(data[1].valor) do
    				bau[i][index] = {}
    				bau[i][index][1] = data[1].valor[index][1]
    			end
    		end
    	end
    end
    addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function onStop()
    	for i, players in pairs(getElementsByType("player")) do
    		local account = getPlayerAccount(players)
    		if not isGuestAccount(account) then
    			if not isTimer(timerStart[players]) then
    				local itens = toJSON(inventario[players])
    				setAccountData(account, "Inventario", itens)
    			end
    		end
    	end
    	executeSQLQuery("CREATE TABLE IF NOT EXISTS Baú (gang TEXT, valor TEXT)")
    	for i, v in pairs(bau) do
    		executeSQLQuery("DELETE FROM Baú WHERE gang = ?", i)
    		executeSQLQuery("INSERT INTO Baú (gang, valor) VALUES (?, ?)", i, toJSON(bau[i]))
    	end
    end
    addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), onStop)
    -----------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------
    function Refresh(playerSource)
    	local int = getElementInterior(playerSource)
    	local dim = getElementDimension(playerSource)
    	if isElement(item[playerSource]) then
    		setElementInterior(item[playerSource], int)
    		setElementDimension(item[playerSource], dim)
    	end
    	if isElement(capacete[playerSource]) then
    		setElementInterior(capacete[playerSource], int)
    		setElementDimension(capacete[playerSource], dim)
    	end
    	if isElement(mascara[playerSource]) then
    		setElementInterior(mascara[playerSource], int)
    		setElementDimension(mascara[playerSource], dim)
    	end
    	if isElement(maleta[playerSource]) then
    		setElementInterior(maleta[playerSource], int)
    		setElementDimension(maleta[playerSource], dim)
    	end
    	if isElement(som[playerSource]) then
    		setElementInterior(som[playerSource], int)
    		setElementDimension(som[playerSource], dim)
    	end
    	if isElement(flor[playerSource]) then
    		setElementInterior(flor[playerSource], int)
    		setElementDimension(flor[playerSource], dim)
    	end
    	if isElement(cigarro[playerSource]) then
    		setElementInterior(cigarro[playerSource], int)
    		setElementDimension(cigarro[playerSource], dim)
    	end
    end
    addEvent("RefreshBoneAttach", true)
    addEventHandler("RefreshBoneAttach", root, Refresh)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function PlaySound3D(playerSource, som, distance)
    	if distance == "all" then
    		triggerClientEvent(root, "playSound", resourceRoot, som, playerSource)
    	else
    		for i, players in pairs(getElementsByType("player")) do
    			local x, y, z = getElementPosition(playerSource)
    			local ex, ey, ez = getElementPosition(players)
    			if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= distance then
    				triggerClientEvent(players, "playSound", resourceRoot, som, playerSource)
    			end
    		end
    	end
    end
    -----------------------------------------------------------------------------------------------------------------------------------------
    function onWasted()
    	if not getElementData(source, "Staff") then
    		for index = #inventario[source], 1, -1 do
    			local item = inventario[source][index][1]
    			if not itensCantRemoved[item] then
    				GiveAndTakeAndGetItem("take", source, item, "all")
    			end
    		end
    	end
    	takeAllWeapons(source)
    	curado[source] = nil
    	acao[source] = nil
    	arma[source] = nil
    	if isElement(cigarro[source]) then
    		destroyElement(cigarro[source])
    		cigarro[source] = nil
    		unbindKey(source, "x", "down", fumarCigarro)
    	end
    	if algemado[source] then
    		destroyElement(item[source])
    		item[source] = nil
    		killTimer(timerAlgema[source])
    		timerAlgema[source] = nil
    		setControlState(source, "walk", false)
    	end
    	if algemando[source] then
    		algemando[source] = nil
    	end
    end
    addEventHandler("onPlayerWasted", root, onWasted)
    -----------------------------------------------------------------------------------------------------------------------------------------
    function removeItem(playerSource, item)
    	if item == "radinho" then
    		setElementData(playerSource, "Radinho", false)
    	elseif item == "porco" or item == "criatura" or item == "capeta" or item == "caveira" or item == "macaco" or item == "cavalo" or item == "touro" or item == "sacola" then
    		destroyElement(mascara[playerSource])
    		mascara[playerSource] = nil
    	elseif item == "maleta" then
    		destroyElement(maleta[playerSource])
    		maleta[playerSource] = nil
    	elseif item == "capacete" then
    		destroyElement(capacete[playerSource])
    		capacete[playerSource] = nil
    		setElementData(playerSource, "Capacete", false)
    	elseif item == "som" then
    		destroyElement(som[playerSource])
    		som[playerSource] = nil
    	elseif item == "flor" then
    		destroyElement(flor[playerSource])
    		flor[playerSource] = nil
    	else
    		if arma[playerSource] == item then
        		local ammo = getPedTotalAmmo(playerSource, weapons[item][3]) or 0
        		if ammo > 1 then
        			GiveAndTakeAndGetItem("give", playerSource, weapons[item][2], ammo - 1)
        		end
    			arma[playerSource] = nil
    			takeWeapon(playerSource, weapons[item][1])
    		end
    	end
    end
    

     

  5. hello good afternoon day or night I took the audacity to write to the private because I have a doubt with this structure I have made some basic script that I have been accommodating little by little in trial and error but this one seemed complicated I don't know what is failing in I am making this function an object that is dragged to the vehicle, lock the door and unlock, that is, a car key, but it is not working for me and it does not give me an error either, and that has me in doubt
    (It is a single question that I will ask, do not worry, I will not be bothering the private person, if I have doubts, I will post it in the forum)


    SERVER SIDE:

    elseif itemActioned == "llavesauto" and getElementType(clickedWorld) == "vehicle" then --the item to activate is in Spanish is the name of the key for vehicles
            if GiveAndTakeAndGetItem("get", playerSource, itemActioned) >= 1 then
                if not isPedInVehicle(playerSource) then
                local veiculo = getElementData(playerSource, "Vehicle:Owner")
                if veiculo then 
                if getElementData(veiculo, "Player:Owner") == source then
                    if not isTimer(acao[playerSource]) then
                        local x, y, z = getElementPosition(playerSource)
                        local ex, ey, ez = getElementPosition(clickedWorld)
                        if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 10 then
                            if not getElementData(clickedWorld, "engine") then
                        local trancar = getElementData(clickedWorld, "Vehicle:Owner")
                        outputChatBox(" ", source)
                        outputChatBox("• Veículo destrancado", source)
                        for i, players in ipairs(getElementsByType("player")) do
                            local x, y, z = getElementPosition(playerSource)
                            local ex, ey, ez = getElementPosition(clickedWorld)
                            if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then
                                triggerClientEvent(players, "lockBikeSound", players, veiculo)
                                setVehicleOverrideLights(veiculo, 2)
                                setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1)
                            end
                        end
                        end
                        end
                    else
                        setElementData(veiculo, "Locked", true)
                        outputChatBox(" ", source)
                        outputChatBox("• Veículo trancado", source)
                        for i, players in ipairs(getElementsByType("player")) do
                            local x, y, z = getElementPosition(players)
                            local ex, ey, ez = getElementPosition(veiculo)
                            if getDistanceBetweenPoints3D(x, y, z, ex, ey, ez) <= 35 then
                                triggerClientEvent(players, "lockBikeSound", players, veiculo)
                                setTimer(triggerClientEvent, 600, 1, players, "lockBikeSound", players, veiculo)
                                setVehicleOverrideLights(veiculo, 2)
                                setTimer(setVehicleOverrideLights, 300, 1, veiculo, 1)
                                setTimer(setVehicleOverrideLights, 600, 1, veiculo, 2)
                                setTimer(setVehicleOverrideLights, 900, 1, veiculo, 1)
                            end
                        end
                    end
                else
                    exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error")
                end
            else
                exports._infobox:addNotification(source, "No posees las llaves de ningun vehiculo", "error")
            end
        end
    end
  6. --this is part of the inventory

    elseif itemUsed == "knive" or itemUsed == "pickaxe" or itemUsed == "scissor" or itemUsed == "batt" or itemUsed == "helmet" or itemUsed == "pole" then
            if GiveAndTakeAndGetItem("get", playerSource, itemUsed) >= 1 then
                if not isTimer(acao[playerSource]) then
                    if not arma[playerSource] then
                        setPedAnimation(playerSource, "BUDDY", "buddy_reload", 500, false, true, false, false, _, true)
                        arma[playerSource] = itemUsed
                        giveWeapon(playerSource, weapons[itemUsed][1], 1, true)
                        PlaySound3D(playerSource, "put", 15)
                        toggleControl(playerSource, "next_weapon", false)
                        toggleControl(playerSource, "previous_weapon", false)
                    else
                        if arma[playerSource] == itemUsed then
                            arma[playerSource] = nil
                            takeWeapon(playerSource, weapons[itemUsed][1])
                            PlaySound3D(playerSource, "put", 15)
                            toggleControl(playerSource, "next_weapon", true)
                            toggleControl(playerSource, "previous_weapon", true)




    this is the trunk code
    takeWeapon(source, ID)
    elseif Slot3 == "Livre" then
    setElementData(Mala, "TS:SlotPorta3", Objeto)
    setElementData(Mala, "TS:QuantidadeSlotPorta3", Quantidade)
    setElementData(Mala, "TS:IDSlotPorta3", ID)
    takeWeapon(source, ID) -- here I want to call the weapon from the code snippet above but I can't establish the link
    elseif Slot4 == "Livre" then
    setElementData(Mala, "TS:SlotPorta4", Objeto)
    setElementData(Mala, "TS:QuantidadeSlotPorta4", Quantidade)
    setElementData(Mala, "TS:IDSlotPorta4", ID)
    takeWeapon(source, ID) --here I want to call the weapon from the code snippet above but I can't establish the link
    elseif Slot5 == "Livre" then
    setElementData(Mala, "TS:SlotPorta5", Objeto)
    setElementData(Mala, "TS:QuantidadeSlotPorta5", Quantidade)
    setElementData(Mala, "TS:IDSlotPorta5", ID)
    takeWeapon(source, ID)

  7. I have a question and I'm sorry I don't understand English very well what did it do here I've turned it around and I can't understand

    if time.hour >= 1 and time.hour < 3 then --but this one I don't understand very well what it means to movingMyGateBack()
            movingMyGateBack()  --I understand that this is the call of the object in the time function

  8. 12 hours ago, AngelAlpha said:

    Show your code pls

    local myGate2 = createObject (2957, 386.48864746094,-1526.0137939453,32.323436737061 , 0, 0, 45) --gate 2
        
    function openMyGate()
        moveObject ( myGate2, 3000, 386.48864746094,-1526.0137939453,35.323436737061 )
    end
    addCommandHandler("*1abrir",openMyGate) -- change this command to open the door in a timer that opens automatically every so often, for example if the object opened it should remain open for one hour and if the object closed it should remain closed for one hour


    function movingMyGateBack()
        moveObject ( myGate2, 3000, 386.48864746094,-1526.0137939453,32.323436737061)
    end
    addCommandHandler("*1cerrar",movingMyGateBack)

    local myGate3 = createObject (2957, 394.81704711914,-1527.3861083984,32.330768585205 , 0, 0, 130) --gate 3

  9. local myGate2 = createObject (2957, 386.48864746094,-1526.0137939453,32.323436737061 , 0, 0, 45) --gate 2
        
    function openMyGate()
        moveObject ( myGate2, 3000, 386.48864746094,-1526.0137939453,35.323436737061 )
    end
    addCommandHandler("*1abrir",openMyGate) -- change this command to open the door in a timer that opens automatically every so often, for example if the object opened it should remain open for one hour and if the object closed it should remain closed for one hour


    function movingMyGateBack()
        moveObject ( myGate2, 3000, 386.48864746094,-1526.0137939453,32.323436737061)
    end
    addCommandHandler("*1cerrar",movingMyGateBack)

    local myGate3 = createObject (2957, 394.81704711914,-1527.3861083984,32.330768585205 , 0, 0, 130) --gate 3

  10. How could I put an object in motion per hour? For example, I want a door to have a time to open and close. For example, I want the door to close at 1:00 p.m. and open at 3:00 p.m.How could I put an object in motion per hour? For example, I want a door to have a time to open and close. For example, I want the door to close at 1:00 p.m. and open at 3:00 p.m.How could I put an object in motion per hour? For example, I want a door to have a time to open and close. For example, I want the door to close at 1:00 p.m. and open at 3:00 p.m.How could I put an object in motion per hour? For example, I want a door to have a time to open and close. For example, I want the door to close at 1:00 p.m. and open at 3:00 p.m.How could I put an object in motion per hour? For example, I want a door to have a time to open and close. For example, I want the door to close at 1:00 p.m. and open at 3:00 p.m.
    
    
    
    
     
     
     
    I already have the script to open and close doors but I would like to add the code to it so that it opens and closes at a specific time


    How could I put an object in motion per hour? For example, I want a door to have a time to open and close. For example, I want the door to close at 1:00 p.m. and open at 3:00 p.m.
     
     
     
  11. Hello, my language is Spanish and the tutorial videos that I have seen are in other languages, it has been difficult for me to understand so I chose to post here it turns out that I am learning to create a sqlite database or at least trying and I have a problem with this script that does not have a database, I am trying to make one in sqlite with dbbrowser but I do not understand how the queries would be in sqlite since it throws me an error if someone can guide me I want to learn


     

    addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
    function ()
        for i,v in ipairs(getElementsByType("player")) do 
            bindKey(v, config.BindAbrirNormal, 'down', AbrirPainel)
        end 
        db = dbConnect("mysql", "dbname=s288_teste;host=HIDDEN BY STAFF;charset=utf8", "", "")
        if db then
            outputDebugString("[DB-MySQL] Conectado com sucesso!")
        else
            outputDebugString("[DB-MySQL] Não foi possível fazer a conexão")
        end
    elseif config["Database"].SQLite then
            db = dbConnect("sqlite", "base.db")
            dbExec(db, 'CREATE TABLE IF NOT EXISTS LogsGroup (Logs, Date, Grupo)')
            dbExec(db, 'CREATE TABLE IF NOT EXISTS InfoGrupos(Conta, NomeGrupo, Cargo, InfosApreensoes, Renda, UltimoLogin)')
            dbExec(db, 'CREATE TABLE IF NOT EXISTS Grupos(Tag, Nome, LimiteMembros, Lider, InfosApreensoes, Tipo, Saldo)')
            dbExec(db, 'CREATE TABLE IF NOT EXISTS RendaGrupos(NomeGrupo, Rendas)')
            if db then
                outputDebugString("[DB] Banco de dados conectado com sucesso!")
            else
                outputDebugString("[DB] Banco de dados não conseguiu se conectar!")
            end
        end
        local result = dbPoll(dbQuery(db, 'SELECT * FROM Grupos'), -1)
    
    
    addEvent("JOAO.limparHistorico", true)
    addEventHandler("JOAO.limparHistorico", root,
    function(player, grupo)
        dbExec(db, "DELETE FROM LogsGroup WHERE Grupo=?", grupo)
        dbExec(db, "INSERT INTO LogsGroup(Logs, Date, Grupo) VALUES(?,?,?)", exports["cuentapersonaje"]:getPlayerNameFromConta(getAccountName(getPlayerAccount(player))).."("..(getElementData(player, 'ID') or 0)..") limpou o histórico!", getRealTime().monthday.."/"..(getRealTime().month+(1)).."/"..(getRealTime().year+(1900)).." às "..getRealTime().hour..":"..getRealTime().minute, grupo)
        local resultarlogs = dbPoll(dbQuery(db, 'SELECT * FROM LogsGroup WHERE Grupo = ?', grupo), -1)
        triggerClientEvent(player, 'JOAO.resultLogsGroupC', player, resultarlogs)
    end)
    
    
    function AbrirPainel(thePlayer)
        local sql = dbPoll(dbQuery(db, "SELECT * FROM InfoGrupos WHERE Conta=?", getAccountName(getPlayerAccount(thePlayer))), -1)
        if #sql > 0 and sql[1].Cargo then  
            local sqlgp = dbPoll(dbQuery(db, "SELECT * FROM Grupos WHERE Nome=?", sql[1].NomeGrupo), -1)
            sqlgp[1].NomeP = exports["cuentapersonaje"]:getPlayerNameFromConta(sqlgp[1].Lider)
            local rendas = dbPoll(dbQuery(db, "SELECT * FROM RendaGrupos WHERE NomeGrupo=?", sql[1].NomeGrupo), -1)
            sqlmembro = dbPoll(dbQuery(db, "SELECT * FROM InfoGrupos WHERE NomeGrupo=?", sql[1].NomeGrupo), -1)
            tablecalculo = {}
            for i,v in ipairs(sqlmembro) do 
                if v.Cargo then 
                    tablecalculo[v.Conta] = fromJSON(v.InfosApreensoes).presos + fromJSON(v.InfosApreensoes).drogas + fromJSON(v.InfosApreensoes).armas
                else 
                    sqlmembro[i] = nil
                end 
            end 
            table.sort (  
                tablecalculo, 
                function ( a, b ) 
                    
                    return a > b 
                end 
            )
            for i,v in pairs(tablecalculo) do 
                sqlmembro2 = dbPoll(dbQuery(db, "SELECT * FROM InfoGrupos WHERE Conta=?", i), -1)
                sqlmembro2[1].NomeP = exports["cuentapersonaje"]:getPlayerNameFromConta(sqlmembro2[1].Conta)
                break
            end 
            for i,v in pairs(sqlmembro) do 
                sqlmembros = dbPoll(dbQuery(db, "SELECT * FROM InfoGrupos WHERE Conta=?", v.Conta), -1)
                v.Online = getAccountPlayer(getAccount(v.Conta))
                v.NomeP = exports["cuentapersonaje"]:getPlayerNameFromConta(v.Conta)
            end 
            triggerClientEvent(thePlayer, "MeloSCR:AbrirPainelGrupo", thePlayer, "home", sqlmembro, sqlgp[1], sqlmembro2[1], (sql[1].Cargo == "Lider" and true or false), rendas, getRealTime().timestamp)
            local resultarlogs = dbPoll(dbQuery(db, 'SELECT * FROM LogsGroup WHERE Grupo = ?', sqlgp[1].Nome), -1)
            triggerClientEvent(thePlayer, 'JOAO.resultLogsGroupC', thePlayer, resultarlogs)
        else
            grupos[thePlayer] = {}
            for i,v in ipairs(sql) do 
                local sqlgp = dbPoll(dbQuery(db, "SELECT * FROM Grupos WHERE Nome=?", v.NomeGrupo), -1)
                if #sqlgp > 0 then   
                    sqlgp[1].NomeP = exports["cuentapersonaje"]:getPlayerNameFromConta(sqlgp[1].Lider)
                    table.insert(grupos[thePlayer], sqlgp)
                end 
            end 
            triggerClientEvent(thePlayer, "MeloSCR:AbrirPainelGrupo", thePlayer, "convites", sql, grupos[thePlayer])
        end 
    end 
    
    addEventHandler("onPlayerLogin", root, 
    function ()
        bindKey(source, config.BindAbrirNormal, 'down', AbrirPainel)
    end)
    
    notifyS = function (thePlayer, message, type)
        if config.Notify.export then 
            call(getResourceFromName(config.Notify.nomescriptouevento), config.Notify.funcaoexport, thePlayer,message, type)
        else 
            triggerEvent(config.Notify.nomescriptouevento, thePlayer, message, type)
        end 
    end
    
    addEvent("MeloSCR:ConvidarMembroGrupo", true)
    addEventHandler("MeloSCR:ConvidarMembroGrupo", root, 
    function (IDMembro, NomeGrupo)
        serial, conta = exports.vanish_id:getSerialByID(tonumber(IDMembro))
        local sql1 = dbPoll(dbQuery(db, "SELECT * FROM InfoGrupos WHERE Conta=?", conta), -1)
        if #sql1 > 0 and sql1[1].Cargo then return notifyS(source, "Este jogador ja pertence a um grupo!", "error") end 
        dbExec(db, "INSERT INTO InfoGrupos(Conta, NomeGrupo, Cargo, InfosApreensoes, Renda, UltimoLogin) VALUES(?,?,?,?,?,?)", conta, NomeGrupo, _, _, _, getRealTime().timestamp)
        notifyS(source, "Membro convidado com sucesso!", "success")
    end)
    
    addEvent("MeloSCR:ExpulsarMembroGrupo", true)
    addEventHandler("MeloSCR:ExpulsarMembroGrupo", root, 
    function (conta, NomeGrupo)
        dbExec(db, "DELETE FROM InfoGrupos WHERE Conta=? AND NomeGrupo=?", conta, NomeGrupo)
        notifyS(source, "Membro expulso com sucesso!", "success")
    end)
    
    addEvent("MeloSCR:AceitarGrupo", true)
    addEventHandler("MeloSCR:AceitarGrupo", root, 
    function (grupo)
        dbExec(db, "DELETE FROM InfoGrupos WHERE Conta=?", getAccountName(getPlayerAccount(source)))
        dbExec(db, "INSERT INTO InfoGrupos(Conta, NomeGrupo, Cargo, InfosApreensoes, Renda, UltimoLogin) VALUES(?,?,?,?,?,?)", getAccountName(getPlayerAccount(source)), grupo.Nome, "Recruta", toJSON({presos = 0, drogas = 0, armas = 0}), 0, getRealTime().timestamp)
        notifyS(source, "Você agora faz parte do: "..grupo.Nome.."!", "success")
    end)
    
    addEvent("MeloSCR:DepositarDinheiroGrupo", true)
    addEventHandler("MeloSCR:DepositarDinheiroGrupo", root, 
    function (grupo, quantia)
        local sql = dbPoll(dbQuery(db, "SELECT * FROM Grupos WHERE Nome=?", grupo), -1)
        if #sql > 0 then 
            if getPlayerMoney(source) >= quantia then 
                takePlayerMoney(source, quantia)
                dbExec(db, "UPDATE Grupos SET Saldo=? WHERE Nome=?", sql[1].Saldo + quantia, grupo)
            else 
                notifyS(source, "Você não tem dinheiro suficiente!", "error")
            end 
        end 
    end)
    
    addEvent("MeloSCR:SacarDinheiroGrupo", true)
    addEventHandler("MeloSCR:SacarDinheiroGrupo", root, 
    function (grupo, quantia)
        local sql = dbPoll(dbQuery(db, "SELECT * FROM Grupos WHERE Nome=?", grupo), -1)
        if #sql > 0 then 
            if sql[1].Saldo >= quantia then 
                givePlayerMoney(source, quantia)
                dbExec(db, "UPDATE Grupos SET Saldo=? WHERE Nome=?", sql[1].Saldo - quantia, grupo)


     

  12. I have edited an inventory in its entirety but what I don't know is how to make a link between one function or another, for example in this script I have the id of a key for the vehicle and I have implemented it in the car store so that when they buy it a Vehicle comes out of inventory but it doesn't work, what am I doing wrong?

    Inventory

    end	
    	elseif itemID == 17 then
    		 triggerServerEvent("checkCarKey",localPlayer,localPlayer,DBID,itemValue)

    Carshop Script

    setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2)
    		setElementData(vehicle, "Owner", source)
    		local NewID = getFreeID()
    		setElementData(vehicle, "ID", NewID)
    		dbExec(db, "INSERT INTO VehicleList VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", NewID, getAccountName(getPlayerAccount(source)), Model, x-5, y+5, z, rz, color, "", 3, cost, 1000, 0)
    		exports.Scripts_Dxmessages:outputDx ( source, "Compró este auto por: $"..cost, "success" )
    		exports.itemID:givePlayerItem(player,40,1,id,17,0); ---- here is the item that I want to link to the car
    		updateVehicleInfo(source)
    		setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source)))
    		warpPedIntoVehicle ( source, vehicle )
    		vv[vehicle] = setTimer(function(source)

     

  13. It throws an error I do not understand much what it is about I suppose it is because it asks me for an administrator permission but I am an administrator in acl it still throws the error the script calls a level 5 administrator I would appreciate the help

     

  14. 13 hours ago, Bean666 said:

    No tengo idea de lo que estás tratando de hacer con la función 2, pero arreglé el cheque. si el cheque es su único problema, entonces esto debe solucionarlo.

    
    
    local Grupo = {
    	["Policial"] = true
    	-- You can add more groups here if you want.
    }
    
    function isPlayerOnGroup2 ( thePlayer )
        local account = getPlayerAccount ( thePlayer )
    	for group, bool in pairs(Grupo) do
    		if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup(group)) then
    			return true
            end
    		return false 
        end
    end
     
    function ClickJogdor ( Player )
    	if isPlayerOnGroup2 ( source ) then
    		local account = getPlayerAccount (Player)
    		if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
    		local cx, cy, cz = getElementPosition ( Player )
    		local px, py, pz = getElementPosition ( source )
    		local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
    		if ( distance <= 1.7 ) then
    		-- if Player == source then return end
    			triggerClientEvent (source , "FeniX_AbrirDX" , source)
    			setElementData(source, "FeniXMTA_Suspeito" , Player)
    		end
        end
    end
    addEvent ( "FeniX_ClickJogdor", true )
    addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

    Ok I have already noticed the change, that is the acl that I have in the server file and in the client I have the Dx function, as you will see, I am learning thanks to the people who help in the forum. I would like to know in that script what helps the work of the client files panel is the triggerClientEvent (source, "FeniX_AbrirDX", source) I would like to understand why it keeps leaving without acl permission in the game if you need more part of the code let me know that I am willing to learn (I don't speak English)

     

  15. This script is not working it has an assigned acl group Police and the script should only give permissions to those of that group, but the truth is that everyone can open the panel who can guide me

     

    Grupo = { "Policial" } -- Grupos do Painel P, que terá acesso ao DX !
    
    function isPlayerOnGroup2 ( thePlayer )
        local account = getPlayerAccount ( thePlayer )
        local inGroup = false
        for _, group in ipairs ( Grupo ) do
            if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then
                inGroup = true
                break
            end
        end
        return inGroup
    end
     
     
    function ClickJogdor ( Player )
      if isPlayerOnGroup2 ( source ) then
      	local account = getPlayerAccount (Player)
        if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
       local cx, cy, cz = getElementPosition ( Player )
        local px, py, pz = getElementPosition ( source )
         local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
         if ( distance <= 1.7 ) then
      -- if Player == source then return end
          triggerClientEvent (source , "FeniX_AbrirDX" , source)
    	  setElementData(source, "FeniXMTA_Suspeito" , Player)
    	 
    	  end
        end
    end
    addEvent ( "FeniX_ClickJogdor", true )
    addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  

     

  16. This is my third post, the truth is that I like it because I am learning functions and I have a question with this script I still do not know how to handle the acl but I have a doubt with this since I remove the acl permission from a user and it still comes out the panel when as I understand it should not come out anymore

     

    
     
    Grupo = { "Policial" } 
    
    function isPlayerOnGroup2 ( thePlayer )
        local account = getPlayerAccount ( thePlayer )
        local inGroup = false
        for _, group in ipairs ( Grupo ) do
            if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then
                inGroup = true
                break
            end
        end
        return inGroup
    end
     
     
    function ClickJogdor ( Player )
      if isPlayerOnGroup2 ( source ) then
      	local account = getPlayerAccount (Player)
        if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
       local cx, cy, cz = getElementPosition ( Player )
        local px, py, pz = getElementPosition ( source )
         local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
         if ( distance <= 1.7 ) then
      -- if Player == source then return end
          triggerClientEvent (source , "FeniX_AbrirDX" , source)
    	  setElementData(source, "FeniXMTA_Suspeito" , Player)
    	 
    	  end
        end
    end
    addEvent ( "FeniX_ClickJogdor", true )
    addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)  
    
    --[[                               
                                       ################################################
                                       #                    Bindkey                   #                                                                
                                       ################################################
    --]]
    
    function onPlayerCommand(command)
        if getElementData(source,"FeniX_Preso") then
            cancelEvent()
        end
    end
    addEventHandler("onPlayerCommand",getRootElement(),onPlayerCommand)
    
    --[[                               
                                       ################################################
                                       #                    Parte Multa               #                                                                
                                       ################################################
    --]]
    
    function setarMulta( Valor_Multa , Motivo_Multa )
        local Abordado = getElementData( source,"FeniXMTA_Suspeito")
        local cx, cy, cz = getElementPosition ( Abordado )
        local px, py, pz = getElementPosition ( source )
        local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
        if ( distance >= 1.8 ) then
    	msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
    	elseif ( distance <= 1.7) then	
    	takePlayerMoney(Abordado, tonumber(Valor_Multa))
    	givePlayerMoney(source, tonumber(Valor_Multa))
    	outputChatBox ( "#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffVocê foi Multado pelo PM: "..getPlayerName(source).." #ffffff, Motivo: #FF0000"..Motivo_Multa.." #ffffff, Valor: #FF0000"..Valor_Multa.." #ffffff!" , Abordado , 255,255,255, true)
    	end
    end
    addEvent("FeniX_SetarMulta", true)
    addEventHandler("FeniX_SetarMulta", root, setarMulta)
    
    addEvent("FeniX_Aviso_2",true)
    addEventHandler("FeniX_Aviso_2",root,
    	function ()
    	msgFeniX(source, "Informe o Valor da Multa !", "error")
    	end
    )
    
    addEvent("FeniX_Aviso_1",true)
    addEventHandler("FeniX_Aviso_1",root,
    	function ()
    	msgFeniX(source, "Informe o Motivo da Multa !", "error")
    	end
    )
    
    --[[                               
                                       ################################################
                                       #                   Função CNH                 #                                                                
                                       ################################################
    --]]
    
    function cnHPlayer ()
     local Abordado = getElementData( source,"FeniXMTA_Suspeito")
        local cx, cy, cz = getElementPosition ( Abordado )
        local px, py, pz = getElementPosition ( source )
        local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
        if ( distance >= 1.8 ) then
    	msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
    	elseif ( distance <= 1.7) then
      if getElementData(Abordado, "Habilitacoes:Motos") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Moto ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Moto ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
      end
      
      if getElementData(Abordado, "Habilitacoes:Carros") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Carro ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Carro ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
      end
      
      if getElementData(Abordado, "Habilitacoes:Caminhoes") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Caminhão ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Caminhão ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
      end
      
      if getElementData(Abordado, "Habilitacoes:Onibus") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Ônibus ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Ônibus ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
      end
      
      if getElementData(Abordado, "Habilitacoes:Carretas") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Carreta ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Carreta ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
        end
      
      if getElementData(Abordado, "Habilitacoes:Barcos") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Barco ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Barco ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
        end
    
      if getElementData(Abordado, "Habilitacoes:Helicopteros") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Helicóptero ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Helicóptero ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
        end
    
      if getElementData(Abordado, "Habilitacoes:Avioes") == true then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Avião ( #00FF00✔ #ffffff)", source ,  255, 255, 255, true)
      else
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria Avião ( #FF0000x #ffffff)", source ,  255, 255, 255, true)
        end	
      end
    end
    addEvent ( "FeniX_CNH", true )
    addEventHandler ( "FeniX_CNH", root, cnHPlayer) 
    
    --[[                               
                                       ################################################
                                       #                    Identidade                #                                                                
                                       ################################################
    --]]
    
    cmd0 = "verificar"
    cmd2 = "recusar"
    cmd3 = "mostrar"
    
    function BuscarIDVTR (source, cmd, pname)
      if isPlayerOnGroup2 ( source ) then
    		local vehicle = getPedOccupiedVehicle (source)
    		local cliente = getPlayerFromPartialName(pname)
    		if isElement(cliente) then
    	if cliente == source then msgFeniX(source, "Você não Pode Verificar sua Propria Ficha!", "error") return end
    		if getElementData ( cliente, "FeniX:Buscar" ) == "Sim" then
    			if isElement(vehicle) then
            		if (getElementType(vehicle) == "vehicle" ) then			
    					if (getVehicleType(vehicle) == "Automobile") or (getVehicleType(vehicle) == "Bike") then
    				  		local id = getElementModel ( vehicle )
                      		if id == 433 or id == 579 or id == 427 or id == 490 or id == 528 or id == 523 or id == 470 or id == 596 or id == 598 or id == 599 or id == 597 or id == 432 or id == 601 then
    						local Nome = getElementData ( cliente, "FeniX_RG_Nome" ) or "N/C"
                            setElementData ( source, "PM_FeniX_RG_Nome", Nome )
    						local data = getElementData ( cliente, "FeniX_RG_DataNascimento" ) or "N/C"
                            setElementData ( source, "PM_FeniX_RG_DataNascimento", data )
    						local sexo = getElementData ( cliente, "FeniX_RG_Sexo" ) or "N/C"
                            setElementData ( source, "PM_FeniX_RG_Sexo", sexo )
    						local localOrigem = getElementData ( cliente, "FeniX_RG_LocalOrigem" ) or "N/C"
                            setElementData ( source, "PM_FeniX_RG_LocalOrigem", localOrigem )
    						local Porte = getElementData ( cliente, "TS:PorteDeArmas" )
                            setElementData ( source, "PM_FeniX_RG_Porte", Porte )
    						local money = getPlayerMoney(cliente)
    						setElementData ( source, "PM_FeniX_RG_Money", money )
    						setElementData ( source, "FeniX_SolicitarFicha", "Sim" )
    						end
             			end
          			end
       			else
    	  		   msgFeniX(source, "Entre Dentro da Viatura para Poder Utilizar esse Comando!", "error")
       		    end
    		else
    		    msgFeniX(source, "Você não pode puxar uma Ficha sem a Identidade do Jogador!", "error")
    		end
    	end
    end
    end
    addCommandHandler ( cmd0, BuscarIDVTR )
     
    canceltimer={}
    function fix() 
        local Abordado = getElementData( source,"FeniXMTA_Suspeito")
    	   if isPlayerOnGroup2 ( source ) then
    			local policial = getElementData(Abordado,"cliente:policial")
    			    if isElement(policial) then 
    				msgFeniX(source, "O Jogador "..getPlayerName(Abordado).." #ffffffJa Esta Sendo Atendido Por um Policial!", "error") 
    				else
    					setElementData(Abordado,"cliente:policial",source)
    					msgFeniX(source, "Você Solicitou a Identidade do Jogador "..getPlayerName(Abordado), "warning")
    					msgFeniX(Abordado, "O Policial "..getPlayerName(source).." #ffffffPediu sua Identidade, Digite /Mostrar ou /Recusar.", "warning")
    					canceltimer[Abordado] = setTimer(cancelfix,15000,1,Abordado)
    					end
    			end
    end
    addEvent ( "FeniX_Identidade", true )
    addEventHandler ( "FeniX_Identidade", root, fix) 
    
    function recusar(source)
    	local policial = getElementData(source,"cliente:policial")
    	if isElement(policial) then
    	    msgFeniX(policial, "O Jogador "..getPlayerName(source).." #ffffffSe Recusou a Mostrar a Identidade, +1 Nivel de Procurado!", "error")
    		msgFeniX(source, "Você se Recusou a Entregar a Identidade, e Agora esta Procurado!", "warning")
    		Procurado = getPlayerWantedLevel ( source )
    		setPlayerWantedLevel ( source, Procurado+1 )
    	end
    	setElementData(source,"cliente:policial",nil)	
    	if isTimer(canceltimer[source]) then
    		killTimer(canceltimer[source])
    	end
    end
    addCommandHandler(cmd2,recusar)
    
    function aceitar(source)
    	local policial = getElementData(source,"cliente:policial")
    	if isElement(policial) then
    		msgFeniX(policial, "O Jogador "..getPlayerName(source).." #ffffffLhe mostrou a Identidade, Verifique Dentro da Viatura /Verificar Nick. (Você tem 60 Segundos)", "success")
    		msgFeniX(source, "Você mostrou sua identidade ao Policial "..getPlayerName(policial).." #ffffff( ele tem tem 60 Segundos pra verificar na viatura!)", "success")
    		local cx,cy,cz = getElementPosition(policial)
    		local x,y,z = getElementPosition(source)
    		local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
    		if dist <= 7 then	
    			setElementData ( source, "FeniX:Buscar", "Sim" )
    			setTimer ( function() setElementData ( source, "FeniX:Buscar", "Não" ) end, 60000, 1 )
    		else
    		    msgFeniX(source, "O Policial Esta Muito Longe!", "error")
    			msgFeniX(policial, "Você Esta Muito Longe do Jogador Abordado!", "error")
    		end
    	end
    	setElementData(source,"cliente:policial",nil)	
    	if isTimer(canceltimer[source]) then
    		killTimer(canceltimer[source])
    	end
    end
    addCommandHandler(cmd3,aceitar)
    
    function cancelfix(source)
    	local policial = getElementData(source,"cliente:policial")
    	if isElement(policial) then
    		msgFeniX(policial, "O Jogador "..getPlayerName(source).." #ffffffDemorou Para Mostrar ou Recusar a Identidade, +1 Nivel de Procurado!", "error")
    	end
    	msgFeniX(source, "Você Demorou Demais Para Mostrar ou Recusar o Reparo e Agora esta Procurado!", "error")
    	setElementData(source,"cliente:policial",nil)	
    	Procurado = getPlayerWantedLevel ( source )
    	setPlayerWantedLevel ( source, Procurado+1 )
    end
    
    function getPlayerFromPartialName(name)
        local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
        if name then
            for _, player in ipairs(getElementsByType("player")) do
                local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
                if name_:find(name, 1, true) then
                    return player
                end
            end
        end
    end
    
    --[[                               
                                       ################################################
                                       #                      Prender                 #                                                                
                                       ################################################
    --]]
    
    viatura = {}
    function salvacarro (vei, assento, vitima)
    	viatura[source] = vei
    end
    addEventHandler ('onPlayerVehicleEnter', root, salvacarro)
    
    function prender ()
     local Abordado = getElementData( source,"FeniXMTA_Suspeito")
       local cx, cy, cz = getElementPosition ( Abordado )
       local px, py, pz = getElementPosition ( source )
      local distance    = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
      if ( distance >= 1.8 ) then
      msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
      elseif ( distance <= 1.7) then
        local vtr = viatura[source]
           if viatura[source]  then
      attachElements (Abordado, vtr, 0.2, -1.5, 0, 0,0,90)
      vrx, vry, vrz = getElementRotation(vtr)
     setElementRotation(Abordado, vrx, vry, vrz+83)
      setElementData(Abordado,"algemado",nil)
        setPedAnimation(Abordado)
        setElementFrozen(Abordado,false)
        triggerClientEvent("algemaRemove", Abordado)
        setElementData ( Abordado, "Algemar_Desalgemar", false )
        setPedAnimation(Abordado, "ped", "CAR_dead_LHS", false, false)
        setElementData ( source, "Algemar_Desalgemar", false )
    	setElementData ( Abordado, "FeniX_Preso", true )
    	setElementData ( Abordado, "FeniXMTA_Preso", true )
          else
      msgFeniX(source, "Entre no carro e saia para executar esta função !", "error")
     end
      end
    end
    addEvent ( "FeniX_Prender", true )
    addEventHandler ( "FeniX_Prender", root, prender)
    
    
    --[[                               
                                       ################################################
                                       #                     Revistar                 #                                                                
                                       ################################################
    --]]
    
    function verEstrelas ()
    local Abordado = getElementData( source,"FeniXMTA_Suspeito")
       local cx, cy, cz = getElementPosition ( Abordado )
       local px, py, pz = getElementPosition ( source )
      local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
      if ( distance >= 1.8 ) then
      msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
      elseif ( distance <= 1.7) then
      local estrelas_player   =   getPlayerWantedLevel ( Abordado )
      if estrelas_player > 0 then
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffEstrela(s): #00ff00"..estrelas_player.."!", source, 255, 255, 255, true)
      else
      end
      outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffSem nível de #FF0000procurado!", source, 255, 255, 255, true)
    		end
    end	
    addEvent ( "FeniX_Revistar", true )
    addEventHandler ( "FeniX_Revistar", root, verEstrelas)
    
    function verArmas ()
     local Abordado = getElementData( source,"FeniXMTA_Suspeito")
       local cx, cy, cz = getElementPosition ( Abordado )
       local px, py, pz = getElementPosition ( source )
      local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
      if ( distance >= 1.8 ) then
      msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
      elseif ( distance <= 1.7) then
      for slot = 0, 12 do
      local Armas = getPedWeapon ( Abordado, slot )
      local Municao = getPedTotalAmmo ( Abordado, slot ) 
      if Armas > 0 then 
      if Municao > 0 then
      setPedAnimation( source, "POLICE", "plc_drgbst_01", 3100, true, false, false, false)
      weapon_nome = getWeaponNameFromID ( Armas )
      outputChatBox ("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffff"..weapon_nome.." com "..Municao.." Bala(s) !", source, 255, 255, 255, true )
      end
      else
      setPedAnimation( source, "POLICE", "plc_drgbst_01", 3100, true, false, false, false)
      end
    	end
       end
    end
    addEvent ( "FeniX_Revistar", true )
    addEventHandler ( "FeniX_Revistar", root, verArmas)
    
    --[[                               
                                       ################################################
                                       #                 Algemar/Desalgemar           #                                                                
                                       ################################################
    --]]
    
    function algemarDesalgemar ()
     local Abordado = getElementData( source,"FeniXMTA_Suspeito")
       local cx, cy, cz = getElementPosition ( Abordado )
       local px, py, pz = getElementPosition ( source )
      local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
       local dataAlgemado = getElementData(Abordado, "algemado")
      if ( distance >= 1.8 ) then
      msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
      elseif ( distance <= 1.7) then
      	setElementData(Abordado,"algemado",true)
    	triggerClientEvent("algemaAdd", Abordado)
    	setElementFrozen(Abordado, true)
    	setPedAnimation(Abordado, "GANG", "prtial_gngtlkA", false, false)
    	if (not dataAlgemado) then
    	setElementData ( source, "Algemar_Desalgemar", true )
    	else
    	setElementData(Abordado,"algemado",nil)
    	setPedAnimation(Abordado)
    	setElementFrozen(Abordado,false)
    	triggerClientEvent("algemaRemove", Abordado)
    	setElementData ( source, "Algemar_Desalgemar", false )
    	end
       end
    end
    addEvent ( "FeniX_AlgemarDesalgemar", true )
    addEventHandler ( "FeniX_AlgemarDesalgemar", root, algemarDesalgemar)
    
    function algemadoQuit()
    	triggerClientEvent("algemaRemove", source)
    	setElementData ( source, "Algemar_Desalgemar", false )
    end
    addEventHandler("onPlayerQuit", root, algemadoQuit)
    
    --[[                               
                                       ################################################
                                       #                  Apreender Armas             #                                                                
                                       ################################################
    --]]
    
    function apreenderArmas ()
     local Abordado = getElementData( source,"FeniXMTA_Suspeito")
        local cx, cy, cz = getElementPosition ( Abordado )
       local px, py, pz = getElementPosition ( source )
      local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
      if ( distance >= 1.8 ) then
      msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
      elseif ( distance <= 1.7) then 
        for slot = 0, 12 do  
      local Armas = getPedWeapon ( Abordado , slot )
        if Armas > 0 then 
      takeAllWeapons ( Abordado )
      outputChatBox ("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffTodas as Armas do Jogador "..getPlayerName(Abordado).." #FFFFFFfoi recolhida !", source, 255, 255, 255, true )
        end
      end
       end
    end
    addEvent ( "FeniX_ApreenderArmas", true )
    addEventHandler ( "FeniX_ApreenderArmas", root, apreenderArmas)
    
    --[[                               
                                       ################################################
                                       #                     DxMensagem               #                                                                
                                       ################################################
    --]]
    
    function msgFeniX(source, text, type)
    	exports.dxmessages:outputDx(source, text, type)
    end

     

  17. the next line throws me acl error, i'm starting to learn but i'm working on this, not really what is the label to put on the acl why use Work and follow the error
    aclGroupRemoveObject (aclGetGroup(Trabalho), "user."..accName) 

    Here is my code snippet

    
    function Pedir_Demissao (source)
    	local Trabalho = getElementData ( source, "Emprego" ) or "Desempregado"
    	if Trabalho == "Desempregado" then exports.hy_info:showBoxS(source, "Você não está empregado para se demitir.", "error") return end
    	setElementData ( source, "Emprego", "Desempregado" )
    	exports.hy_info:showBoxS(source, "Você de demitiu do emprego de "..Trabalho.."", "info")
    	local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name
            aclGroupRemoveObject (aclGetGroup(Trabalho), "user."..accName)



    this is the console error
    Access denied @ 'aclGroupRemoveObject'

  18. 7 minutes ago, Bean666 said:
    
    
    
    local mrk = createMarker(254.03366, 78.57809, 1003.64062 -1, "cylinder", 1.5, 70,130,85) 
    setElementInterior(mrk,6)
    local destroyM = createMarker(-2408.79712, -590.94116, 132.64844 -1, "cylinder", 3, 255, 0, 0)
    
    
    -- OPEN PANEL --
    
    addEventHandler("onMarkerHit", mrk,
    function(onHit)
        if isElement(onHit) and getElementType(onHit) == "player" then
            triggerClientEvent(onHit, "LS:AbrirMarkerPOL", onHit)
        end
    end
    )
    --
    
    -- Destroy Function
    
    function destroy(player)
    	if isElementWithinMarker(player, destroyM) then
    		if isPedInVehicle(player) == true then
    			destroyElement(veh[player])
    			destroyElement(veh2[player])
    			destroyElement(veh3[player])
    			destroyElement(veh4[player])
    			outputChatBox("", player, 255,255,255,true)
    		else
    			outputChatBox("", player, 255,255,255,true)
    		end
    	end
    end
    addEventHandler("onMarkerHit", destroyM, destroy)
    
    --
    
    -- Give Viatura 01
    
    veh = {}
    
    function spawnVehicleVTR()
    	if veh[source] and isElement( veh[source] ) then destroyElement(veh[source])
    		veh[source] = nil
    	end     
        veh[source] = createVehicle(490, -2421.15649, -608.30200, 132.56250)
    	local x, y, z = getElementPosition(veh[source])
    	setElementInterior(source, 0)
    	setElementPosition(source, x, y, z+2)
        warpPedIntoVehicle(source, veh[source])
        outputChatBox("#00FF00 Jefatura | #FFFFFF Patrulla 1 Seleccionada.", source, 255, 255, 255, true)
    end
    addEvent("LS:GiveVTR", true)
    addEventHandler("LS:GiveVTR", root, spawnVehicleVTR)
    --
    
    -- Give Rocam
    
    veh3 = {}
    
    function spawnVehicleRocam()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
    	local x, y, z = getElementPosition(veh3[source])
    	setElementInterior(source, 0)
    	setElementPosition(source, x, y, z+2)
        warpPedIntoVehicle(source, veh3[source])
        outputChatBox("#00FF00 Jefatura | #FFFFFF Patrulla Seleccionado.", source, 255, 255, 255, true)
    end
    addEvent("LS:GiveRocam", true)
    addEventHandler("LS:GiveRocam", root, spawnVehicleRocam)

    ‎Aquí, no creo que el setElementPosition sea necesario, pero sólo ponlo para que pueda asegurarme de que llegarás a tu auto. es sólo un comprobador si va a funcionar, más adelante se puede tratar de quitar el setElementPosition ver si todavía funciona. De todos modos tenías dos funciones que tenían el mismo nombre, cambié los dos nombres de función. ‎

    ok, it worked for me so it was badly structured the code really worked now I'm putting it into practice with the other scripts

    • Like 1
  19. 4 hours ago, Bean666 said:

    aren't you setting interior of a function name? try replacing with the veh3[source] if u mean u want to set the interior of the car to 0.

    
    veh3 = {}
    function spawnVehicle()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
        setElementInterior(veh3[source], 0) 
        warpPedIntoVehicle(source, veh3[source])

     

    the truth still keeps throwing me inside 6 and not inside 0 as I want it to work, the marker is supposed to be inside 6 and I want the vehicle to appear inside 0
     

    6 hours ago, Tekken said:

    Hello, I’ve moved your topic to scripting section for best results!

    I cannot understand your question will you please develop?

    what I really want is for that marker that is inside 6 to send me inside 0 I'm going to share the complete fragment here

     

    local mrk = createMarker(254.03366, 78.57809, 1003.64062 -1, "cylinder", 1.5, 70,130,85) 
    setElementInterior(mrk,6)
    local destroyM = createMarker(-2408.79712, -590.94116, 132.64844 -1, "cylinder", 3, 255, 0, 0)
    
    
    -- Abrir painel
    addEventHandler("onMarkerHit", mrk, function(onHit)
        if getElementType(onHit) == "player" then
            triggerClientEvent(onHit, "LS:AbrirMarkerPOL", onHit)
        end
    end)
    --
    
    -- Destroy Function
    function destroy(player)
    	if isElementWithinMarker(player, destroyM) then
    	if isPedInVehicle(player) == true then
    		destroyElement(veh[player])
    		destroyElement(veh2[player])
    		destroyElement(veh3[player])
    		destroyElement(veh4[player])
    		outputChatBox("", player, 255,255,255,true)
    	else
    		outputChatBox("", player, 255,255,255,true)
    	end
    end
    end
    addEventHandler("onMarkerHit", destroyM, destroy)
    --
    
    -- Give Viatura 01
    veh = {}
    function spawnVehicle()
    	if veh[source] and isElement( veh[source] ) then destroyElement(veh[source])
    		veh[source] = nil
    	end     
        veh[source] = createVehicle(490, -2421.15649, -608.30200, 132.56250)
        warpPedIntoVehicle(source, veh[source])
        outputChatBox("#00FF00 Jefatura | #FFFFFF Patrulla 1 Seleccionada.", source, 255, 255, 255, true)
    end
    addEvent("LS:GiveVTR", true)
    addEventHandler("LS:GiveVTR", getRootElement(), spawnVehicle)
    --
    
    -- Give Rocam
    veh3 = {}
    function spawnVehicle()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
        setElementInterior(veh3[source], 0)
        warpPedIntoVehicle(source, veh3[source])
        outputChatBox("#00FF00 Jefatura | #FFFFFF Patrulla Seleccionado.", source, 255, 255, 255, true)
    end
    addEvent("LS:GiveRocam", true)
    addEventHandler("LS:GiveRocam", getRootElement(), spawnVehicle)

     

  20. Hello friends I have a question about this fragment of code, the marker is in the department of the saints (interior 6) its function is to be able to choose a vehicle which I want to appear in the police garage (interior 0) my question is how I would do so that the interior can be invoked 0

     

    veh3 = {}
    function spawnVehicle()
    	if veh3[source] and isElement( veh3[source] ) then destroyElement(veh3[source])
    		veh3[source] = nil
    	end     
        veh3[source] = createVehicle(523, 1586.75207, -1671.39477, 6.61896)
        setElementInterior(spawnVehicle,0)
        warpPedIntoVehicle(source, veh3[source])

     

×
×
  • Create New...