Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions lua/entities/gmod_wire_expression2/core/cl_player.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
local function SendFriendStatus()
local friends = {}
for _,ply in ipairs(player.GetHumans()) do

for _, ply in ipairs(player.GetHumans()) do
if ply:GetFriendStatus() == "friend" then
table.insert(friends, ply:EntIndex())
end
end

RunConsoleCommand("wire_expression2_friend_status", table.concat(friends, ","))
end

if CanRunConsoleCommand() then
SendFriendStatus()
end

hook.Add("OnEntityCreated", "wire_expression2_extension_player", function(ent)
if not IsValid(ent) then return end
if not ent:IsPlayer() then return end

SendFriendStatus()
end)

-- isTyping
hook.Add("StartChat","E2_IsTyping_Start",function() RunConsoleCommand("E2_StartChat") end)
hook.Add("FinishChat","E2_IsTyping_Finish",function() RunConsoleCommand("E2_FinishChat") end)
hook.Add("ShutDown", "E2_FinishChat_Remove", function()
hook.Remove("FinishChat", "E2_IsTyping_Finish")
end)
11 changes: 3 additions & 8 deletions lua/entities/gmod_wire_expression2/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,10 @@
self.entity.Use = nil
end)


-- isTyping
local plys = {}
concommand.Add("E2_StartChat",function(ply,cmd,args) plys[ply] = true end)
concommand.Add("E2_FinishChat",function(ply,cmd,args) plys[ply] = nil end)
hook.Add("PlayerDisconnected","E2_istyping",function(ply) plys[ply] = nil end)

e2function number entity:isTyping()
return plys[this] and 1 or 0
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
if not this:IsPlayer() then return self:throw("Expected a Player but got Entity", 0) end
return this:IsTyping() and 1 or 0
end

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -547,7 +542,7 @@

else

e2function array entity:friends()

Check warning on line 545 in lua/entities/gmod_wire_expression2/core/player.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: this
return {}
end

Expand Down
Loading