ESX

AddPlayerMethod Function

  1. Open "es_extended\server\functions.lua" file

  2. Add the following code to the bottom or top of the file

function ESX.AddPlayerMethod(ids, methodName, handler)
    local idType = type(ids)
    if idType == 'number' then
        ESX.Players[ids][methodName] = handler
    elseif idType == 'table' and table.type(ids) == 'array' then
        for i = 1, #ids do
            ESX.AddPlayerMethod(ids[i], methodName, handler)
        end
    end
end

Edit ESX.UseItem Function

  1. Open "es_extended\server\functions.lua" file

  2. Find "ESX.UseItem(source, item, ...)" function

  3. Replace with the following code function

function ESX.UseItem(source, item, ...)
    local itemCallback = Core.UsableItemsCallbacks[item]

    if itemCallback then
        local success, result = pcall(itemCallback, source, item, ...)

        if not success then
            return result and print(result) or
            print(('[^3WARNING^7] An error occured when using item ^5"%s"^7! This was not caused by ESX.'):format(item))
        end
    end
end

SetPlayerItems and SetPlayerClotheItems

  1. Open "es_extended\server\classes\player.lua" file

  2. Add above return self at the bottom of the file

function self.SetPlayerItems(items)
    self.items = items
    local stateBag = Player(self.source).state
    stateBag:set("items", self.items, true)
end

function self.SetPlayerClotheItems(clotheItems)
    self.clotheItems = clotheItems
    local stateBag = Player(self.source).state
    stateBag:set("clotheItems", self.clotheItems, true)
end

Item List

  1. Enter the "es_extended" folder

  2. download the following item list and put it in the es_extended main directory

  1. Open "es_extended\fxmanifest.lua" file

  2. Add at the bottom of server_scripts and client_scripts

"items.lua"

Last updated