Explain to me how he is supposed to begin? Quit being such a jerk. I always see you around not doing anything to help but just saying some fucked up shit.
Here you go:
ENT.Type = "ai" -- Type of entity
ENT.Base = "base_ai" -- Entity base
ENT.PrintName = "Medic NPC" -- Name of the entity
ENT.Author = "Tupac Shakur" -- Optional
ENT.Purpose = "Heals player" -- Optional. Description of the entity
ENT.AutomaticFrameAdvance = true --Toggles automatic frame advancing for animated sequences on an entity. ( So the NPC can seem realistic )
ENT.Spawnable = true -- Spawnable?
ENT.AdminSpawnable = false
function ENT:Initialize() -- What happens on the entity spawn
self:SetModel( "models/Kleiner.mdl" ) -- Change to the model you want the NPC to be
self:SetHullType( HULL_HUMAN )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( CAP_ANIMATEDFACE )
self:SetUseType( SIMPLE_USE ) -- This is to prevent the menu opening so many times when e is hit.
util.AddNetworkString( "MedNPCMenuOpen" ) -- This is the string of the net message being sent around.
function ENT:AcceptInput( name, activator, caller ) -- Accept the input, and store the information in name, activator, caller
if name == "Use" and caller:IsPlayer() then -- if the player hit use then
net.Start("MedNPCMenuOpen") -- Start the network string
net.Send(caller) -- Send this to the client that hit "use" on the npc
net.Receive( "MedNPCMenuOpen", function()
local Background = vgui.Create( "DFrame" )
Background:SetSize( 500, 500 )
Useful things to look into
https://wiki.garrysmod.com/page/Derma_Basic_Guide This is a great derma guide, for your menu!
https://wiki.garrysmod.com/page/Net_Library_Usage This can be used to make it so that when a button is clicked, send a message to the server to set the players health.
Sorry if I suck at explaining, but I recommend you play around with the code and learn.
And mikey, when I say “fucked up shit” I’m referring to posts other than this.