cerere modificare plugin [rezolvat]

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
shut.theart
Membru, skill +3
Membru, skill +3
Posts: 1230
Joined: 10 Aug 2012, 13:04
Detinator Steam: Da
Has thanked: 52 times
Been thanked: 20 times
Contact:

07 Oct 2013, 16:43

vreau ca pluginu asta (light smoke grenade, acest plugin face ca smokegrenade sa devina o lanterna ca pe modul zm) sa aiba mai multe culori la lumina lanternei nu doar alb
http://forums.alliedmods.net/showthread.php?p=819251

sau poate aveti alt plugin
ms

RoyalServer
User avatar
420
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 1872
Joined: 20 Sep 2009, 22:49
Detinator Steam: Da
CS Status: Busy
SteamID: fanta_4cs
Reputatie: Fost detinator ZM.eXtreamCS.com
Fost detinator DR.eXtreamCS.com
Membru Club eXtreamCS (o luna)
Fost Moderator
Nume anterior: FANTA
Utilizator neserios (tepar!)
Location: Athens,Ελλάδα
Has thanked: 83 times
Been thanked: 168 times

07 Oct 2013, 16:45

Mutat!
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

07 Oct 2013, 17:12

| Afiseaza codul
#include < amxmodx >

#include < fakemeta >
#include < engine >
#include < fun >
#include < hamsandwich >

#pragma semicolon 1	

#define SMOKE_ID		071192
#define pev_valid2(%1)		( pev( %1, pev_iuser4 ) == SMOKE_ID ) ? 1 : 0

new gSmokeLightEnable;
new gLightTime;
new gDeployTime;
new gSpriteTrail;
new gSpriteCircle;
new gSpriteSmoke;
new gTrailEnable;
new gCylinderEnable;
new gGlowColorCvar;
new gSmokeCvar;
new gSmokeBonus;

new Float:flOrigin[ 3 ];
new iOrigin[ 3 ];

new const gSmokeModel[ ] = "models/w_smokegrenade.mdl";

new const gSmokeStartSound[ ] = "items/nvg_on.wav";
new const gSmokeStopSound[ ] = "items/nvg_off.wav";

public plugin_init( )
{
	register_plugin( "Light Smoke Grenade", "2.0.0", "tuty" );
	
	register_forward( FM_SetModel, "forward_SetModel" );
	register_forward( FM_Think, "forward_Think" );
	
	RegisterHam( Ham_Spawn, "player", "bacon_Spawn", 1 );
	
	gSmokeLightEnable = register_cvar( "lightsmoke_enabled", "1" );
	gLightTime = register_cvar( "lightsmoke_light_duration", "20.0" );
	gDeployTime = register_cvar( "lightsmoke_deploytime", "3.0" );
	gTrailEnable = register_cvar( "lightsmoke_trail", "1" );
	gCylinderEnable = register_cvar( "lightsmoke_cylinder", "1" );
	gSmokeCvar = register_cvar( "lightsmoke_smoke", "1" );
	gGlowColorCvar = register_cvar( "lightsmoke_glow_color", "random( 255) random( 255 ) random( 255 )" );
	gSmokeBonus = register_cvar( "lightsmoke_bonus", "1" );
}

public plugin_precache( )
{
	gSpriteTrail = precache_model( "sprites/laserbeam.spr" );
	gSpriteCircle = precache_model( "sprites/shockwave.spr" );
	gSpriteSmoke = precache_model( "sprites/steam1.spr" );
	
	precache_model( gSmokeModel );
	
	precache_sound( gSmokeStartSound );
	precache_sound( gSmokeStopSound );
}

public bacon_Spawn( id )
{
	if( is_user_alive( id ) 
	&& get_pcvar_num( gSmokeLightEnable ) == 1 
	&& get_pcvar_num( gSmokeBonus ) == 1 )
	{
		give_item( id, "weapon_smokegrenade" );
	}
}	

