• Disable +use
    5 replies, posted
Hi guys, I'm trying to disable the use of +use to keep people from picking up objects, but I still want them to be able to use "E" for something I have already scripted. Help if you can thanks :) (Shit wrong board. My mistake :| )
You can disable use on an Entity by just removing ENT:Use or maybe replacing it with [code]function ENT:Use ( activator, caller ) end[/code] in the entity. You can remove it from your gamemode entirely with this I think: [code]hook.Add("PlayerBindPress", "cantUse", function(ply, bind) if (string.find(bind, "+use")) then local trace = ply:GetEyeTrace() if IsValid(trace.Entity) and trace.Entity:IsPlayer() then return true else return false end end end)[/code] You would obviously replace trace.Entity:IsPlayer() with your entity (or entities) but this allows you to press Use only on a Player, for example. I'm a novice at LUA though so I may have done something wrong, as I didn't even check the syntax.
[lua]hook.Add("AllowPlayerPickup", "Disable Picking Up", function( ply, ent ) return false end)[/lua]
[QUOTE=.\\Shadow};39376087][lua]hook.Add("AllowPlayerPickup", "Disable Picking Up", function( ply, ent ) return false end)[/lua][/QUOTE] This is obviously better than what I said, but you're still going to have to check what they're trying to pick up and decide if it's the entity you want to be getting used though.
He's asking to disallow picking up objects- that's what that does. It allows to "use" objects, but not to pick them up.
Or you could use the command garry added in when he pushed this feature. sv_playerpickupallowed 0
Sorry, you need to Log In to post a reply to this thread.