generated from Rushmore75/rust_server_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity_detector.lua
34 lines (30 loc) · 895 Bytes
/
entity_detector.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local function getSensors()
local proxy = {}
local component = require("component")
local scan_index = 0
-- loop thru all components and find entity detectors
for id, name in component.list() do
if (name == "os_entdetector") then
proxy[scan_index] = component.proxy(id)
scan_index = scan_index + 1
end
end
return proxy, scan_index
end
local function scan()
local proxy, count = getSensors()
local internet = require("internet")
print("Scanning from " .. count .. " locations")
while (true) do
for index = 0, count-1 do
local found = proxy[index].scanPlayers(64)
for _, player in ipairs(found) do
internet.request("https://friendlyfire.oliveratkinson.net/api/logplayer", tostring(player.name), {}, "POST")
print(index .. " found: " .. player.name)
end
end
os.sleep(15) -- 10 crashes intermitantaly
end
end
-- start
scan()