public forward_SetModel( iEnt, const szModel[ ] )
{
	if( !pev_valid( iEnt ) 
	|| get_pcvar_num( gSmokeLightEnable ) == 0 
	|| !equal( szModel[ 9 ], "smokegrenade.mdl" ) )
	{
		return FMRES_IGNORED;
	}
	
	static szClassname[ 32 ];
	pev( iEnt, pev_classname, szClassname, charsmax( szClassname ) );
	
	if( equal( szClassname, "grenade" ) )
	{
		if( get_pcvar_num( gTrailEnable ) == 1 )
		{
			UTIL_TrailSprite( iEnt );
		}
		
		engfunc( EngFunc_SetModel, iEnt, gSmokeModel );
		set_task( get_pcvar_float( gDeployTime ), "deploy_smoke", iEnt );
		
		set_pev( iEnt, pev_iuser4, SMOKE_ID );
		set_pev( iEnt, pev_nextthink, get_gametime( ) + get_pcvar_float( gLightTime ) );
		
		new szColor[ 12 ], iRgb[ 3 ][ 4 ], iR, iG, iB;
		get_pcvar_string( gGlowColorCvar, szColor, charsmax( szColor ) );
		
		parse( szColor, iRgb[ 0 ], 3, iRgb[ 1 ], 3, iRgb[ 2 ], 3 );
		
		iR = clamp( str_to_num( iRgb[ 0 ] ) , 0, 255 );
		iG = clamp( str_to_num( iRgb[ 1 ] ) , 0, 255 );
		iB = clamp( str_to_num( iRgb[ 2 ] ) , 0, 255 );
		
		set_rendering( iEnt, kRenderFxGlowShell, iR, iG, iB, kRenderNormal, 18 );
		
		return FMRES_SUPERCEDE;
	}
	
	return FMRES_IGNORED;
}

