AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   New Smoke Explode (https://forums.alliedmods.net/showthread.php?t=231408)

Andu. 12-14-2013 03:52

New Smoke Explode
 
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?

Bos93 12-14-2013 22:14

Re: New Smoke Explode
 
https://forums.alliedmods.net/showpo...6&postcount=16

Andu. 12-15-2013 02:57

Re: New Smoke Explode
 
Thanks :D


All times are GMT -4. The time now is 20:36.

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