Raised This Month: $ Target: $400
 0% 

Merging plugins


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode