[Release][ESX] Illegal Warehouses Script

esx_illegalWarehouses

Hi y’all ! I wanted to share a script that I made a couple of days ago for a server on which I’m working on and that players requested a lot. Hope you’ll enjoy !

Description : esx_illegalWarehouses is a script that adds Illegal warehouses that can be rented to gangs, illegal organizations or even certain jobs and that can be lockpicked by police forces as long as they have lockpicks.

Downloading :

  • Go to this LINK (github)
  • Download the latest release or clone the project

[FEATURES]

  • Warehouses management from any menu via an export
    • View the current state of the warehouses : Warehouse Name | Jobname rented to | Gang Name rented to
    • Rent a warehouse
    • Reset the warehouse ownership
  • Private warehouses: each warehouse can only be opened by the gang/org/job it has been rented to
  • LSPD OPEN UP !! : each warehouse can be raided by the LSPD as long as they have lockpicks. When raiding a warehouse, a notification will be sent alerting every player of the raid but you will have to guess which warehouse is being raided !
  • Easily add or remove warehouses : Just add or remove the Warehouses from Config.lua, add or remove the needed info in the database and you are done !
  • Easily add or remove gangs, orgs, jobs : Just add or remove the jobs in Config.lua

[REQUIREMENTS]


[INSTALLATION]

  1. CD in your resources/[folderWhereYouWantTheScriptToBe]
  2. Clone the repository
git clone https://github.com/BenoursonJ/esx_illegalWarehouses esx_illegalWarehouses
    • Warehouses and Inventories : Import illegalWarehouses_en.sql or illegalWarehouses_fr.sql according to your language in your database
  1. Add into a menu where you want to access the management panel from (example used is Mafia Job, full menu example at the end of this file):

exports["esx_illegalWarehouses"]:OpenWarehousesMenu()
  1. Add this in your server.cfg :
ensure esx_illegalWarehouses

[CONFIG.LUA EXPLAINED]

  • Config.DrawDistance | Maximum distance from which the markers can be seen

  • Config.Locale | Text language (currently supported: fr and en)

  • Config.PoliceCond | Percentage of failure (default: 75%)

  • Config.Policejob | Name of the job that is able to lockpick warehouses

  • Config.Zones | Array listing the warehouses, structure is as follow :

    • StorageName (ex: Storage1) | Marker name, must be the same than as defined in the DB
      • Position | Marker position
      • Marker Size | Marker size
      • Marker Color | Marker colour
      • Display Name | Marker Display Name
      • Type | Marker Type (0 = hidden | 1 = displayed)
  • Config.Gangs | List of gangs, organizations or jobs that can use the illegal warehouses system

    • Gangname (ex: ballas) | Gang name, must be the same as the one used to set a job (ex: /setjob 1 ballas 3)
      • Name | Display named that is used when a warehouse is rented. When opening the warehouses menu, you will see this variable and not the gangname

[TUTORIALS]

In need of info and troubleshooting tips ?
Head to the Wiki => HERE


[MENU EXAMPLE]

function OpenCloakroomMenu()
  local elements = {
    {label = _U('citizen_wear'), value = 'citizen_wear'},
    {label = "Gestion Entrepôts", value = 'mafia_storagemanage'},
  }
  ESX.UI.Menu.CloseAll()
    ESX.UI.Menu.Open(
      'default', GetCurrentResourceName(), 'cloakroom',
      {
        title    = _U('cloakroom'),
        align    = 'top-left',
        elements = elements,
        },
        function(data, menu)
      menu.close()
      if data.current.value == 'mafia_storagemanage' and ((PlayerData.job ~= nil and PlayerData.job.name == 'mafia' and PlayerData.job.grade_name == 'boss') or (PlayerData.job2 ~= nil and PlayerData.job2.name == 'mafia' and PlayerData.job2.grade_name == 'boss')) then
        exports["esx_illegalWarehouses"]:OpenWarehousesMenu()
      else
        TriggerEvent('esx:showNotification', "Vous devez être Parrain pour ouvrir ce menu")
      end

      if data.current.value == 'citizen_wear' then
        ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
          local model = nil
          if skin.sex == 0 then
            model = GetHashKey("mp_m_freemode_01")
          else
            model = GetHashKey("mp_f_freemode_01")
          end
          RequestModel(model)
          while not HasModelLoaded(model) do
            RequestModel(model)
            Citizen.Wait(1)
          end
          SetPlayerModel(PlayerId(), model)
          SetModelAsNoLongerNeeded(model)
          TriggerEvent('skinchanger:loadSkin', skin)
          TriggerEvent('esx:restoreLoadout')
        end)
      end
   CurrentAction     = 'menu_cloakroom'
      CurrentActionMsg  = _U('open_cloackroom')
      CurrentActionData = {}
    end,
    function(data, menu)
      menu.close()
      CurrentAction     = 'menu_cloakroom'
      CurrentActionMsg  = _U('open_cloackroom')
      CurrentActionData = {}
    end)
