mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Added Inventory Searching
This commit is contained in:
65
Addons/Admin/inventory-search.lua
Normal file
65
Addons/Admin/inventory-search.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
|
||||
-- removed from none admin ranks, no further action
|
||||
local low_items = {
|
||||
'loader',
|
||||
'fast-loader',
|
||||
'express-loader',
|
||||
'small-plane',
|
||||
'player-port',
|
||||
'coin'
|
||||
}
|
||||
|
||||
-- removed for admin and non-admin ranks, gives warnings to non-admins
|
||||
local med_items = {
|
||||
'railgun',
|
||||
'railgun-dart'
|
||||
}
|
||||
|
||||
-- temp-ban for any rank, this is a very hard enforcement, admin ranks lose rank
|
||||
local high_items = {
|
||||
'electric-energy-interface',
|
||||
'infinity-chest'
|
||||
}
|
||||
|
||||
local inventorys = {
|
||||
defines.inventory.player_main,
|
||||
defines.inventory.player_quickbar,
|
||||
defines.inventory.player_trash
|
||||
}
|
||||
|
||||
local _root_tree = {low_items=low_items,med_items=med_items,high_items=high_items}
|
||||
|
||||
local function take_action(player,item_name,category)
|
||||
if category == 'low_items' then player_return({'inventory-search.low',item_name})
|
||||
elseif category == 'med_items' then player_return({'inventory-search.med',item_name}) Admin.give_warning(player,'<server>','Found A Banned Item',5)
|
||||
elseif category == 'high_items' then player_return({'inventory-search.high',item_name}) Admin.temp_ban(player,'<server>','Found A Banned Item')
|
||||
else return end
|
||||
end
|
||||
|
||||
local function search_player(player)
|
||||
for category,items in pairs(_root_tree) do
|
||||
for _,_inventory in pairs(inventorys) do
|
||||
local inventory = player.get_inventory(_inventory)
|
||||
for _,item in pairs(items) do
|
||||
local found = inventory.remove(item)
|
||||
if found > 0 then take_action(player,item,category) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_tick,function(event)
|
||||
if not (game.tick%3600) then return end
|
||||
local players = game.connected_players
|
||||
local player = players[math.random(#players)]
|
||||
search_player(player)
|
||||
end)
|
||||
@@ -23,6 +23,7 @@ require('Admin/reports') -- this adds onto Admin/admin, adds report command and
|
||||
require('Admin/discord')
|
||||
require('Admin/auto-message')
|
||||
require('Admin/tree-decon')
|
||||
require('Admin/inventory-search')
|
||||
|
||||
-- commands dir
|
||||
require('Commands/cheat-mode')
|
||||
|
||||
4
locale/en/inventory-search.cfg
Normal file
4
locale/en/inventory-search.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[inventory-search]
|
||||
low=Your Inventory Was Search And __1__ was removed.
|
||||
med=Your Inventory Was Search And __1__ was removed, you have been given a warning.
|
||||
high=Your Inventory Was Search And __1__ was found, this is not allowed AT ALL, your inventory has been moved to spawn.
|
||||
Reference in New Issue
Block a user