• ENT:AcceptInput issues
    9 replies, posted
I have a ENT:AcceptInput block in a SNPC I am making, and when the input is made (pressing use on the NPC) it runs roughly 8 times. My ENT:AcceptInput code: [lua]function ENT:AcceptInput( name, activator, caller, data ) if (name == "Use") then if ( caller:IsPlayer() ) then caller:ConCommand("djpanel") end end end[/lua]
Try ENT:Use(activator) instead, it's how it's supposed to be done.
[QUOTE=Gbps;18469421]Try ENT:Use(activator) instead, it's how it's supposed to be done.[/QUOTE] Except it doesn't get called properly on scripted NPCs :buddy:
FUUUU- As a last resort, make a clienside keypress hook for IN_USE and run a console command on the client which then makes the server checks a trace on the server and uses hook.Call to call some hook name you created for your fake use hook. Keyword: last resort.
Or you could just give either the player or the NPC a .LastUse variable and check if it's been enough time since the last time it was used.
or you could put self:SetUseType(SIMPLE_USE) in the ENT:Initialize() function.
[QUOTE=Lexic;18469982]or you could put self:SetUseType(SIMPLE_USE) in the ENT:Initialize() function.[/QUOTE] Last time I tried I don't remember it changing anything on SNPCs. :frown:
It's in the entity metatable, so I assume you would be able to use the same functions (Unless SNCPS are not declared as entities, which they are :3:)
[QUOTE=Gbps;18472418]It's in the entity metatable, so I assume you would be able to use the same functions (Unless SNCPS are not declared as entities, which they are :3:)[/QUOTE] Of course, but I'm assuming that this only changes how ENT:Use() is called, and in this case we're using the user input "Use" which I believe is a different thing, so it would make sense for it not to be affected by SetUseType. [editline]1[/editline] See? I rated myself dumb. No need to it. :wink:
[QUOTE=Lexic;18469982]or you could put self:SetUseType(SIMPLE_USE) in the ENT:Initialize() function.[/QUOTE] That... Worked perfectly. Thanks
Sorry, you need to Log In to post a reply to this thread.