Thread: Flash
View Single Post
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world :)
Old 11-30-2012 , 18:45   Re: Flash
Reply With Quote #3

Quote:
Originally Posted by tyin View Post
That one is too old.. use this for efficiency. (Better code, faster)
PHP Code:
#include <amxmodx>

#define PLUGIN    "Colored Flashbangs"
#define VERSION    "1.0"
#define AUTHOR    "v3x"

new g_pModeg_pColors[3]

public 
plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
register_message(get_user_msgid("ScreenFade"), "FlashedEvent")
    
// Cvars
    
g_pMode register_cvar("amx_fb_mode""1")
    
g_pColors[0] = register_cvar("amx_fb_r",    "255")
    
g_pColors[1] = register_cvar("amx_fb_g",    "25")
    
g_pColors[2] = register_cvar("amx_fb_b",    "25")
}

public 
FlashedEvent()
{
    new 
iMode
    
if( !(iMode get_pcvar_num(g_pMode) ) )
        return;
        
    if(
get_msg_arg_int(4) !=255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 199)
        return;
    
    switch(
iMode)
    {
        case 
1:
        {
            
set_msg_arg_int(4ARG_BYTEget_pcvar_num(g_pColors[0]))
            
set_msg_arg_int(5ARG_BYTEget_pcvar_num(g_pColors[1]))
            
set_msg_arg_int(6ARG_BYTEget_pcvar_num(g_pColors[2]))
        }

        case 
2:
        {
            
set_msg_arg_int(4ARG_BYTErandom_num(0,255))
            
set_msg_arg_int(5ARG_BYTErandom_num(0,255))
            
set_msg_arg_int(6ARG_BYTErandom_num(0,255))
        }
    }
    

__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 11-30-2012 at 18:52.
pokemonmaster is offline