Help

Hello,

How can i make it so when a player press E on another player a menu pops up?
It would also need to say “press E to find out bla bla bla”

Thanks
:stuck_out_tongue:

For the menu popping up on pressing E I would personally use https://wiki.garrysmod.com/page/GM/PlayerUse and detect if the entity that the player is pressing E on is a player and check the distance between the two entities. You will have to use the NET library to be able to open up the menu client-side. https://wiki.garrysmod.com/page/Net_Library_Usage.
For displaying the menu you can use Derma https://wiki.garrysmod.com/page/Derma_Basic_Guide there is probably an easier way, I’m fairly new to coding.

Could you code out the code then for a player to press e on a player so a menu pops up?

I won’t spoon feed you the code. I will help you through it if you attempt it. If you have never coded before this is a post that contains resources to begin programming. http://forum.facepunch.com/showthread.php?t=1541007

so what would i add here to make this a player when you press E

include(“shared.lua”)
AddCSLuaFile(“init.lua”)

net.Receive(“DrawTheMenu”, function()

if 

local SelectionPanel= vgui.Create("DFrame")
    SelectionPanel:SetSize(1000,720)
    SelectionPanel:SetVisible(true)
    SelectionPanel:SetDraggable(false)
    SelectionPanel:MakePopup()
    SelectionPanel:Center()
    SelectionPanel.Paint = function(s, w, h)

    draw.RoundedBox(5,0,0,w, h,Color(0,0,0))

    draw.RoundedBox(5,2,2,w-4, h-4,Color(50,50,50))

end

local Choice= vgui.Create("DListView")
Choice:SetParent(SelectionPanel)
Choice:SetPos(25, 50)
Choice:SetSize(450, 625)
Choice:SetMultiSelect(false)
Choice:SetVisible(true)
Choice:AddColumn("Player") -- Add column
Choice:AddColumn("Number Of Kills")
Choice.Paint = function( s, w, h)

draw.RoundedBox(5,0,0,w,h,Color(100,100,100))

end
for k,v in pairs(player.GetAll()) do
Choice:AddLine(v:Nick(),v:Frags())
end

Use hook.Add https://wiki.garrysmod.com/page/hook/Add and hook into the function https://wiki.garrysmod.com/page/GM/PlayerUse. What is the net message “DrawTheMenu” does that contain any code.

No it doesn’t

Okay, create the hook and function. Then when you get that completed. Check if the player InValid and if the entity is a player.

Doesn’t work.

Ok.

How can i do this? I need help.

*Hey guys, i’ve tried this, but it seems that the code it’s not being triggered, can someone take a sight about whats going on?

pastes code*

But you’re like

Doesn’t work

What kind of help do you want

You said it doesn’t work, unlike you may think we here can’t read minds. It’d be helpful if you could post the code you tried and any errors you got.

I did post the code i tried… That was me that posted the code, I said what do i add.

[editline]3rd December 2016[/editline]

Imma just close it.