Raised This Month: $ Target: $400
 0% 

New Smoke Explode


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Andu.
Member
Join Date: Oct 2013
Location: Belgravistan
Old 12-14-2013 , 03:52   New Smoke Explode
Reply With Quote #1

In this code

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>

#define PLUGIN "New Smoke Effect"
#define VERSION "0.0.1"

#define message_begin_fl(%1,%2,%3,%4) engfunc(EngFunc_MessageBegin, %1, %2, %3, %4)
#define write_coord_fl(%1) engfunc(EngFunc_WriteCoord, %1)

#define FROST_RADIUS        240.0

new smokeSpr,exploSpr,pcv_color;
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONauthor)
    
RegisterHam(Ham_Think,"grenade","ham_grenade_think",0);
    
pcv_color register_cvar("fn_color","0 206 209");
}

public 
plugin_precache()
{
    
smokeSpr precache_model("sprites/steam1.spr");
    
exploSpr precache_model("sprites/shockwave.spr");
}

public 
ham_grenade_think(ent)
{
    if(!
pev_valid(ent) || !pev(ent,pev_bInDuck)) return HAM_IGNORED;
    
    new 
Float:dmgtime;
    
pev(ent,pev_dmgtime,dmgtime);
    if(
dmgtime get_gametime()) return HAM_IGNORED;
    
    
frostnade_explode(ent);
    
    return 
HAM_SUPERCEDE;
}
public 
frostnade_explode(ent)
{
    new 
Float:nadeOrigin[3];
    
pev(ent,pev_origin,nadeOrigin);
    new 
nadeTeam pev(ent,pev_team)
    
    
message_begin_fl(MSG_PVS,SVC_TEMPENTITY,nadeOrigin,0);
    
write_byte(TE_SMOKE);
    
write_coord_fl(nadeOrigin[0]); // x
    
write_coord_fl(nadeOrigin[1]); // y
    
write_coord_fl(nadeOrigin[2]); // z
    
write_short(smokeSpr); // sprite
    
write_byte(random_num(30,40)); // scale
    
write_byte(5); // framerate
    
message_end();
    
    
create_blast(nadeTeam,nadeOrigin);
}

public 
create_blast(team,Float:origin[3])
{
    new 
rgb[3];
    
get_rgb_colors(team,rgb);
    
    
// smallest ring
    
message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0);
    
write_byte(TE_BEAMCYLINDER);
    
write_coord_fl(origin[0]); // x
    
write_coord_fl(origin[1]); // y
    
write_coord_fl(origin[2]); // z
    
write_coord_fl(origin[0]); // x axis
    
write_coord_fl(origin[1]); // y axis
    
write_coord_fl(origin[2] + 385.0); // z axis
    
write_short(exploSpr); // sprite
    
write_byte(0); // start frame
    
write_byte(0); // framerate
    
write_byte(4); // life
    
write_byte(60); // width
    
write_byte(0); // noise
    
write_byte(rgb[0]); // red
    
write_byte(rgb[1]); // green
    
write_byte(rgb[2]); // blue
    
write_byte(100); // brightness
    
write_byte(0); // speed
    
message_end();

    
// medium ring
    
message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0);
    
write_byte(TE_BEAMCYLINDER);
    
write_coord_fl(origin[0]); // x
    
write_coord_fl(origin[1]); // y
    
write_coord_fl(origin[2]); // z
    
write_coord_fl(origin[0]); // x axis
    
write_coord_fl(origin[1]); // y axis
    
write_coord_fl(origin[2] + 470.0); // z axis
    
write_short(exploSpr); // sprite
    
write_byte(0); // start frame
    
write_byte(0); // framerate
    
write_byte(4); // life
    
write_byte(60); // width
    
write_byte(0); // noise
    
write_byte(rgb[0]); // red
    
write_byte(rgb[1]); // green
    
write_byte(rgb[2]); // blue
    
write_byte(100); // brightness
    
write_byte(0); // speed
    
message_end();

    
// largest ring
    
message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0);
    
write_byte(TE_BEAMCYLINDER);
    
write_coord_fl(origin[0]); // x
    
write_coord_fl(origin[1]); // y
    
write_coord_fl(origin[2]); // z
    
write_coord_fl(origin[0]); // x axis
    
write_coord_fl(origin[1]); // y axis
    
write_coord_fl(origin[2] + 555.0); // z axis
    
write_short(exploSpr); // sprite
    
write_byte(0); // start frame
    
write_byte(0); // framerate
    
write_byte(4); // life
    
write_byte(60); // width
    
write_byte(0); // noise
    
write_byte(rgb[0]); // red
    
write_byte(rgb[1]); // green
    
write_byte(rgb[2]); // blue
    
write_byte(100); // brightness
    
write_byte(0); // speed
    
message_end();

    
// light effect
    
message_begin_fl(MSG_PAS,SVC_TEMPENTITY,origin,0);
    
write_byte(TE_DLIGHT);
    
write_coord_fl(origin[0]); // x
    
write_coord_fl(origin[1]); // y
    
write_coord_fl(origin[2]); // z
    
write_byte(floatround(FROST_RADIUS/5.0)); // radius
    
write_byte(rgb[0]); // r
    
write_byte(rgb[1]); // g
    
write_byte(rgb[2]); // b
    
write_byte(8); // life
    
write_byte(60); // decay rate
    
message_end();
}

get_rgb_colors(team,rgb[3])
{
    static 
color[12], parts[3][4];
    
get_pcvar_string(pcv_color,color,11);
    
    
// if cvar is set to "team", use colors based on the given team
    
if(equali(color,"team",4))
    {
        if(
team == 1)
        {
            
rgb[0] = 150;
            
rgb[1] = 0;
            
rgb[2] = 0;
        }
        else
        {
            
rgb[0] = 0;
            
rgb[1] = 0;
            
rgb[2] = 150;
        }
    }
    else
    {
        
parse(color,parts[0],3,parts[1],3,parts[2],3);
        
rgb[0] = str_to_num(parts[0]);
        
rgb[1] = str_to_num(parts[1]);
        
rgb[2] = str_to_num(parts[2]);
    }

How i can detect if the entity is smokegrenade?

Last edited by Andu.; 12-14-2013 at 03:53.
Andu. is offline
 



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 20:36.


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