📖
AdminPlus Development Documentation
  • AdminPlus Documentation
  • Support
  • 📍Information
    • You lack the required entitlement.
  • 💰Paid Scripts
    • [QB/ESX] Admin Jail [PAID]
    • [QB/ESX] Wigs & Bundles [PAID]
    • [QB/ESX] Bus Travel [PAID]
    • [QB/ESX] Business Promotion [PAID]
    • [QB/QBOX/ESX] Discord Presence [PAID]
    • [QB/ESX] Character Attributes [PAID]
    • [QB/ESX] Server Essentials [PAID]
    • [QB/ESX] Typing Indicator [PAID]
    • [QB/ESX] Anti-Fall [FREE]
    • ESX | Faction Chat [PAID]
    • ESX | Gym [PAID]
    • [STANDALONE] 65+ Car Pack [PAID]
  • 🆓Free Scripts
    • Anti Collision
    • Lost Items
    • Sell Drugs
    • Med System
Powered by GitBook
On this page
  1. Free Scripts

Lost Items

PreviousAnti CollisionNextSell Drugs

Last updated 1 year ago

This script allows you to type a command where after you die, once you type the command it will display what items you lost. (incase for voided scenes).

  • List what items you lost after dying incase you're needing to be refunded by Staff.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
  • This resource is drag/drop. You will just need to add the following inside of your server.cfg after you've dropped the file into your resources.

ensure adminplus-lostitems

Feel free to customize the command name, on line 24.

RegisterCommand('lostitems', function(source, args)
  local targetId = tonumber(args[1])
  local xPlayer = ESX.GetPlayerFromId(source)
  
  if targetId then
    -- Admin is trying to view someone else's lost items
    if xPlayer.getGroup() == 'admin' then
      local xTarget = ESX.GetPlayerFromId(targetId)
      if not xTarget then
        print('Player not found.')
        return
      end

      local characterLicense = xTarget.identifier

      if playerInventory[characterLicense] then
        local inventory = playerInventory[characterLicense]

        local itemList = ''
        for _, item in ipairs(inventory) do
          itemList = itemList .. item.name .. ': ' .. item.count .. ', '
        end

        local characterName = xTarget.getName() -- Get the character name
        local message = 'Lost Items for ' .. characterName .. ': ' .. string.sub(itemList, 1, -3) -- Remove the last comma and space

        -- Trigger client event to display the chat message
        TriggerClientEvent('showLostItems', source, message)

      else
        print('No lost items found.')
      end
    else
      print('Insufficient permission to view other player\'s lost items.')
    end
  else
    -- User is trying to view their own lost items
    local characterLicense = xPlayer.identifier

    if playerInventory[characterLicense] then
      local inventory = playerInventory[characterLicense]

      local itemList = ''
      for _, item in ipairs(inventory) do
        itemList = itemList .. item.name .. ': ' .. item.count .. ', '
      end

      local characterName = xPlayer.getName() -- Get the character name
      local message = 'Lost Items for ' .. characterName .. ': ' .. string.sub(itemList, 1, -3) -- Remove the last comma and space

      -- Trigger client event to display the chat message
      TriggerClientEvent('showLostItems', source, message)
    else
      print('No lost items found.')
    end
  end
end, true)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
V 1.0.0
  • Original Release

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
🆓
https://github.com/itsAdminPlus/adminplus-anticollision