AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to show weapon muzzleflash (https://forums.alliedmods.net/showthread.php?t=214437)

wai 04-27-2013 06:28

How to show weapon muzzleflash
 
When weapon shooting,how to show weapon muzzleflash.spr:?:
eg:muzzleflash11.spr

Bos93 04-27-2013 07:54

Re: How to show weapon muzzleflash
 
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);



wai 05-01-2013 02:58

Re: How to show weapon muzzleflash
 
Quote:

Originally Posted by Bos93 (Post 1940888)
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?

Bos93 05-01-2013 10:59

Re: How to show weapon muzzleflash
 
Register RegisterHam(Ham_Weapon_PrimaryAttack for all weapons

ScoobyDooo 07-16-2013 00:51

Re: How to show weapon muzzleflash
 
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 ?

Bos93 07-16-2013 01:32

Re: How to show weapon muzzleflash
 
Remove in the model and update it on the server. muzzleflash - client-side

ScoobyDooo 07-16-2013 01:43

Re: How to show weapon muzzleflash
 
Quote:

Originally Posted by Bos93 (Post 1991858)
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 ?

Bos93 07-16-2013 02:08

Re: How to show weapon muzzleflash
 
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

ScoobyDooo 07-16-2013 03:00

Re: How to show weapon muzzleflash
 
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?

Bos93 07-16-2013 03:05

Re: How to show weapon muzzleflash
 
check your clip?


All times are GMT -4. The time now is 10:58.

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