GithubHelp home page GithubHelp logo

esx_weaponsync's Introduction

Copyright (c) 2019 Marcus Olovsson https://github.com/Arood May not be redistributed without permission.

This script replaces the weapon loadout system in FiveM and ESX. Instead of handling the loadout as its own thing, all weapons are stored as items in the player's inventory. Ammo is also stored as items.

Before using this, you should modify ESX to allow "silent" removal of inventory items, or the players will be spammed when they are shooting. In my version of ESX, I modified the following in es_extended/client/main.lua:

RegisterNetEvent('esx:removeInventoryItem')
AddEventHandler('esx:removeInventoryItem', function(item, count, silent)

  for i=1, #ESX.PlayerData.inventory, 1 do
    if ESX.PlayerData.inventory[i].name == item.name then
      ESX.PlayerData.inventory[i] = item
    end
  end

  if not silent then
    ESX.UI.ShowInventoryItemNotification(false, item, count)
  end

  if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
    ESX.ShowInventory()
  end

end)

Secondly, you must add all weapons you would like to use in your item database. See the attached items.sql for an example.

Lastly, you must modify ESX and all other resources that handles the weapon loadout to use items instead. Otherwise things will f up.

esx_weaponsync's People

Contributors

arood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.