Using item in next slot

Hi is it possible to check what is in the next weapon slot? So then I can check if the scroll wheel has been used and then switch to the next weapon/item in the slot. This is exactly what fast switch does, but it seems there is no automatic way for clients to have it turned on when they join the server.

[editline]1st September 2015[/editline]

ok, so I have found this:



bind "Key" "+attack;+invnext"


How can I do it so a players keys are binded to these when they join

You cannot override player binds for obvious reasons, what you can do run those commands using RunConsoleCommand ( and don’t forget to run the -attack, etc )

I have decided to do this:



hook.Add("PlayerKeyPress","BindMenu",function(ply,key)
	
    if(input.IsKeyDown(KEY_1 or KEY_PAD_1))then
        
ply:ConCommand("use", "tfa_acr")
ply:ConCommand("use", "tfa_ak47")
ply:ConCommand("use", "tfa_ak74")
ply:ConCommand("use", "tfa_amd65")
ply:ConCommand("use", "tfa_an94")
ply:ConCommand("use", "tfa_auga3")
ply:ConCommand("use", "tfa_fal")
ply:ConCommand("use", "tfa_g36")
ply:ConCommand("use", "tfa_g3a3")
ply:ConCommand("use", "tfa_l85")
ply:ConCommand("use", "tfa_m14sp")
ply:ConCommand("use", "tfa_m16a4_acog")
ply:ConCommand("use", "tfa_m416")
ply:ConCommand("use", "tfa_scar")
ply:ConCommand("use", "tfa_tar21")
ply:ConCommand("use", "tfa_val")
ply:ConCommand("use", "tfa_winchester73")
ply:ConCommand("use", "tfa_mp5")
ply:ConCommand("use", "tfa_dragunov")
ply:ConCommand("use", "tfa_honeybadger")
ply:ConCommand("use", "tfa_intervention")
ply:ConCommand("use", "tfa_m98b")
ply:ConCommand("use", "tfa_mp5sd")
ply:ConCommand("use", "tfa_aw50")
ply:ConCommand("use", "tfa_bizonp19")
ply:ConCommand("use", "tfa_usc")

    end

    if(input.IsKeyDown(KEY_2 or KEY_PAD_1))then
ply:ConCommand("use", "tfa_colt1911")
ply:ConCommand("use", "tfa_coltpython")
ply:ConCommand("use", "tfa_deagle")
ply:ConCommand("use", "tfa_glock")
ply:ConCommand("use", "tfa_hk45")
ply:ConCommand("use", "tfa_luger")
ply:ConCommand("use", "tfa_model3russian")
ply:ConCommand("use", "tfa_model500")
ply:ConCommand("use", "tfa_model627")
ply:ConCommand("use", "tfa_mp40")
ply:ConCommand("use", "tfa_ragingbull")
ply:ConCommand("use", "tfa_scoped_taurus")
ply:ConCommand("use", "tfa_sig_p229r")
ply:ConCommand("use", "tfa_tec9")
ply:ConCommand("use", "tfa_thompson")
ply:ConCommand("use", "tfa_usp")
ply:ConCommand("use", "tfa_uzi")
    end

end)


but it is not working.

I know its long winded but it should work, it is being ran clientside.

[editline]1st September 2015[/editline]

FINALLY!

here is the code:



-- ######## MultiKeyBinder by aVoN for MPAP. You are free to use it anywhere you want and with no credtis. It's public domain.
local MultiKeyBinder = {};
MultiKeyBinder.Binds = {};

-- ########  Find, if someone presses a key @aVoN
function MultiKeyBinder.Think()
	local self = MultiKeyBinder;
	local p = LocalPlayer();
	for _,v in pairs(self.Binds) do
		local pressed = true;
		for _,key in pairs(v.Keys) do
			if(not input.IsKeyDown(key)) then
				pressed = false;
				break;
			end
		end
		if(pressed) then
			if(not v.Pressed) then
				if p:IsTyping() then
				else
					v.Pressed = true;
					p:ConCommand(v.Command);
				end
			end
		else
			v.Pressed = nil;
		end
	end 
end

hook.Add("Think","MultiKeyBinder.Think",MultiKeyBinder.Think);

-- ########  Adds a bind @aVoN
function MultiKeyBinder.AddBind(cmd,...)
	table.insert(MultiKeyBinder.Binds,
		{
			Keys = {...},
			Command = cmd,
		}
	);
end

MultiKeyBinder.AddBind("use tfa_acr",KEY_1)


-posted by some random fucking wizard