Click E on prop opens derma

Is there a when clicking on a prop ( Example : models/props_lab/workspace002.mdl ) to open a derma screen?

You could make an entity, and use the built-in serverside ENT:Use() function. You can network it for clientside stuff like derma screens.

I’d recommend setting the use type to SIMPLE_USE as well

Cant get it to work…
Can you add me on steam? So you can help me privately
http://steamcommunity.com/id/J-avs/

The functions you gave above are for a self-made entity, you’ve to use the gamemode use hook.

GM:PlayerUse

check if its props_physics, and check if its the desired model, then send a net message to the user, opening the menu.

Perhaps I was doing something wrong but it doesn’t seem like you can USE on props_physics. (That or my game is broken?)

Are you running the code in singleplayer, or on a real server?

I’ve tried both (not an actual dedicated server but local server via gmod menu).

Anyways, only some props_physics can be picked up. For example, I can pick up “models/props_c17/canister_propane01a.mdl” but not “models/props_borealis/bluebarrel001.mdl”.

I’ve never actually thought about this, but now I’m curious. How/where is it decided for which props_physics you can pick up? I know in Hammer there’s a flag that will generate output on +USE.

How would you make it so you could USE on the bluebarrel0001 prop (while still keeping it a props_physics entity)? Is there a way to give a “prop_physics” entity the “generate output on +USE” flag?

Sorry for so many questions. :huh:



util.AddNetworkString('dermamenuprop')
hook.Add('PlayerUse', 'DermaShit', function(ply, ent)
	if ent:GetClass() == 'prop_physics' and ent:GetModel() == 'models/props_borealis/bluebarrel001.mdl' then
		net.Start('dermamenuprop')
		net.Send(ply)
		print('Prints if USE works')
	end
end)


-- This command gets the Spawnflags using the official function and through keyvalues (Keyvalues dont seem to update though)
concommand.Add('proptest', function(ply)
	for k, v in pairs(ents.FindByClass('prop_physics')) do
		if v:GetModel() == 'models/props_borealis/bluebarrel001.mdl' then
			print(v:GetKeyValues()['spawnflags'])
			print('-->'..v:GetSpawnFlags())
		end
	end
end)
-- This command SETS the 'Generate output' spawnflag on the borealis barrel prop, allowing the use of the PlayerUse Hook
concommand.Add('proptest2', function(ply)
	for k, v in pairs(ents.FindByClass('prop_physics')) do
		if v:GetModel() == 'models/props_borealis/bluebarrel001.mdl' then
			v:SetKeyValue('spawnflags', '256')
		end
	end
end)


I tested this code, works fine, use ‘proptest2’ to set the Generate output keyvalue, then the hook works, if you’re good 'nuff, you’ll find a way to apply this on any wanted prop, and even when they get newly spawned by the player or so.

[editline]19th October 2016[/editline]

Spawnflags as IDs can be found here: https://developer.valvesoftware.com/wiki/Prop_physics

Not sure why you wouldn’t make it a custom entity

Maybe he wants something to apply on ALL props on the map with a specific model? time will tell!