public deploy_smoke( iEnt )
{
	if( pev_valid( iEnt ) )
	{
		if( get_pcvar_num( gCylinderEnable ) == 1 )
		{
			UTIL_BlastCircle( iEnt );
		}
		
		set_pev( iEnt, pev_effects, EF_DIMLIGHT );
		emit_sound( iEnt, CHAN_ITEM, gSmokeStartSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
	}
}

public forward_Think( iEnt )
{
	if( pev_valid( iEnt ) 
	&& get_pcvar_num( gSmokeLightEnable ) == 1 
	&& pev_valid2( iEnt ) )
	{
		if( get_pcvar_num( gSmokeCvar ) == 1 )
		{
			pev( iEnt, pev_origin, flOrigin );
			FVecIVec( flOrigin, iOrigin );
			
			new x = iOrigin[ 0 ];
			new y = iOrigin[ 1 ];
			new z = iOrigin[ 2 ];
			
			UTIL_Smoke( x + 50, y, z );
			UTIL_Smoke( x, y + 50, z );
			UTIL_Smoke( x - 50, y, z );
			UTIL_Smoke( x, y - 50, z );
			UTIL_Smoke( x + 35, y + 35, z );
			UTIL_Smoke( x + 35, y - 35, z );
			UTIL_Smoke( x - 35, y + 35, z );
			UTIL_Smoke( x - 35, y - 35, z );
		}
		
		emit_sound( iEnt, CHAN_ITEM, gSmokeStopSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
		set_pev( iEnt, pev_flags, FL_KILLME );
	}
}

stock UTIL_TrailSprite( ent )
{
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( TE_BEAMFOLLOW );
	write_short( ent );		
	write_short( gSpriteTrail );
	write_byte( 3 );
	write_byte( 7 );
	write_byte( 255 );
	write_byte( 255 );
	write_byte( 255 );
	write_byte( 100 );
	message_end( );
}

stock UTIL_BlastCircle( ent )
{
	pev( ent, pev_origin, flOrigin );
	FVecIVec( flOrigin, iOrigin );
	
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
	write_byte( TE_BEAMCYLINDER );
	write_coord( iOrigin[ 0 ] );
	write_coord( iOrigin[ 1 ] );
	write_coord( iOrigin[ 2 ] );
	write_coord( iOrigin[ 0 ] );
	write_coord( iOrigin[ 1 ] );
	write_coord( iOrigin[ 2 ] + 220 ) ;
	write_short( gSpriteCircle );
	write_byte( 0 );
	write_byte( 1 );
	write_byte( 6 );
	write_byte( 8 );
	write_byte( 1 );
	write_byte( 255 );
	write_byte( 255 );
	write_byte( 255 );
	write_byte( 128 );
	write_byte( 5 );
	message_end( );
}

stock UTIL_Smoke( x, y, z )
{
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( TE_SMOKE );
	write_coord( x );
	write_coord( y );
	write_coord( z ); 
	write_short( gSpriteSmoke );
	write_byte( 12 );
	write_byte( 3 );
	message_end( );
}
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
cyby
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 1777
Joined: 16 Jul 2011, 21:46
Detinator Steam: Da
Detinator server CS: Da
Reputatie: Scripter eXtreamCS
Fost Moderator ajutator
Has thanked: 146 times
Been thanked: 396 times

07 Oct 2013, 17:22

Extras din ZP 5.0 | Afiseaza codul
/*================================================================================
	
	---------------------------
	-*- [ZP] Grenade: Flare -*-
	---------------------------
	
	This plugin is part of Zombie Plague Mod and is distributed under the
	terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
	
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const PEV_NADE_TYPE = pev_flTimeStepSound
const NADE_TYPE_FLARE = 4444
const PEV_FLARE_COLOR = pev_punchangle
const PEV_FLARE_DURATION = pev_flSwimTime

new g_trailSpr

new cvar_grenade_flare_duration, cvar_grenade_flare_radius, cvar_grenade_flare_color;

public plugin_init()
{
	register_plugin("[ZP] Grenade: Flare", "1.0", "ZP Dev Team")
	
	register_forward(FM_SetModel, "fw_SetModel")
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
	
	cvar_grenade_flare_duration = register_cvar("zp_grenade_flare_duration", "60")
	cvar_grenade_flare_radius = register_cvar("zp_grenade_flare_radius", "25")
	cvar_grenade_flare_color = register_cvar("zp_grenade_flare_color", "0")
}

public plugin_precache()
{
	g_trailSpr = precache_model("sprites/laserbeam.spr")
	precache_sound("items/nvg_on.wav")
}

// Forward Set Model
public fw_SetModel(entity, const model[])
{
	// We don't care
	if (strlen(model) < 8)
		return;
	
	// Narrow down our matches a bit
	if (model[7] != 'w' || model[8] != '_')
		return;
	
	// Get damage time of grenade
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	// Grenade not yet thrown
	if (dmgtime == 0.0)
		return;
	
	// Smoke Grenade
	if (model[9] == 's' && model[10] == 'm')
	{
		// Build flare's color
		static rgb[3]
		switch (get_pcvar_num(cvar_grenade_flare_color))
		{
			case 0: // white
			{
				rgb[0] = 255 // r
				rgb[1] = 255 // g
				rgb[2] = 255 // b
			}
			case 1: // red
			{
				rgb[0] = random_num(50,255) // r
				rgb[1] = 0 // g
				rgb[2] = 0 // b
			}
			case 2: // green
			{
				rgb[0] = 0 // r
				rgb[1] = random_num(50,255) // g
				rgb[2] = 0 // b
			}
			case 3: // blue
			{
				rgb[0] = 0 // r
				rgb[1] = 0 // g
				rgb[2] = random_num(50,255) // b
			}
			case 4: // random (all colors)
			{
				rgb[0] = random_num(50,200) // r
				rgb[1] = random_num(50,200) // g
				rgb[2] = random_num(50,200) // b
			}
			case 5: // random (r,g,b)
			{
				switch (random_num(1, 3))
				{
					case 1: // red
					{
						rgb[0] = random_num(50,255) // r
						rgb[1] = 0 // g
						rgb[2] = 0 // b
					}
					case 2: // green
					{
						rgb[0] = 0 // r
						rgb[1] = random_num(50,255) // g
						rgb[2] = 0 // b
					}
					case 3: // blue
					{
						rgb[0] = 0 // r
						rgb[1] = 0 // g
						rgb[2] = random_num(50,255) // b
					}
				}
			}
		}
		
		// Give it a glow
		fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
		
		// And a colored trail
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMFOLLOW) // TE id
		write_short(entity) // entity
		write_short(g_trailSpr) // sprite
		write_byte(10) // life
		write_byte(10) // width
		write_byte(rgb[0]) // r
		write_byte(rgb[1]) // g
		write_byte(rgb[2]) // b
		write_byte(200) // brightness
		message_end()
		
		// Set grenade type on the thrown grenade entity
		set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE)
		
		// Set flare color on the thrown grenade entity
		set_pev(entity, PEV_FLARE_COLOR, rgb)
	}
}

// Ham Grenade Think Forward
public fw_ThinkGrenade(entity)
{
	// Invalid entity
	if (!pev_valid(entity)) return HAM_IGNORED;
	
	// Get damage time of grenade
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	new Float:current_time = get_gametime()
	
	// Check if it's time to go off
	if (dmgtime > current_time)
		return HAM_IGNORED;
	
	// Check if it's one of our custom nades
	switch (pev(entity, PEV_NADE_TYPE))
	{
		case NADE_TYPE_FLARE: // Flare
		{
			// Get its duration
			new duration = pev(entity, PEV_FLARE_DURATION)
			
			// Already went off, do lighting loop for the duration of PEV_FLARE_DURATION
			if (duration > 0)
			{
				// Check whether this is the last loop
				if (duration == 1)
				{
					// Get rid of the flare entity
					engfunc(EngFunc_RemoveEntity, entity)
					return HAM_SUPERCEDE;
				}
				
				// Light it up!
				flare_lighting(entity, duration)
				
				// Set time for next loop
				set_pev(entity, PEV_FLARE_DURATION, --duration)
				set_pev(entity, pev_dmgtime, current_time + 2.0)
			}
			// Light up when it's stopped on ground
			else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
			{
				emit_sound(entity, CHAN_WEAPON, "items/nvg_on.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
				
				// Set duration and start lightning loop on next think
				set_pev(entity, PEV_FLARE_DURATION, 1 + get_pcvar_num(cvar_grenade_flare_duration)/2)
				set_pev(entity, pev_dmgtime, current_time + 0.1)
			}
			else
			{
				// Delay explosion until we hit ground
				set_pev(entity, pev_dmgtime, current_time + 0.5)
			}
		}
	}
	
	return HAM_IGNORED;
}

// Flare Lighting Effects
flare_lighting(entity, duration)
{
	// Get origin and color
	static Float:origin[3], color[3]
	pev(entity, pev_origin, origin)
	pev(entity, PEV_FLARE_COLOR, color)
	
	// Lighting
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_DLIGHT) // TE id
	engfunc(EngFunc_WriteCoord, origin[0]) // x
	engfunc(EngFunc_WriteCoord, origin[1]) // y
	engfunc(EngFunc_WriteCoord, origin[2]) // z
	write_byte(get_pcvar_num(cvar_grenade_flare_radius)) // radius
	write_byte(color[0]) // r
	write_byte(color[1]) // g
	write_byte(color[2]) // b
	write_byte(21) //life
	write_byte((duration < 2) ? 3 : 0) //decay rate
	message_end()
	
	// Sparks
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_SPARKS) // TE id
	engfunc(EngFunc_WriteCoord, origin[0]) // x
	engfunc(EngFunc_WriteCoord, origin[1]) // y
	engfunc(EngFunc_WriteCoord, origin[2]) // z
	message_end()
}

// Set entity's rendering type (from fakemeta_util)
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
	static Float:color[3]
	color[0] = float(r)
	color[1] = float(g)
	color[2] = float(b)
	
	set_pev(entity, pev_renderfx, fx)
	set_pev(entity, pev_rendercolor, color)
	set_pev(entity, pev_rendermode, render)
	set_pev(entity, pev_renderamt, float(amount))
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
	static Float:velocity[3]
	pev(entity, pev_velocity, velocity)
	
	return floatround(vector_length(velocity));
}

Code: Select all

zp_grenade_flare_duration 60 // durata in secunde.
zp_grenade_flare_radius 25 // raza
zp_grenade_flare_color 0 // culoare: 0 - alb | 1 - rosu | 2 - verde | 3 - albastru | 4 - culoare aleatorie | 5 - culoare aleatorie dintre rosu verde si albastru
93.114.82.17:27015 - Monster Invasion CO-OP Mod
User avatar
CryWolf
Administrator
Administrator
Posts: 6505
Joined: 07 Aug 2008, 16:33
Detinator Steam: Da
Reputatie: Administrator
Fost Scripter
Manager CS2.eXtream.Ro
Fost Detinator ZM.eXtream.Ro
Fost manager CS.eXtream.Ro
Fost manager CSGO.eXtream.Ro
Fost manager global
Location: Botosani
Discord: crywolf1989
Has thanked: 202 times
Been thanked: 850 times
Contact:

07 Oct 2013, 17:33

Sau poate vrei smokeflare din biohazard, il postez poate are cineva nevoie de el
DL:
amx_smokeflare.sma
Cvaruri:
amx_flare_enable 1 / 0 ( 0: plugin off / 1: plugin on ) IMPLICIT: 1
amx_flare_duration "secunde.0" ( adaugati in secunde cat timp sa dureze efectul dupa care lanterna va disparea, atentie necesita .0 la urma ) IMPLICIT: 999.0 ( Viata infinita )

Am mai facut cateva modificari la el, culori random luminiozitate mai puternica, sper sa fie de folos cuiva!
NU IMI MAI DA-TI PM CU CERERE AJUTOR/SAMD, FOLOSITI FORUMUL, CITESC MAJORITATEA TOPICURILOR.
www.dark-arena.com , SERVERE CS / CS2 / L4D AU REVENIT ONLINE.
www.diasporaiptv.ro - SERVICII PREMIUM IPTV

Image

Image
User avatar
shut.theart
Membru, skill +3
Membru, skill +3
Posts: 1230
Joined: 10 Aug 2012, 13:04
Detinator Steam: Da
Has thanked: 52 times
Been thanked: 20 times
Contact:

07 Oct 2013, 19:27

cyby wrote:
Extras din ZP 5.0 | Afiseaza codul
/*================================================================================
	
	---------------------------
	-*- [ZP] Grenade: Flare -*-
	---------------------------
	
	This plugin is part of Zombie Plague Mod and is distributed under the
	terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
	
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const PEV_NADE_TYPE = pev_flTimeStepSound
const NADE_TYPE_FLARE = 4444
const PEV_FLARE_COLOR = pev_punchangle
const PEV_FLARE_DURATION = pev_flSwimTime

new g_trailSpr

new cvar_grenade_flare_duration, cvar_grenade_flare_radius, cvar_grenade_flare_color;

public plugin_init()
{
	register_plugin("[ZP] Grenade: Flare", "1.0", "ZP Dev Team")
	
	register_forward(FM_SetModel, "fw_SetModel")
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
	
	cvar_grenade_flare_duration = register_cvar("zp_grenade_flare_duration", "60")
	cvar_grenade_flare_radius = register_cvar("zp_grenade_flare_radius", "25")
	cvar_grenade_flare_color = register_cvar("zp_grenade_flare_color", "0")
}

public plugin_precache()
{
	g_trailSpr = precache_model("sprites/laserbeam.spr")
	precache_sound("items/nvg_on.wav")
}

// Forward Set Model
public fw_SetModel(entity, const model[])
{
	// We don't care
	if (strlen(model) < 8)
		return;
	
	// Narrow down our matches a bit
	if (model[7] != 'w' || model[8] != '_')
		return;
	
	// Get damage time of grenade
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	// Grenade not yet thrown
	if (dmgtime == 0.0)
		return;
	
	// Smoke Grenade
	if (model[9] == 's' && model[10] == 'm')
	{
		// Build flare's color
		static rgb[3]
		switch (get_pcvar_num(cvar_grenade_flare_color))
		{
			case 0: // white
			{
				rgb[0] = 255 // r
				rgb[1] = 255 // g
				rgb[2] = 255 // b
			}
			case 1: // red
			{
				rgb[0] = random_num(50,255) // r
				rgb[1] = 0 // g
				rgb[2] = 0 // b
			}
			case 2: // green
			{
				rgb[0] = 0 // r
				rgb[1] = random_num(50,255) // g
				rgb[2] = 0 // b
			}
			case 3: // blue
			{
				rgb[0] = 0 // r
				rgb[1] = 0 // g
				rgb[2] = random_num(50,255) // b
			}
			case 4: // random (all colors)
			{
				rgb[0] = random_num(50,200) // r
				rgb[1] = random_num(50,200) // g
				rgb[2] = random_num(50,200) // b
			}
			case 5: // random (r,g,b)
			{
				switch (random_num(1, 3))
				{
					case 1: // red
					{
						rgb[0] = random_num(50,255) // r
						rgb[1] = 0 // g
						rgb[2] = 0 // b
					}
					case 2: // green
					{
						rgb[0] = 0 // r
						rgb[1] = random_num(50,255) // g
						rgb[2] = 0 // b
					}
					case 3: // blue
					{
						rgb[0] = 0 // r
						rgb[1] = 0 // g
						rgb[2] = random_num(50,255) // b
					}
				}
			}
		}
		
		// Give it a glow
		fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
		
		// And a colored trail
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMFOLLOW) // TE id
		write_short(entity) // entity
		write_short(g_trailSpr) // sprite
		write_byte(10) // life
		write_byte(10) // width
		write_byte(rgb[0]) // r
		write_byte(rgb[1]) // g
		write_byte(rgb[2]) // b
		write_byte(200) // brightness
		message_end()
		
		// Set grenade type on the thrown grenade entity
		set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE)
		
		// Set flare color on the thrown grenade entity
		set_pev(entity, PEV_FLARE_COLOR, rgb)
	}
}

// Ham Grenade Think Forward
public fw_ThinkGrenade(entity)
{
	// Invalid entity
	if (!pev_valid(entity)) return HAM_IGNORED;
	
	// Get damage time of grenade
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	new Float:current_time = get_gametime()
	
	// Check if it's time to go off
	if (dmgtime > current_time)
		return HAM_IGNORED;
	
	// Check if it's one of our custom nades
	switch (pev(entity, PEV_NADE_TYPE))
	{
		case NADE_TYPE_FLARE: // Flare
		{
			// Get its duration
			new duration = pev(entity, PEV_FLARE_DURATION)
			
			// Already went off, do lighting loop for the duration of PEV_FLARE_DURATION
			if (duration > 0)
			{
				// Check whether this is the last loop
				if (duration == 1)
				{
					// Get rid of the flare entity
					engfunc(EngFunc_RemoveEntity, entity)
					return HAM_SUPERCEDE;
				}
				
				// Light it up!
				flare_lighting(entity, duration)
				
				// Set time for next loop
				set_pev(entity, PEV_FLARE_DURATION, --duration)
				set_pev(entity, pev_dmgtime, current_time + 2.0)
			}
			// Light up when it's stopped on ground
			else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
			{
				emit_sound(entity, CHAN_WEAPON, "items/nvg_on.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
				
				// Set duration and start lightning loop on next think
				set_pev(entity, PEV_FLARE_DURATION, 1 + get_pcvar_num(cvar_grenade_flare_duration)/2)
				set_pev(entity, pev_dmgtime, current_time + 0.1)
			}
			else
			{
				// Delay explosion until we hit ground
				set_pev(entity, pev_dmgtime, current_time + 0.5)
			}
		}
	}
	
	return HAM_IGNORED;
}

// Flare Lighting Effects
flare_lighting(entity, duration)
{
	// Get origin and color
	static Float:origin[3], color[3]
	pev(entity, pev_origin, origin)
	pev(entity, PEV_FLARE_COLOR, color)
	
	// Lighting
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_DLIGHT) // TE id
	engfunc(EngFunc_WriteCoord, origin[0]) // x
	engfunc(EngFunc_WriteCoord, origin[1]) // y
	engfunc(EngFunc_WriteCoord, origin[2]) // z
	write_byte(get_pcvar_num(cvar_grenade_flare_radius)) // radius
	write_byte(color[0]) // r
	write_byte(color[1]) // g
	write_byte(color[2]) // b
	write_byte(21) //life
	write_byte((duration < 2) ? 3 : 0) //decay rate
	message_end()
	
	// Sparks
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_SPARKS) // TE id
	engfunc(EngFunc_WriteCoord, origin[0]) // x
	engfunc(EngFunc_WriteCoord, origin[1]) // y
	engfunc(EngFunc_WriteCoord, origin[2]) // z
	message_end()
}

// Set entity's rendering type (from fakemeta_util)
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
	static Float:color[3]
	color[0] = float(r)
	color[1] = float(g)
	color[2] = float(b)
	
	set_pev(entity, pev_renderfx, fx)
	set_pev(entity, pev_rendercolor, color)
	set_pev(entity, pev_rendermode, render)
	set_pev(entity, pev_renderamt, float(amount))
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
	static Float:velocity[3]
	pev(entity, pev_velocity, velocity)
	
	return floatround(vector_length(velocity));
}

Code: Select all

zp_grenade_flare_duration 60 // durata in secunde.
zp_grenade_flare_radius 25 // raza
zp_grenade_flare_color 0 // culoare: 0 - alb | 1 - rosu | 2 - verde | 3 - albastru | 4 - culoare aleatorie | 5 - culoare aleatorie dintre rosu verde si albastru
Daca-mi poti extrage si aia cu naplam nade (sa i-a foc playeru cu he) si frost nade (sa inghete) m-ai rezolvat
Daca vezi asta, si incerci pentru mine iti raman reunoscator!

User avatar
shut.theart
Membru, skill +3
Membru, skill +3
Posts: 1230
Joined: 10 Aug 2012, 13:04
Detinator Steam: Da
Has thanked: 52 times
Been thanked: 20 times
Contact:

08 Oct 2013, 15:50

Poate cineva sa-mi extraga naplam si frostnade din zp?

User avatar
cyby
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 1777
Joined: 16 Jul 2011, 21:46
Detinator Steam: Da
Detinator server CS: Da
Reputatie: Scripter eXtreamCS
Fost Moderator ajutator
Has thanked: 146 times
Been thanked: 396 times

09 Oct 2013, 01:28

93.114.82.17:27015 - Monster Invasion CO-OP Mod
User avatar
shut.theart
Membru, skill +3
Membru, skill +3
Posts: 1230
Joined: 10 Aug 2012, 13:04
Detinator Steam: Da
Has thanked: 52 times
Been thanked: 20 times
Contact:

09 Oct 2013, 15:23

Ms mult cyby!

Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests