-- Restrict INF parameters with IPs (I4 / I6) to operators. local base = _G module('restrict-ips') base.require('luadchpp') local adchpp = base.luadchpp base.assert(base['access'], 'access.lua must be loaded and running before restrict-ips.lua') local access = base.access base.assert(access['op'], 'access.op.lua must be loaded and running before restrict-ips.lua') local cm = adchpp.getCM() local function handleSignalSend(entity, cmd) -- This only applies to non-operators. if entity and access.is_op(entity) then return true -- Let the message through. end if cmd:getCommand() == adchpp.AdcCommand_CMD_INF then -- Take out I4 / I6 when present. cmd:delParam('I4', 1) cmd:delParam('I6', 1) end return true -- Let the message through. end -- Attach to the "signalSend" event handler. Adapted from the example.lua script. restrict_ips_signal_send = cm:signalReceive():connect(function(entity, cmd, ok) local res = (function(entity, cmd, ok) -- Skip messages that have been handled and deemed as discardable by others. if not ok then return ok end -- Process signalSend here. -- Return true to let the command be dispatched, false to block it. return handleSignalSend(entity, cmd) end)(entity, cmd, ok) if not res then cmd:setPriority(adchpp.AdcCommand_PRIORITY_IGNORE) end return res end)