Raised This Month: $51 Target: $400
 12% 

Grenade light radius


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-07-2023 , 15:33   Grenade light radius
Reply With Quote #1

Hello anyone could help me? There is this Light Smokegrenade plugin, which turns smoke grenade into a flare, but it has one problem, i cant modify the range of the flare, i only see the option for Beam blast but not flare range itself. Anyone could help?

PHP Code:
#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];
new 
iOrigin];

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_forwardFM_SetModel"forward_SetModel" );
    
register_forwardFM_Think"forward_Think" );
    
    
RegisterHamHam_Spawn"player""bacon_Spawn");
    
    
gSmokeLightEnable register_cvar"lightsmoke_enabled""1" );
    
gLightTime register_cvar"lightsmoke_light_duration""999.0" );
    
gDeployTime register_cvar"lightsmoke_deploytime""0.0" );
    
gTrailEnable register_cvar"lightsmoke_trail""1" );
    
gCylinderEnable register_cvar"lightsmoke_cylinder""1" );
    
gSmokeCvar register_cvar"lightsmoke_smoke""0" );
    
gGlowColorCvar register_cvar"lightsmoke_glow_color""255 255 255" );
    
gSmokeBonus register_cvar"lightsmoke_bonus""0" );
}

public 
plugin_precache( )
{
    
gSpriteTrail precache_model"sprites/laserbeam.spr" );
    
gSpriteCircle precache_model"sprites/shockwave.spr" );
    
gSpriteSmoke precache_model"sprites/steam1.spr" );
    
    
precache_modelgSmokeModel );
    
    
precache_soundgSmokeStartSound );
    
precache_soundgSmokeStopSound );
}

public 
bacon_Spawnid )
{
    if( 
is_user_aliveid 
    && 
get_pcvar_numgSmokeLightEnable ) == 
    
&& get_pcvar_numgSmokeBonus ) == )
    {
        
give_itemid"weapon_smokegrenade" );
    }
}    

public 
forward_SetModeliEnt, const szModel[ ] )
{
    if( !
pev_validiEnt 
    || 
get_pcvar_numgSmokeLightEnable ) == 
    
|| !equalszModel], "smokegrenade.mdl" ) )
    {
        return 
FMRES_IGNORED;
    }
    
    static 
szClassname32 ];
    
peviEntpev_classnameszClassnamecharsmaxszClassname ) );
    
    if( 
equalszClassname"grenade" ) )
    {
        if( 
get_pcvar_numgTrailEnable ) == )
        {
            
UTIL_TrailSpriteiEnt );
        }
        
        
engfuncEngFunc_SetModeliEntgSmokeModel );
        
set_taskget_pcvar_floatgDeployTime ), "deploy_smoke"iEnt );
        
        
set_peviEntpev_iuser4SMOKE_ID );
        
set_peviEntpev_nextthinkget_gametime( ) + get_pcvar_floatgLightTime ) );
        
        new 
szColor12 ], iRgb][ ], iRiGiB;
        
get_pcvar_stringgGlowColorCvarszColorcharsmaxszColor ) );
        
        
parseszColoriRgb], 3iRgb], 3iRgb], );
        
        
iR clampstr_to_numiRgb] ) , 0255 );
        
iG clampstr_to_numiRgb] ) , 0255 );
        
iB clampstr_to_numiRgb] ) , 0255 );
        
        
set_renderingiEntkRenderFxGlowShelliRiGiBkRenderNormal18 );
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

public 
deploy_smokeiEnt )
{
    if( 
pev_validiEnt ) )
    {
        if( 
get_pcvar_numgCylinderEnable ) == )
        {
            
UTIL_BlastCircleiEnt );
        }
        
        
set_peviEntpev_effectsEF_DIMLIGHT );
        
emit_soundiEntCHAN_ITEMgSmokeStartSoundVOL_NORMATTN_NORM0PITCH_NORM );
    }
}

public 
forward_ThinkiEnt )
{
    if( 
pev_validiEnt 
    && 
get_pcvar_numgSmokeLightEnable ) == 
    
&& pev_valid2iEnt ) )
    {
        if( 
get_pcvar_numgSmokeCvar ) == )
        {
            
peviEntpev_originflOrigin );
            
FVecIVecflOriginiOrigin );
            
            new 
iOrigin];
            new 
iOrigin];
            new 
iOrigin];
            
            
UTIL_Smoke50y);
            
UTIL_Smokex50);
            
UTIL_Smoke50y);
            
UTIL_Smokex50);
            
UTIL_Smoke3535);
            
UTIL_Smoke3535);
            
UTIL_Smoke3535);
            
UTIL_Smoke3535);
        }
        
        
emit_soundiEntCHAN_ITEMgSmokeStopSoundVOL_NORMATTN_NORM0PITCH_NORM );
        
