Thread: Merging plugins
View Single Post
Author Message
SmackDaddy
Veteran Member
Join Date: Oct 2009
Old 09-24-2015 , 14:17   Merging plugins
Reply With Quote #1

I have a couple plugins which block specific weapons from being used....but I'd like to merge them into one plugin in the most efficient way possible. I am not a sourcepawn scripter but am willing to learn....I am providing an example of one of the plugins.....the other plugin is almost identical except that the weapon index that is referenced is different.

Code:
#define WEP_DEX_Medigun 35

public OnPluginStart()
{
	//HookEvent("player_spawn", Event_player_spawn);
	CreateTimer(0.1, Timer_DoEquip, 0, TIMER_REPEAT);
}


public Action:Timer_DoEquip(Handle:timer, any:derp)
{
	for(new client=1; client <= MaxClients; client++)
	{		
		if(IsClientInGame(client) && IsPlayerAlive(client))
		{		
			new slot1 = GetPlayerWeaponSlot(client, 1);
						
			if(TF2_GetPlayerClass(client) == TFClass_Medic)
			{
				if(slot1 > MaxClients && IsValidEntity(slot1) && GetEntProp(slot1, Prop_Send, "m_iItemDefinitionIndex") == WEP_DEX_Medigun)
				{
					TF2_RemoveWeaponSlot(client, 1);
					PrintToChat(client, "The Kritzkrieg is blocked and broken due to the Crits mod here");
				}
			}
		}	
	}
}
(this blocks the Kritzkrieg, and another one written almost like it blocks the quick-fix)

Thank you in advance for any help that is provided!
SmackDaddy is offline