[ESX]LRP-Palanca

https://www.youtube.com/watch?v=U5q32Qe6R-w
It is a small modification made by / added with @ShinxD
Hi,
A system of robbery of trunk with item.

Download

https://github.com/karenciita/LRP-Palanca

You must place this code anywhere in the client.

esx_inventoryhudtrunk/client.lua

 ----- START LRP-PALANCA  ----
 
function loadanimdict(dictname)
  if not HasAnimDictLoaded(dictname) then
    RequestAnimDict(dictname) 
    while not HasAnimDictLoaded(dictname) do 
      Citizen.Wait(1)
    end
  end
end

--animacion
RegisterNetEvent("abrirmaletero:animacion")
AddEventHandler("abrirmaletero:animacion",function()
animrobovaultcarro()
end)

function animrobovaultcarro()

  local anima = 'mini@drinking'      
  local lib2 =  "shots_player_c"
  local loopanimvault = true
  loadanimdict(anima)
              
    prop_name = prop_name or 'prop_ing_crowbar'

      local playerPed = PlayerPedId()
      local x,y,z = table.unpack(GetEntityCoords(playerPed))
      local prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
        
      local boneIndex = GetPedBoneIndex(playerPed,28422)

            AttachEntityToEntity(prop, playerPed, boneIndex, 0.10, 0.015, 0.001, 10.0, 175.0, 0.0, 1, 1, 0, 0, 2, 1)
             
              FreezeEntityPosition(playerPed, true)
              TaskPlayAnim(GetPlayerPed(-1),anima , lib2, 1.0, -1, -1, 10, 0, 0, 0, 0)

     Citizen.CreateThread(function()
        while loopanimvault do
          Citizen.Wait(0)
           if not IsEntityPlayingAnim(GetPlayerPed(-1),anima,lib2, 3) then
              TaskPlayAnim(GetPlayerPed(-1),anima , lib2, 1.0, -1, -1, 10, 0, 0, 0, 0)
             end
        end
      end)
            Citizen.Wait(10000)
            loopanimvault = false
            DeleteObject(prop)
            FreezeEntityPosition(playerPed, false)
            ClearPedTasksImmediately(playerPed)
end


-- contador que sale en el medio del cuerpo
RegisterNetEvent("abrirmaletero:contadorporcentaje")
AddEventHandler("abrirmaletero:contadorporcentaje",function()
contadorpalanca()
end)


function contadorpalanca()
 
Citizen.CreateThread(function()

            local abriendomaletero = true        
            local comienzodetiempo = GetGameTimer()
            local tiempo = 10000
  while abriendomaletero  do
     Citizen.Wait(0)

 local ped = PlayerPedId()
 local percentaje = (GetGameTimer() -comienzodetiempo) / tiempo * 100
 local x,y,z = table.unpack(GetEntityCoords(ped))
 
    
    DrawText3Ds({ x = x, y = y, z = z  }, " Abriendo Cerradura  "  .. math.ceil(percentaje) .. "%", 0.5)
      
        if percentaje >= 100 then

          abriendomaletero = false
          abrirmaleteroporitem()
          ClearPedTasksImmediately(ped)
        end
  end

end)
end



DrawText3Ds = function(coords, text, scale)
  local x,y,z = coords.x, coords.y, coords.z
  local onScreen, _x, _y = World3dToScreen2d(x, y, z)
  local pX, pY, pZ = table.unpack(GetGameplayCamCoords())

  SetTextScale(scale, scale)
  SetTextFont(4)
  SetTextProportional(1)
  SetTextEntry("STRING")
  SetTextCentre(1)
  SetTextColour(255, 255, 255, 215)

  AddTextComponentString(text)
  DrawText(_x, _y)

  local factor = (string.len(text)) / 380
  DrawRect(_x, _y + 0.0180, 0.060 + factor, 0.045, 41, 11, 41, 100)
end




--abrir maletero
RegisterNetEvent("abrirmaletero:abrirconpalanca")
AddEventHandler("abrirmaletero:abrirconpalanca",function()
abrirmaleteroporitem()
end)