set_peviEntpev_flagsFL_KILLME );
    }
}

stock UTIL_TrailSpriteent )
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_BEAMFOLLOW );
    
write_shortent );        
    
write_shortgSpriteTrail );
    
write_byte);
    
write_byte);
    
write_byte255 );
    
write_byte255 );
    
write_byte255 );
    
write_byte100 );
    
message_end( );
}

stock UTIL_BlastCircleent )
{
    
peventpev_originflOrigin );
    
FVecIVecflOriginiOrigin );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITYiOrigin ); 
    
write_byteTE_BEAMCYLINDER );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] );
    
write_coordiOrigin] + 220 ) ;
    
write_shortgSpriteCircle );
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte255 );
    
write_byte255 );
    
write_byte255 );
    
write_byte128 );
    
write_byte);
    
message_end( );
}

stock UTIL_Smokexy)
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_SMOKE );
    
write_coord);
    
write_coord);
    
write_coord); 
    
write_shortgSpriteSmoke );
    
write_byte12 );
    
write_byte);
    
message_end( );

HowToRuski is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 06-07-2023 , 15:47   Re: Grenade light radius
Reply With Quote #2

I believe you need to change the following:

Code:
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 );
For a bigger radius, you need to make the numbers bigger. Here is an example:

Code:
UTIL_Smoke( x + 100, y, z );
UTIL_Smoke( x, y + 100, z );
UTIL_Smoke( x - 100, y, z );
UTIL_Smoke( x, y - 100, z );
UTIL_Smoke( x + 70, y + 70, z );
UTIL_Smoke( x + 70, y - 70, z );
UTIL_Smoke( x - 70, y + 70, z );
UTIL_Smoke( x - 70, y - 70, z );
Also, if you use the plugin for a zombie mode, the plugin may use the mod's radius settings, meaning you need to go to the .cfg file of the mod and change the radius settings to make the plugin decrease or increase the radius. Once you open the .cfg file, look for this option: "zp_flash_size" - there is a number after it, and you need to change it. Higher number means a bigger radius, lower number means a smaller radius.

Last edited by GlobalPlague; 06-07-2023 at 15:53.
GlobalPlague is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-07-2023 , 16:37   Re: Grenade light radius
Reply With Quote #3

Quote:
Originally Posted by GlobalPlague View Post
I believe you need to change the following:

Code:
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 );
For a bigger radius, you need to make the numbers bigger. Here is an example:

Code:
UTIL_Smoke( x + 100, y, z );
UTIL_Smoke( x, y + 100, z );
UTIL_Smoke( x - 100, y, z );
UTIL_Smoke( x, y - 100, z );
UTIL_Smoke( x + 70, y + 70, z );
UTIL_Smoke( x + 70, y - 70, z );
UTIL_Smoke( x - 70, y + 70, z );
UTIL_Smoke( x - 70, y - 70, z );
Also, if you use the plugin for a zombie mode, the plugin may use the mod's radius settings, meaning you need to go to the .cfg file of the mod and change the radius settings to make the plugin decrease or increase the radius. Once you open the .cfg file, look for this option: "zp_flash_size" - there is a number after it, and you need to change it. Higher number means a bigger radius, lower number means a smaller radius.
I am not using zombie plague. But why does the numbers differ? Like you made first 4 lines 100 and the last ones 70
HowToRuski is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 06-07-2023 , 18:01   Re: Grenade light radius
Reply With Quote #4

Quote:
Originally Posted by HowToRuski View Post
But why does the numbers differ? Like you made first 4 lines 100 and the last ones 70
You asked how to change the radius of the light, right? The higher numbers will cause a larger radius, and the lower numbers will cause a smaller radius. I gave you an example how to change the radius. The example i gave shows which numbers you need to change for the radius to be increased or decreased.
GlobalPlague is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-08-2023 , 01:05   Re: Grenade light radius
Reply With Quote #5

Quote:
Originally Posted by GlobalPlague View Post
You asked how to change the radius of the light, right? The higher numbers will cause a larger radius, and the lower numbers will cause a smaller radius. I gave you an example how to change the radius. The example i gave shows which numbers you need to change for the radius to be increased or decreased.
changed the numbers, even to the lowest made it all 5, it didnt change the radius
HowToRuski is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 06-08-2023 , 06:05   Re: Grenade light radius
Reply With Quote #6

search here the messages:

https://amxx-bg.info/api/message_const

and play with their parameters
lexzor is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-08-2023 , 10:13   Re: Grenade light radius
Reply With Quote #7

i already changed write_message parameters in the plugin where that would be logical for flare light radius, didnt help

Last edited by HowToRuski; 06-08-2023 at 10:13.
HowToRuski is offline
Reply



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 07:46.


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