Advertisement
Urik_Kane

jcmp_clear_inventory

Apr 30th, 2021 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. --disclaimer: urik: this is not mine, copied it from jc-mp forums ages ago
  2.  
  3. function OnPlayerChat(args)
  4.     local inventory = args.player:GetInventory()
  5.         if args.text == "/clearinv" then
  6.             for k,v in pairs(inventory) do
  7.             print(k,v)
  8.             end
  9.             if table.count(inventory) == 0 then
  10.                 Chat:Send(args.player, "You aren't carrying any weapons", Color.Red)
  11.             else
  12.                 args.player:ClearInventory()
  13.                 Chat:Send(args.player, "Your inventory has been cleared", Color.Lime)
  14.             end
  15.         end
  16. end
  17.  
  18. Events:Subscribe("PlayerChat", OnPlayerChat)
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement