From d5fb2cce5ca55222c54ff69e1bb6c4b9023c99d1 Mon Sep 17 00:00:00 2001 From: StrawWagen <64710817+StrawWagen@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:47:19 -0700 Subject: [PATCH] port ++ and -- pac proxy operators MVQ requests this. Just a drag and drop from capsadmin pac3 Tested, works! --- lua/pac3/core/server/event.lua | 52 +++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/lua/pac3/core/server/event.lua b/lua/pac3/core/server/event.lua index 84cc0db15..66188b8bf 100644 --- a/lua/pac3/core/server/event.lua +++ b/lua/pac3/core/server/event.lua @@ -66,12 +66,56 @@ end) -- proxy concommand.Add("pac_proxy", function(ply, _, args) + str = args[1] + if args[1] == nil then + ply:PrintMessage(HUD_PRINTCONSOLE, "\npac_proxy needs at least two arguments.\nname\nnumber, or a series of numbers for a vector. increment notation is available, such as ++1 or --1.\ne.g. pac_proxy myvector 1 2 3\ne.g. pac_proxy value ++5") + return + end + + if ply:IsValid() then + ply.pac_proxy_events = ply.pac_proxy_events or {} + end + local x + local y + local z + if ply.pac_proxy_events[str] ~= nil then + if args[2] then + if string.sub(args[2],1,2) == "++" or string.sub(args[2],1,2) == "--" then + x = ply.pac_proxy_events[str].x + tonumber(string.sub(args[2],2,#args[2])) + else x = tonumber(args[2]) or ply.pac_proxy_events[str].x or 0 end + end + + if args[3] then + if string.sub(args[3],1,2) == "++" or string.sub(args[3],1,2) == "--" then + y = ply.pac_proxy_events[str].y + tonumber(string.sub(args[3],2,#args[3])) + else y = tonumber(args[3]) or ply.pac_proxy_events[str].y or 0 end + end + if not args[3] then y = 0 end + + if args[4] then + if string.sub(args[4],1,2) == "++" or string.sub(args[4],1,2) == "--" then + z = ply.pac_proxy_events[str].z + tonumber(string.sub(args[4],2,#args[4])) + else z = tonumber(args[4]) or ply.pac_proxy_events[str].z or 0 end + end + if not args[4] then z = 0 end + else + x = tonumber(args[2]) or 0 + y = tonumber(args[3]) or 0 + z = tonumber(args[4]) or 0 + end + ply.pac_proxy_events[str] = {name = str, x = x, y = y, z = z} + net.Start("pac_proxy", true) net.WriteEntity(ply) net.WriteString(args[1]) - net.WriteFloat(tonumber(args[2]) or 0) - net.WriteFloat(tonumber(args[3]) or 0) - net.WriteFloat(tonumber(args[4]) or 0) + net.WriteFloat(x or 0) + net.WriteFloat(y or 0) + net.WriteFloat(z or 0) net.Broadcast() -end) +end, nil, +[[pac_proxy sets the number of a command function in a proxy. it is typically accessed as command(\"value\") needs at least two arguments. +name: any name, preferably without spaces +numbers: a number, or a series of numbers for a vector. increment notation is available, such as ++1 and --1. +e.g. pac_proxy myvector 1 2 3 +e.g. pac_proxy value ++5]]) \ No newline at end of file