Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --PIM struct: Holds data about a PIM
- --Key: General direction of which side the PIM is located
- --Value: Must be the following: north, south, east, west, up or down
- local pimStructs = {
- pim0 = {
- loc = "left",
- depot = "down"
- },
- pim1 = {
- loc = "back",
- depot = "down"
- }
- }
- local pims = {}
- local ignoreWhitelist = false --Disables the whitelist entirely when true
- local whitelist = { --People who won't get pwned
- "abc123mewot",
- "person", "person",
- "person",
- "person", "person"}
- for k, v in pairs(pimStructs) do
- v.pim = peripheral.wrap(v.loc)
- if v.pim == nil then
- v.enabled = false
- print("Pim id: " .. k .. " is not connected!")
- else v.enabled = true end
- end
- --Returns true if the inventory on the PIM is of an enemy origin (Not "pim" or not on the whitelist)
- function isNameEnemy(name)
- if name == "pim" then return false end --Meaning nobody is on the PIM
- if ignoreWhitelist then return true end
- for k, v in pairs(whitelist) do
- if name == v then return false end
- end
- return true
- end
- --Clears the inventory of the person on the PIM
- function clearInventory(pimStruct)
- local c = pimStruct.pim.getInventorySize()
- for i=1, c do pimStruct.pim.pushItem(pimStruct.depot, i) end
- end
- while true do
- for k, v in pairs(pimStructs) do
- if v.enabled then
- local pim = v.pim
- local invName = pim.getInventoryName()
- if isNameEnemy(invName) then
- print("Clearing inventory of " .. invName)
- clearInventory(v)
- os.exit()
- end
- end
- end
- sleep(0.1)
- end
Add Comment
Please, Sign In to add comment