Raised This Month: $99 Target: $400
 24% 

Muzzle Flash Simple Edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
By Hazard
Member
Join Date: Jan 2016
Old 07-17-2019 , 09:09   Muzzle Flash Simple Edit
Reply With Quote #1

Can you make muzzle fire spray for every weapon?

Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_NAME                    "New MuzzleFlash"
#define PLUGIN_VERSION                "Alpha"
#define PLUGIN_AUTHOR                "WPMG Team"

#define get_bit(%1,%2)        (%1 & (1 << (%2 & 31)))
#define set_bit(%1,%2)        %1 |= (1 << (%2 & 31))
#define reset_bit(%1,%2)    %1 &= ~(1 << (%2 & 31))

new g_bitsMuzzleFlash;

new g_iEntity;

public plugin_precache()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
    
    precache_model("sprites/muzzleflash866.spr");
    
    g_iEntity = create_entity("info_target");
    
    entity_set_model(g_iEntity, "sprites/muzzleflash866.spr");
    
    entity_set_float(g_iEntity, EV_FL_scale, 0.2);
    
    //entity_set_vector(g_iEntity, EV_VEC_angles, Float:{0.0, 0.0, 90.0});
    
    entity_set_int(g_iEntity, EV_INT_rendermode, kRenderTransTexture);
    entity_set_float(g_iEntity, EV_FL_renderamt, 0.0);
}

public plugin_init()
{
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m249", "CM249__PrimaryAttack_Post", 1);
    
    register_forward(FM_AddToFullPack, "CPlayer__AddToFullPack_post", 1);
    
    register_forward(FM_CheckVisibility, "CEntity__CheckVisibility");
}

public CEntity__CheckVisibility(iEntity, pSet)
{
    if (iEntity != g_iEntity)
        return FMRES_IGNORED;
    
    forward_return(FMV_CELL, 1);
    
    return FMRES_SUPERCEDE;
}

public CM249__PrimaryAttack_Post(iEntity)
{
    new iPlayerID = get_pdata_cbase(iEntity, 41, 4);
    
    set_bit(g_bitsMuzzleFlash, iPlayerID);
}

public CPlayer__AddToFullPack_post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
    if (iEnt != g_iEntity)
        return;
    
    if (get_bit(g_bitsMuzzleFlash, iHost))
    {
        set_es(esState, ES_Frame, float(random_num(0, 2)));
        
        set_es(esState, ES_RenderMode, kRenderTransAdd);
        set_es(esState, ES_RenderAmt, 255.0);
        
        reset_bit(g_bitsMuzzleFlash, iHost);
    }
    
    set_es(esState, ES_Skin, iHost);
    set_es(esState, ES_Body, 1);
    set_es(esState, ES_AimEnt, iHost);
    set_es(esState, ES_MoveType, MOVETYPE_FOLLOW);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
By Hazard is offline
Reply


Thread Tools
Display Modes

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 21:10.


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