View Single Post
CanadaRox
Member
Join Date: Dec 2009
Old 12-02-2009 , 01:34   Re: [L4D2]Crow's Annoying Item Remover
Reply With Quote #10

I have been trying to add the option to remove the grenade launcher by adding the following with no success:

Code:
new Handle:hClearGrenade;

...

hClearGrenade = CreateConVar("annoy_Gren", "1", _, FCVAR_NOTIFY | FCVAR_PLUGIN);

...

public Action:ClearGrenade()
{
	if ( GetConVarInt(hClearGrenade) == 1)
	{
		new ent = -1;
		new prev = 0;
		while ((ent = FindEntityByClassname(ent, "weapon_grenade_launcher_spawn")) != -1)
		{
			if (prev) RemoveEdict(prev);
			prev = ent;
		}
		if (prev) RemoveEdict(prev);

		ent = -1;
		prev = 0;
		while ((ent = FindEntityByClassname(ent, "weapon_grenade_launcher")) != -1)
		{
			if (prev) RemoveEdict(prev);
			prev = ent;
		}
	}
}
Stripper:Source reports the entity classname as "weapon_grenade_launcher_spawn", and I left "weapon_grenade_launcher" for good measure but still nothing. Anyone have any idea what is wrong with the above code?
CanadaRox is offline