I need a code that when the person press E in my model it will show up my derma pannel! Who can do that?
Model? Pressing E on a model won't help. Maybe create an entity and just set it's model to your model, and then using the ENT:Use() function, make it show a derma menu.
If you want to do it on your gamemode and not on an entity, use KeyPress ([url]http://wiki.garrysmod.com/page/GM/KeyPress[/url]) or KeyRelease ([url]http://wiki.garrysmod.com/page/GM/KeyRelease[/url]) hooks, or else do as Pilot said.
But seriously, 20 seconds of research on the gmod wiki would have gave you the answer. Plus, you should check out the Gmod Lua basics on the wiki.
I hope my answer helped you.
[QUOTE=TheKitsune;47857232]If you want to do it on your gamemode and not on an entity, use KeyPress ([url]http://wiki.garrysmod.com/page/GM/KeyPress[/url]) or KeyRelease ([url]http://wiki.garrysmod.com/page/GM/KeyRelease[/url]) hooks, or else do as Pilot said.
But seriously, 20 seconds of research on the gmod wiki would have gave you the answer. Plus, you should check out the Gmod Lua basics on the wiki.
I hope my answer helped you.[/QUOTE]
You can just use Player:GetEyeTrace(), get the entity it hits from the trace results (Entity) and perform whatever checks you need to determine if the panel should open based on that.
[code]
hook.Add('KeyPress', 'OpenDermaOnHitEnt', function(ply, key)
local ent = ply:GetEyeTrace().Entity
if key == IN_USE and ent and ent:GetModel() == 'modelpathhere' then
-- open the menu
end
end)
[/code]
Not tested and all that jazz, but there you go.
Come on dude...Search on your old posts...
[QUOTE=gonzalolog;47857429]Come on dude...Search on your old posts...[/QUOTE]
You could also just use the USE hook for an SENT like everyone else told you on your previous thread with the exact same name and topic as well. Granted, that will only cause the menu to appear if they are close, but it would be more ideal than my solution above.
Sorry, you need to Log In to post a reply to this thread.