end

Screenshots :

5 Likes

Good work! A preview will help a lot, pics or video.

1 Like

Thanks ! Just updated the topic with some screenshots.
Honestly there’s not much visually to it, it’s more for the mechanics/gameplay than anything else.

1 Like

The marker will teleport you into an IPL? or the warehouse menu its outside?

1 Like

No IPL or else, the marker displays the menu outside, just as shown on the last screen. If you wanted to, you could integrate the marker inside an IPL or an MLO by inputing the right coordinates (same idea as esx_properties and menues inside IPL)

1 Like

I’m confused, how do you set a warehouse to a gang job? Not seeing it in any of the script files or a command for it

Sorry if the process seems vague.

  • You need to set up the access to the warehouse management menu (point number 4 in the [INSTALLATION] part of the topic)
  • If the job isn’t in the config.lua file, add the job inside it as per the instructions HERE
  • Access the warehouse management menu (that can be seen on the second screen posted in the maint topic) then clic on the “Rent” button corresponding to the warehouse you want to rent, then enter the jobname in the menu that just opened.

Videos are coming soon !

hello nice realease.
i get all working but i have some error
if i put a item in and want to put it out it come this error

1 Like

Hi, thanks !
Did you restart the server after executing the sql queries in illegalWarehouses_en.sql or illegalWarehouses_fr.sql ?
It adds the fact that the warehouses inventories exist inside the following tables :

  • addon_inventory
  • datastore

For the corresponding entries to be generated in

  • addon_inventory_items
  • datastore_data

You need to restart your server after executing the aforementioned sql queries. If it still doesn’t work, after depositing items and weapons, search inside :

  • addon_inventory_items
  • datastore_data

For lines having “storage” in them ( SELECT * FROM addon_inventory_items WHERE inventory_name LIKE '%storage%') and (SELECT * FROM datastore_data WHERE name` LIKE ‘%storage%’)

I have a problem and whatever work I do, it tells me that I do not have access to this container

Can you please provide me with errors if you get any (via F8 menu or server log) as well as your config.lua file ?
Did you assign a warehouse to a job ? If yes, can you check in the db, table illegal_warehouses that there is the jobname assigned to the right warehouse ?

I have no error in f8 and I have created one more mafia

Could you PM me and provide me:

  • Screen of your config.lua
  • Screen of the illegal_warehouses table

Thanks

Hey! :smiley:
Nice release, but can i make a remake of menu and reupload?

Kind regards
TozyHD

Hi,
Thanks, you may modify it and redistribute it as long as it complies with the GPL-3.0 License :wink:

Hi !
To be able to access the management interface, you have to add a menu item to a menu.
If you look at a main.lua ou client.lua in a job’s client folder, you will often find a OpenMenu() function.
You will find at the beginning of this menu function a line with ESX.UI.MENU.OPEN( …
And below you will find lines containing by example

"{label = _U('gps'),    	value = 'menumamas_gps'},"

These are menu items.
Under this line, you will insert another menu item as you desire. By example:

 "{label = "Warehouse Menu",    	value = 'warehouse_menu'},"

If you go a bit further down, you will find “if” functions such as:

if data.current.value == 'menumamas_gps_vraisin' then
  SetNewWaypoint( 249.4, -50.5, 69.9 )|
  local source = GetPlayerServerId();|
  ESX.ShowNotification("~b~Destination ajouté au GPS !")|
end

Under one of these if, add :

if data.current.value == 'warehouse_menu' then
  exports["esx_illegalWarehouses"]:OpenWarehousesMenu()
end

Then, if you access the right menu in game, you should be able to access the warehouse management interface

Could you PM me with your client file ? It will be easier to see what is going wrong.
Either the if/else condition is not done correctly or the export function cannot be called. I haven’t tested it with a F6/F7 etc… menu but it should not be a problem.

Updated the Wiki with a complete multi-step tutorial explaining the installation => https://github.com/BenoursonJ/esx_illegalWarehouses/wiki

I made a pull request, you can check it out if you want. Optimization features.

1 Like

Thanks for the pull request, replied to it, your changes greatly optimize the time usage when the user is far from a marker !

1 Like