function abrirmaleteroporitem()

  local playerPed = GetPlayerPed(-1)
  local coords = GetEntityCoords(playerPed)
  local vehicle = VehicleInFront()
  globalplate = GetVehicleNumberPlateText(vehicle)

  if not IsPedInAnyVehicle(playerPed) then
    myVeh = false
    local thisVeh = VehicleInFront()
    PlayerData = ESX.GetPlayerData()

    for i = 1, #vehiclePlate do
      local vPlate = all_trim(vehiclePlate[i].plate)
      local vFront = all_trim(GetVehicleNumberPlateText(thisVeh))
      --print('vPlate: ',vPlate)
      --print('vFront: ',vFront)
      --if vehiclePlate[i].plate == GetVehicleNumberPlateText(vehFront) then
      if vPlate == vFront then
        myVeh = true
      elseif lastChecked < GetGameTimer() - 60000 then
        TriggerServerEvent("esx_trunk_inventory:getOwnedVehicule")
        lastChecked = GetGameTimer()
        Wait(2000)
        for i = 1, #vehiclePlate do
          local vPlate = all_trim(vehiclePlate[i].plate)
          local vFront = all_trim(GetVehicleNumberPlateText(thisVeh))
          if vPlate == vFront then
            myVeh = true
          end
        end
      end
    end

      if globalplate ~= nil or globalplate ~= "" or globalplate ~= " " then
        CloseToVehicle = true
        local vehFront = VehicleInFront()
        local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
        local closecar = GetClosestVehicle(x, y, z, 4.0, 0, 71)

        if vehFront > 0 and closecar ~= nil and GetPedInVehicleSeat(closecar, -1) ~= GetPlayerPed(-1) then
          lastVehicle = vehFront
          local model = GetDisplayNameFromVehicleModel(GetEntityModel(closecar))
          local locked = GetVehicleDoorLockStatus(closecar)
          local class = GetVehicleClass(vehFront)
          ESX.UI.Menu.CloseAll()

          if ESX.UI.Menu.IsOpen("default", GetCurrentResourceName(), "inventory") then
            SetVehicleDoorShut(vehFront, 5, false)
          else
            if locked == 1 or class == 15 or class == 16 or class == 14 then
              SetVehicleDoorOpen(vehFront, 5, false, false)
              ESX.UI.Menu.CloseAll()

              if globalplate ~= nil or globalplate ~= "" or globalplate ~= " " then
                CloseToVehicle = true

                TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 8.0, 'abrircerradura', 0.1)
                Citizen.Wait(2800)
                OpenCoffreInventoryMenu(GetVehicleNumberPlateText(vehFront), Config.VehicleLimit[class], myVeh)
              end
            else
              exports.pNotify:SendNotification(
                {
                  text = _U("trunk_closed"),
                  type = "error",
                  timeout = 3000,
                  layout = "bottomCenter",
                  queue = "trunk"
                }
              )
            end
          end
        else
          exports.pNotify:SendNotification(
            {
              text = _U("no_veh_nearby"),
              type = "error",
              timeout = 3000,
              layout = "bottomCenter",
              queue = "trunk"
            }
          )
        end
        lastOpen = true
        GUI.Time = GetGameTimer()
      end
    else
      -- Not their vehicle
      exports.pNotify:SendNotification(
        {
          text = _U("nacho_veh"),
          type = "error",
          timeout = 3000,
          layout = "bottomCenter",
          queue = "trunk"
        }
      )
    end
end

 ----- STOP LRP-PALANCA  ----

Requirements

• es_extended
• esx_inventoryhud
• esx_inventoryhudtrunk

Here I leave the sound used in this script

interact-sound.rar (28.2 KB)

9 Likes

Sorry, we forgot to put the “item.sql” file in the github, we will edit the github in a few hours with the file.

at the moment use this code to create the item through the query.

INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES
	('palanca', 'Palanca', 1, 0, 1)
;

att-shinxd

otro bueno script dime donde usted conseguiu este inventario estoy a procura de uno como este hace meses

items.sql (112 Bytes)

when i try it’s just saying locked trunk and i have locked my car but not working anyway to fix this

Could you show me if you get an error in the console or F8?

No i dont get any errors

This is similar, since the one we have, is a modification of the original.
Also the developer himself removed it from the platform, it is because I attached this link which is very similar and good.

do you have the item in your hand?

Yes i have the item in my inventory

gracias pero yo necesito un inventario asi tan bueno perdoname por mi espanhol pero gracias por ayuda

yes but you have to use it when opening the trunk

not at all, when you need it.

when i drag it over to use it’s just saying trunk is locked

what do i do

Braa voooooo

The problem with the locked vehicle was fixed, it was also tested on a “localhost” by installing the script from 0 and it works correctly.

Remember to read everything.

@ArneBAR Ready and add the solution, is in "client.lua"

Thanks work now after i updated the script

Uau! Trabalho incrivel! Estou aprendendo a fazer algumas modificações dentro de uma base de teste que tenho, será que vocês poderiam me ajudar com alguns comandos básicos?

Este script no funciona con el HUD orginal de esx_menu_default ???
Solo funcina con el Inventory HUD?