Raised This Month: $ Target: $400
 0% 

How to show weapon muzzleflash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wai
New Member
Join Date: Dec 2012
Old 04-27-2013 , 06:28   How to show weapon muzzleflash
Reply With Quote #1

When weapon shooting,how to show weapon muzzleflash.spr
eg:muzzleflash11.spr
wai is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 04-27-2013 , 07:54   Re: How to show weapon muzzleflash
Reply With Quote #2

PHP 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_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
    
precache_model("sprites/muzzleflash8.spr");
    
    
g_iEntity create_entity("info_target");
    
    
entity_set_model(g_iEntity"sprites/muzzleflash8.spr");
    
    
entity_set_float(g_iEntityEV_FL_scale0.2);
    
    
//entity_set_vector(g_iEntity, EV_VEC_angles, Float:{0.0, 0.0, 90.0});
    
    
entity_set_int(g_iEntityEV_INT_rendermodekRenderTransTexture);
    
entity_set_float(g_iEntityEV_FL_renderamt0.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(iEntitypSet)
{
    if (
iEntity != g_iEntity)
        return 
FMRES_IGNORED;
    
    
forward_return(FMV_CELL1);
    
    return 
FMRES_SUPERCEDE;
}

public 
CM249__PrimaryAttack_Post(iEntity)
{
    new 
iPlayerID get_pdata_cbase(iEntity414);
    
    
set_bit(g_bitsMuzzleFlashiPlayerID);
}

public 
CPlayer__AddToFullPack_post(esStateiEiEntiHostiHostFlagsiPlayerpSet)
{
    if (
iEnt != g_iEntity)
        return;
    
    if (
get_bit(g_bitsMuzzleFlashiHost))
    {
        
set_es(esStateES_Framefloat(random_num(02)));
            
        
set_es(esStateES_RenderModekRenderTransAdd);
        
set_es(esStateES_RenderAmt255.0);
        
        
reset_bit(g_bitsMuzzleFlashiHost);
    }
        
    
set_es(esStateES_SkiniHost);
    
set_es(esStateES_Body1);
    
set_es(esStateES_AimEntiHost);
    
set_es(esStateES_MoveTypeMOVETYPE_FOLLOW);

__________________

Last edited by Bos93; 04-27-2013 at 18:20.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
wai
New Member
Join Date: Dec 2012
Old 05-01-2013 , 02:58   Re: How to show weapon muzzleflash
Reply With Quote #3

Quote:
Originally Posted by Bos93 View Post
PHP 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_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
    
precache_model("sprites/muzzleflash8.spr");
    
    
g_iEntity create_entity("info_target");
    
    
entity_set_model(g_iEntity"sprites/muzzleflash8.spr");
    
    
entity_set_float(g_iEntityEV_FL_scale0.2);
    
    
//entity_set_vector(g_iEntity, EV_VEC_angles, Float:{0.0, 0.0, 90.0});
    
    
entity_set_int(g_iEntityEV_INT_rendermodekRenderTransTexture);
    
entity_set_float(g_iEntityEV_FL_renderamt0.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(iEntitypSet)
{
    if (
iEntity != g_iEntity)
        return 
FMRES_IGNORED;
    
    
forward_return(FMV_CELL1);
    
    return 
FMRES_SUPERCEDE;
}

public 
CM249__PrimaryAttack_Post(iEntity)
{
    new 
iPlayerID get_pdata_cbase(iEntity414);
    
    
set_bit(g_bitsMuzzleFlashiPlayerID);
}

public 
CPlayer__AddToFullPack_post(esStateiEiEntiHostiHostFlagsiPlayerpSet)
{
    if (
iEnt != g_iEntity)
        return;
    
    if (
get_bit(g_bitsMuzzleFlashiHost))
    {
        
set_es(esStateES_Framefloat(random_num(02)));
            
        
set_es(esStateES_RenderModekRenderTransAdd);
        
set_es(esStateES_RenderAmt255.0);
        
        
reset_bit(g_bitsMuzzleFlashiHost);
    }
        
    
set_es(esStateES_SkiniHost);
    
set_es(esStateES_Body1);
    
set_es(esStateES_AimEntiHost);
    
set_es(esStateES_MoveTypeMOVETYPE_FOLLOW);

Thanks for your help
But can make all the weapons change muzzleflash in the shooting?
wai is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 05-01-2013 , 10:59   Re: How to show weapon muzzleflash
Reply With Quote #4

Register RegisterHam(Ham_Weapon_PrimaryAttack for all weapons
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
ScoobyDooo
Member
Join Date: Aug 2008
Location: Romania, Bucharest
Old 07-16-2013 , 00:51   Re: How to show weapon muzzleflash
Reply With Quote #5

im sorry for reviving this thread, but i really need your help guys.
I used the plugin provided by Bos93 and it only changes one muzzleflash of 4( at least it seems so )
But why do i think that ? because when i fire with m4a1 ( i changed it only for m4a1 ) , it shows the new muzzleflash i put, but it also shows the original one.Every weapon has 3 or 4 right ? so i need to change all of them.
How do i change all of them ? Can someone help me ?

Last edited by ScoobyDooo; 07-16-2013 at 00:52.
ScoobyDooo is offline
Send a message via Yahoo to ScoobyDooo Send a message via Skype™ to ScoobyDooo
Bos93
Veteran Member
Join Date: Jul 2010
Old 07-16-2013 , 01:32   Re: How to show weapon muzzleflash
Reply With Quote #6

Remove in the model and update it on the server. muzzleflash - client-side
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
ScoobyDooo
Member
Join Date: Aug 2008
Location: Romania, Bucharest
Old 07-16-2013 , 01:43   Re: How to show weapon muzzleflash
Reply With Quote #7

Quote:
Originally Posted by Bos93 View Post
Remove in the model and update it on the server. muzzleflash - client-side
Wait, take it slowly with me.
Remove the model ? m4a1 models ? p_ v_ and w_ ?

And why is muzzleflash client-side ? i saw zp extra items ( for example plasma gun ) that uses it's own muzzleflash ( no others ) How is that possible ?
ScoobyDooo is offline
Send a message via Yahoo to ScoobyDooo Send a message via Skype™ to ScoobyDooo
Bos93
Veteran Member
Join Date: Jul 2010
Old 07-16-2013 , 02:08   Re: How to show weapon muzzleflash
Reply With Quote #8

ScoobyDooo,only v_, for p_ models you can hide with EF_MUZZLEFLASH


Quote:
And why is muzzleflash client-side ? i saw zp extra items ( for example plasma gun ) that uses it's own muzzleflash ( no others ) How is that possible ?
This is not a shot muzzleflash
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
ScoobyDooo
Member
Join Date: Aug 2008
Location: Romania, Bucharest
Old 07-16-2013 , 03:00   Re: How to show weapon muzzleflash
Reply With Quote #9

Ok, it works, with one small problem.
When you finish the bullets, and you keep pressing to shoot ( for example, m4a1, when you have 0/90) , it still shows the new muzzle flash ..what is it to be done?
ScoobyDooo is offline
Send a message via Yahoo to ScoobyDooo Send a message via Skype™ to ScoobyDooo
Bos93
Veteran Member
Join Date: Jul 2010
Old 07-16-2013 , 03:05   Re: How to show weapon muzzleflash
Reply With Quote #10

check your clip?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
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 10:58.


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