WeaponCleaner: fix server crash
This commit is contained in:
		
							parent
							
								
									3d24fb83e0
								
							
						
					
					
						commit
						51ae6cec1a
					
				@ -33,7 +33,7 @@ public Plugin myinfo =
 | 
			
		||||
public void OnPluginStart()
 | 
			
		||||
{
 | 
			
		||||
	g_bEnableCSGOFix = view_as<bool>(GetEngineVersion() == Engine_CSGO);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	g_CVar_MaxWeapons = CreateConVar("sm_weaponcleaner_max", "5", "The maximum amount of weapons allowed in the game.", 0, true, 0.0, true, MAX_WEAPONS - 1.0);
 | 
			
		||||
	g_MaxWeapons = g_CVar_MaxWeapons.IntValue;
 | 
			
		||||
	g_CVar_MaxWeapons.AddChangeHook(OnConVarChanged);
 | 
			
		||||
@ -191,7 +191,8 @@ public Action OnWeaponDrop(int client, int entity)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	// Kill all dropped weapons during mp_freezetime
 | 
			
		||||
	if(GetTime() < g_RealRoundStartedTime)
 | 
			
		||||
	// or if no weapons are allowed at all
 | 
			
		||||
	if(GetTime() < g_RealRoundStartedTime || !g_MaxWeapons)
 | 
			
		||||
	{
 | 
			
		||||
		// Kill it
 | 
			
		||||
		AcceptEntityInput(entity, "Kill");
 | 
			
		||||
@ -204,6 +205,9 @@ public Action OnWeaponDrop(int client, int entity)
 | 
			
		||||
 | 
			
		||||
bool InsertWeapon(int entity)
 | 
			
		||||
{
 | 
			
		||||
	if(!g_MaxWeapons)
 | 
			
		||||
		return false;
 | 
			
		||||
 | 
			
		||||
	int entref = EntIndexToEntRef(entity);
 | 
			
		||||
 | 
			
		||||
	// Try to find a free slot
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user