Raised This Month: $ Target: $400
 0% 

[CS:GO] Custom fire particles


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
extr1m725
Member
Join Date: Oct 2014
Old 05-30-2019 , 17:51   Re: [CS:GO] Custom fire particles
Reply With Quote #11

Quote:
Originally Posted by NanoC View Post
I want to set zombies on fire but i'd like to delete the particle to prevent high var
check if this plugin will suit you

Code:
#pragma semicolon 1 

#include <sourcemod> 
#include <sdktools> 
#include <cstrike> 
#include <sdkhooks> 
#include <zombiereloaded>

#define DECSPEED 0.55
#define DETDELAY 1.3

float g_iClientSpeed[MAXPLAYERS+1] = { 1.0, ... };
Handle g_hClientTimer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};

public void OnPluginStart() 
{
	HookEvent("round_start", Event_OnRoundStart); 
} 

public void OnEntityCreated(int entity, const char[] classname) 
{ 
	if(entity > MAXPLAYERS){
		if (!strcmp(classname, "hegrenade_projectile")) 
		{
			int reference = EntIndexToEntRef(entity);
			CreateTimer(0.0, Timer_OnGrenadeCreated, reference);
			CreateTimer(DETDELAY, HeDetonate, reference, TIMER_FLAG_NO_MAPCHANGE); 
		} 
	}
} 

public Action Timer_OnGrenadeCreated(Handle Timer, any reference)
{
	int entity = EntRefToEntIndex(reference);

	if(entity != INVALID_ENT_REFERENCE)
	{
		int owner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");

		char name[32];
		GetClientName(owner, name, sizeof(name));

		SetEntProp(entity, Prop_Data, "m_nNextThinkTick", -1);
	}
}

public Action Event_OnRoundStart(Handle event, char[] name, bool dontBroadcast) 
{ 
	for (int i=1;i<MaxClients;i++) 
	{ 
		g_hClientTimer[i] = INVALID_HANDLE;
	}
	
	CreateTimer(0.1, Timer_GetMovementValue, client);
	
	return Plugin_Continue; 
} 

public Action Timer_GetMovementValue( Handle Timer, int client )
{	
	if(IsValidClient(client) && IsPlayerAlive(client))
	{
		g_iClientSpeed[client] = GetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue");
	}
	return Plugin_Handled;
}

public Action HeDetonate(Handle Timer, any reference)
{ 
	new entity = EntRefToEntIndex(reference);
	
	if(entity == INVALID_ENT_REFERENCE) 
		return Plugin_Stop;

	float entityposition[3]; 
	GetEntPropVector(entity, Prop_Send, "m_vecOrigin", entityposition); 

	for (new i = 1; i < MAXPLAYERS ; i++) 
	{ 
		if (IsValidClient(i))  
		{ 
			if (IsPlayerAlive(i) && !ZR_IsClientHuman(i)) 
			{ 
				char clientname[32];
				GetClientName(i, clientname, sizeof(clientname));
				float clientpos[3];
				GetClientAbsOrigin(i, clientpos);
				float distance = GetVectorDistance(entityposition, clientpos);
				if(distance <= 350.0)
				{
					float time = 5.0;
					
					ClientSetSpeed(i, g_iClientSpeed[i]-DECSPEED);
					SetEntityRenderColor(i, 255, 0, 0, 255);
					g_hClientTimer[i] = CreateTimer(time, Timer_ResetSpeed, i, TIMER_FLAG_NO_MAPCHANGE); 
				}
			} 
		} 
	} 
		
	AcceptEntityInput(entity,"Kill"); 
	
	return Plugin_Handled; 
}

void ClientSetSpeed(int client, float speed) 
{ 
	SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", speed); 
} 

public Action Timer_ResetSpeed(Handle Timer, any client) 
{
	if(Timer == g_hClientTimer[client] && IsValidClient(client))
	{
		ClientSetSpeed( client, g_iClientSpeed[client] );
		SetEntityRenderColor(client, 255, 255, 255, 255);
		g_hClientTimer[client] = INVALID_HANDLE;
	}
	
	return Plugin_Handled; 
} 

bool IsValidClient(int client)  
{ 
	if( client <= 0 ) 
		return false; 

	if( client > GetMaxClients() ) 
		return false; 

	if( !IsClientConnected(client) ) 
		return false; 

	if( !IsClientInGame(client) ) 
		return false; 


	return true; 
}
extr1m725 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 22:07.


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