• Looping a hook
    4 replies, posted
Hello, what would be the best way of looping my hook: [code] hook.Add( "KeyPress", "RemoveEntity", function( ply, key ) if(ply:GetActiveWeapon():GetClass() == "weapon_sh_tool")then if(key == KEY_1 or key == KEY_2 or key == KEY_3 or key == KEY_4)then ply:GetEyeTrace().Entity:Remove() end end end) [/code]
Did you look it up on the wiki? KeyPress doesn't use KEY_ enums, it uses IN_ ones.
[QUOTE=Zet0r;48619518]Did you look it up on the wiki? KeyPress doesn't use KEY_ enums, it uses IN_ ones.[/QUOTE] SO THATS WHY ITS NOT BEEN WORKING !!!!! I LOVE YOU!
[QUOTE=Zet0r;48619518]Did you look it up on the wiki? KeyPress doesn't use KEY_ enums, it uses IN_ ones.[/QUOTE] code_gs said that KEY_ and IN_ keys are in the same "array" set.
anyway, I now need to know how to loop this: [code] hook.Add( "KeyPress", "Key Pressed", function(ply,key) if(input.IsKeyDown(KEY_1) or input.IsKeyDown(KEY_2) or input.IsKeyDown(KEY_3) or input.IsKeyDown(KEY_4))then ply:GetEyeTrace().Entity:Remove() end end ) [/code]
Sorry, you need to Log In to post a reply to this thread.