I have been trying to some stuff for my gamemode and I started making something. I made a button and when you press it, a optionsmenu pops up. The options are all the players alive and in team 2. Now how would I give the person I clicked the name of and the local player a pistol? This is my code atm:
local function lastre()
local Menu = vgui.Create("DFrame")
Menu:SetPos(ScrW() / 2 - 200, ScrH() / 2 - 150)
Menu:SetSize(400, 300)
Menu:SetTitle("My Menu")
Menu:SetDraggable(false)
Menu:ShowCloseButton(true)
Menu:MakePopup()
local Butt = Menu:Add("DButton",Menu)
Butt:SetText( "Test" )
Butt:SetPos(50, 90 )
Butt:SetSize( 300, 100 )
Butt.DoClick = function( ply )
local MenuButtonOptions = DermaMenu()
for k,v in pairs(team.GetPlayers(2)) do
if v:Alive() then
MenuButtonOptions:AddOption(v:Nick(), function()
v:Give("weapon_deagle")
LocalPlayer():Give("weapon_deagle")
end)
end
end
MenuButtonOptions:Open()
end
end
Give obviously doesn’t work because it is clientside and needs to be serverside as far as I know. Also little second question. What function do I use to draw a kill feed/ Death notify?