Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setClipboardText(s) #2922

Merged
merged 12 commits into from
Dec 11, 2023
3 changes: 3 additions & 0 deletions lua/entities/gmod_wire_expression2/core/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
if not IsValid(ply) then return end
if not checkDelay(ply) then return end

local i = 1

Check warning on line 318 in lua/entities/gmod_wire_expression2/core/debug.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: i
for i,tp in ipairs(typeids) do
if printColor_typeids[tp] then
vararg[i] = printColor_typeids[tp](vararg[i])
Expand Down Expand Up @@ -354,7 +354,7 @@

local send_array = {}

local i = 1

Check warning on line 357 in lua/entities/gmod_wire_expression2/core/debug.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: i
for i,tp in ipairs_map(arr,type) do
if printColor_types[tp] then
send_array[i] = printColor_types[tp](arr[i])
Expand Down Expand Up @@ -420,9 +420,12 @@
util.AddNetworkString( "wire_expression2_set_clipboard_text" )
local clipboard_character_limit = CreateConVar("wire_expression2_clipboard_character_limit", 512, FCVAR_ARCHIVE, "Maximum character that can be copied into a players clipboard", 0, 65532)
local clipboard_cooldown = CreateConVar("wire_expression2_clipboard_cooldown", 1, FCVAR_ARCHIVE, "Cooldown for setClipboardText in seconds", 0, nil)
Vurv78 marked this conversation as resolved.
Show resolved Hide resolved
local clipboard_allow_toggle = CreateConVar("wire_expression2_clipboard_allow", 0, FCVAR_ARCHIVE, "Cooldown for setClipboardText in seconds", 0, 1)

__e2setcost(100)
e2function void setClipboardText(string text)
if clipboard_allow_toggle:GetInt() == 0 then return self:throw("setClipboardText is disabled by this server", nil) end
Sandalot marked this conversation as resolved.
Show resolved Hide resolved
Vurv78 marked this conversation as resolved.
Show resolved Hide resolved

local timerid = "wire_expression2_clipboard_cooldown_" .. self.entity:EntIndex()
if not timer.Exists(timerid) then
if #text > clipboard_character_limit:GetInt() then
Expand Down
Loading