Its done by a inventory script, one inventory script that does this is qb-inventory however its only for the framework QB-Core although you could probably convert to ESX.