AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   glow Smoke Grenade (https://forums.alliedmods.net/showthread.php?t=184003)

Mr.Waffle 04-29-2012 14:07

glow Smoke Grenade
 
hello,
code
PHP Code:

public Forward_EntityThink_PreiEnt )  {         
    new 
id peviEntpev_owner );    
        
    new 
sModel32 ];
    
    
peviEntpev_modelsModelcharsmaxsModel ) );
    
    if( 
equalsModel"models/w_smokegrenade.mdl" ) ) { 
        
set_peviEntpev_renderfxkRenderFxGlowShell );
        
set_peviEntpev_renderamt125.0 );
        
set_peviEntpev_rendermodekRenderTransAlpha );
        
        if(
cs_get_user_team(iEnt) == CS_TEAM_CT)
        {
            
pev(iEntpev_rendercolor0.00.0255.0
        }
        if(
cs_get_user_team(iEnt) == CS_TEAM_T)    
        {
            
pev(iEntpev_rendercolor255.00.00.0
        }        
        return 
FMRES_SUPERCEDE;
    }    
    return 
FMRES_IGNORED;


so why its not working ?
i just trying to do if a player throw a smoke grenade , the smoke grenade will be in glow .
teror = red glow
ct = blue glow .
can somone fix it ?
thx .

<VeCo> 04-29-2012 14:33

Re: glow Smoke Grenade
 
I would rather hook SetModel or Spawn.
Anyway you have some errors:

- In charsmax it should be sModel (or szModel if you replace it in the other places)
- In cs_get_user_team the index should be id, not iEnt.
- Optional: You could use elseif (because you need only one condition, player can't be T and CT at the same time) or a conditional operator for setting the colors.

Mr.Waffle 04-29-2012 14:43

Re: glow Smoke Grenade
 
i changed what u said, and it stell not working :s
PHP Code:

public Forward_EntityThink_PreiEnt )  {         
    new 
id peviEntpev_owner );    
        
    new 
sModel32 ];
    
    
peviEntpev_modelsModelcharsmaxsModel ) );
    
    if( 
equalsModel"models/w_smokegrenade.mdl" ) ) 
    { 
        
set_peviEntpev_renderfxkRenderFxGlowShell );
        
set_peviEntpev_renderamt125.0 );
        
set_peviEntpev_rendermodekRenderTransAlpha );
        
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
pev(iEntpev_rendercolor0.00.0255.0
        }
        else if(
cs_get_user_team(id) == CS_TEAM_T)    
        {
            
pev(iEntpev_rendercolor255.00.00.0
        }        
        return 
FMRES_SUPERCEDE;
    }    
    return 
FMRES_IGNORED;


Quote:

I would rather hook SetModel or Spawn.
i use this "FM_Think", Because I want to block the explode of the smoke grenade.

<VeCo> 04-29-2012 15:14

Re: glow Smoke Grenade
 
I forgot to say that you should use set_pev instead of pev for rendercolor.

For blocking the explosion you can set pev_dmgtime to a higher value or removing the FL_ONGROUND flag:
PHP Code:

set_pev(iEnt,pev_flags,pev(iEnt,pev_flags) & ~FL_ONGROUND 


Mr.Waffle 04-29-2012 15:29

Re: glow Smoke Grenade
 
omg , its working :P
Thank you .
1 more question,
why its not block the smoke explode :
PHP Code:

return FMRES_SUPERCEDE

?

NVM , SOLVED ..
THX U FOR THE HELP!

<VeCo> 04-29-2012 15:36

Re: glow Smoke Grenade
 
Grenades never think.


All times are GMT -4. The time now is 07:49.

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