So I've been trying to make an addon for muting an individual player in-game with a menu.
But I am having trouble with networking the menu to make it so that on a command said in chat it opens a menu.
cl_init
[code]
net.Receive("menu", function(len)
local base = vgui.Create("DFrame")
base:SetPos(ScrH()/2, ScrW()/2)
base:SetSize(200,300)
base:SetTitle("Players")
base:SetDraggable(true)
base:ShowCloseButton(true)
base:MakePopup()
local p = vgui.Create("DListView")
p:SetMultiSelect( false)
p:AddColumn( "Players" )
p:AddColumn( "SteamID" )
for k,v in pairs(player.GetAll()) do
p:AddLine(v:Nick(),v:SteamID())
end
end)
[/code]
init.lua
[code]
util.AddNetworkString("menu")
function chatCommand(ply, text, public)
if string.sub(text, 1,4) == "/mute" then
net.Start("menu")
net.Send(ply)
end
end
hook.Add( "PlayerSay", "chatCommand", chatCommand );
[/code]
Sorry, you need to Log In to post a reply to this thread.