Raised This Month: $ Target: $400
 0% 

Grenade Glow


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-08-2007 , 17:02   Grenade Glow
Reply With Quote #1

How do I make grenades glow for SvenCoop?
Dark Kingdom is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 04-08-2007 , 18:49   Re: Grenade Glow
Reply With Quote #2

You can hook FM_SetModel and test if the entity is having its model set to a grenade. If so, set the entity's effects that way.

For Example:

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> // Set the model you wish to make glow here new const g_szGrenadeMdl[] = "models/w_grenade.mdl"; public plugin_init() {     register_forward( FM_SetModel, "hook_SetModel_post", 1 ); } public hook_SetModel_post( ent, const szMdl[] ) {     // If model being set equals the global string of the grenade model     if( equal( szMdl, g_szGrenadeMdl ) )     {         // Set Glow Effect         set_pev( ent, pev_renderfx, kRenderFxGlowShell );         set_pev( ent, pev_renderamt, 125.0 );         set_pev( ent, pev_rendermode, kRenderTransAlpha );         set_pev( ent, pev_rendercolor, {0.0, 255.0, 0.0} );     } }
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician

Last edited by Wilson [29th ID]; 04-09-2007 at 20:20.
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-08-2007 , 19:05   Re: Grenade Glow
Reply With Quote #3

Your Example, is giving my errors when I compile it.
Dark Kingdom is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 04-08-2007 , 19:49   Re: Grenade Glow
Reply With Quote #4

Well post them.

Make sure you include above the very first line the regular includes

#include <amxmodx>
#include <amxmisc>
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-09-2007 , 06:45   Re: Grenade Glow
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>


new const g_szGrenadeMdl "models/w_grenade.mdl"

public plugin_init() {
    
register_forwardFM_SetModel"hook_SetModel_post")
}

public 
hook_SetModel_postent, const szMdl[] )
 
    if( 
equalszMdlg_szGrenadeMdl ) )
    {
        
set_peventpev_renderfxkRenderFxGlowShell )
        
set_peventpev_renderamt125.0 )
        
set_peventpev_rendermodekRenderTransAlpha )
        
set_peventpev_rendercolor, {0.0255.00.0} )
    }

Compiles with

Code:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/phpGNlx58.sma(12) : warning 218: old style prototypes used with optional semicolumns
/home/groups/amxmodx/tmp3/phpGNlx58.sma(14) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpGNlx58.sma(17) : error 021: symbol already defined: "set_pev"
/home/groups/amxmodx/tmp3/phpGNlx58.sma(23) : warning 203: symbol is never used: "g_szGrenadeMdl"

2 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpGNlx58.amx (compile failed).
Dark Kingdom is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 04-09-2007 , 12:25   Re: Grenade Glow
Reply With Quote #6

Dear god I for got a Squiggly thing! On the public hook_SetModel_post line, add a { at the end
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-09-2007 , 14:22   Re: Grenade Glow
Reply With Quote #7

Lol...
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

public plugin_init() {
    
register_forwardFM_SetModel"hook_SetModel_post")
}

public 
hook_SetModel_postent, const szMdl[] ){
 
    if( 
equaliszMdl"models/w_grenade.mdl" ) )
    {
        
set_peventpev_renderfxkRenderFxGlowShell )
        
set_peventpev_renderamt125.0 )
        
set_peventpev_rendermodekRenderTransAlpha )
        
set_peventpev_rendercolor, {0.0255.00.0} )
    }

__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 04-09-2007 , 20:19   Re: Grenade Glow
Reply With Quote #8

No, Nican...use global const's for strings. Read about optimization.

I wrote the original thing in a rush -- forgot the [] for the global const too. Check up top it's fixed in my original thread.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Drak
Veteran Member
Join Date: Jul 2005
Old 05-08-2007 , 16:03   Re: Grenade Glow
Reply With Quote #9

Quote:
Originally Posted by Wilson [29th ID] View Post
No, Nican...use global const's for strings. Read about optimization.

I wrote the original thing in a rush -- forgot the [] for the global const too. Check up top it's fixed in my original thread.
I know this is a somewhat old thread. But I couldn't find much information on this, why is it better to use a global, instead of what Nican did? (What's making it perform better?)
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
pRED*
Join Date: Dec 2006
Old 05-08-2007 , 19:22   Re: Grenade Glow
Reply With Quote #10

http://wiki.amxmodx.org/Optimizing_P...tant_variables

Pretty useful page. Really should pay more attention to it myself
pRED* 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 06:39.


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