Raised This Month: $51 Target: $400
 12% 

Problem with frostnades


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
krzyzak333
Junior Member
Join Date: Mar 2009
Location: Poland
Old 01-16-2010 , 06:09   Problem with frostnades
Reply With Quote #1

I was trying to cut frostnades from http://forums.alliedmods.net/showthread.php?t=74468 but when I started this plugin it doesn't work.

My .sma:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <engine>

#if defined CUSTOM_NADES
    #define NADE_TYPES 3
    
new const NADE_MODEL[NADE_TYPES][] = {"models/w_hegrenade.mdl""models/w_flashbang.mdl""models/w_smokegrenade.mdl"}
#endif

#define PLUGIN "Frostnade"
#define VERSION "1.0"
#define AUTHOR "MeRcyLeZZ"

#define TEAM_T 1
#define TEAM_CT 2

#define TASK_FROSTNADE    1100

enum 
{
    
TA_T,
    
TA_CT,
    
TA_SIZE
}

new 
cvar_hudcolor;
new 
cvar_fadecolor;
new 
cvar_frostnade_color;
new 
cvar_frostnade_duration;
new 
cvar_frostnade_frostself;
new 
cvar_frostnade_dmg;

new const 
sound_frost[]     = "warcraft3/frostnova.wav";    
new const 
sound_frost_player[] = "warcraft3/impalehit.wav";    
new const 
sound_frost_break[] = "warcraft3/impalelaunch1.wav";
new const 
model_frostnade[] = "models/glassgibs.mdl";
new const 
model_frostnade_trail[] = "sprites/laserbeam.spr";
new const 
model_frostnade_explotion[] = "sprites/shockwave.spr";

new 
frostnade;
new 
frostnade_trail;
new 
frostnade_explotion;

new 
g_msgid_screenfade;
new 
g_timer;

new 
bool:bool_frosted[33];
new 
bool:bool_checkfrost[33];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_touch("grenade""player""touch_nade")
    
register_event"Damage""event_damage_he""be" )
    
    
cvar_hudcolor            register_cvar("hns_hudcolor""255 0 0")
    
cvar_fadecolor            register_cvar("hns_fadecolor""random")
    
cvar_frostnade_color        register_cvar("hns_frostnade_color""255 0 0")
    
cvar_frostnade_duration        register_cvar("hns_frostnade_duration""5")
    
cvar_frostnade_frostself    register_cvar("hns_frostnade_frostself""1")
    
cvar_frostnade_dmg        register_cvar("hns_frostnade_dmg""0")
    
    
g_msgid_screenfade     get_user_msgid("ScreenFade");
    
    
register_message(g_msgid_screenfade"message_screenfade");
    
    
register_forward(FM_PlayerPreThink,"fwd_playerprethink");
    
register_forward(FM_PlayerPostThink"fwd_playerpostthink")
    
register_forward(FM_Think,"fwd_think");
    
register_forward(FM_Touch"fwd_touch");
    
register_forward(FM_SetModel"fwd_setmodel");
    
register_forward(FM_AlertMessage"fwd_alertmessage");
    
register_forward(FM_CreateNamedEntity"fwd_createnamedentity");
    
register_forward(FM_GetGameDescription,"fwd_getgamedescription");
}

public 
plugin_cfg()
{
    new 
file[64]; 
    
    
get_configsdir(file63)
    
format(file63"%s/frost.cfg"file)
    
    if(
file_exists(file)) 
        
server_cmd("exec %s"file), server_exec()
}

public 
plugin_precache()
{
    
precache_sound(sound_frost)
    
precache_sound(sound_frost_player)
    
precache_sound(sound_frost_break)
    
    
frostnade         precache_model(model_frostnade)
    
frostnade_trail         precache_model(model_frostnade_trail)
    
frostnade_explotion     precache_model(model_frostnade_explotion)
}

public 
logevent_startround()
{
    
remove_task(TASK_FROSTNADE)
}

public 
fwd_setmodel(entity, const model[]) 
{
    
// Get grenade owner
    
static id
    id 
pev(entitypev_owner);
    
    
// Grenade not yet thrown or owner not a player
    
if (!is_user_connected(id))
        return 
FMRES_IGNORED;
    
    if (
equal(model,"models/w_smokegrenade.mdl")) // frost grenade 
    
{
        new 
rgb;
        
get_color(rgb3)
        
        
// Give it a glow
        
fm_set_rendering(entity,kRenderFxGlowShellrgbkRenderNormal16);
        
        
// And a colored trail
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_BEAMFOLLOW);
        
write_short(entity);    // entity
        
write_short(frostnade_trail);// sprite
        
write_byte(10);        // life
        
write_byte(10);        // width
        
write_byte(r);        // r
        
write_byte(g);        // g
        
write_byte(b);        // b
        
write_byte(200);    // brightness
        
message_end();
        
        
// Prevent flashbang from exploding
        
set_pev(entitypev_nextthinkget_gametime() +2.0);
        
        static 
args[2// our task params
        
args[0] = entity// entity id
        
args[1] = id;
        
        
// Actual explode event
        
set_task(1.5"task_frost"TASK_FROSTNADEargssizeof args)
    }
    return 
FMRES_IGNORED;
}

/* FORWARDS */

public fwd_playerprethink(id)
{
    if(
is_user_alive(id)) 
    {
        if (
bool_frosted[id]) 
        {
            
set_pev(idpev_velocityFloat:{0.0,0.0,0.0})     // stop motion            
            
set_pev(idpev_flagspev(idpev_flags) | FL_FROZEN); // prevent from moving
        
}
        
        else if(
bool_checkfrost[id])
        {
            if(
g_timer <= || get_user_team(id) == 1)
                
set_pev(idpev_flagspev(idpev_flags) & ~FL_FROZEN); // prevent from moving
        
}
        
    }
    return 
FMRES_IGNORED;
}

public 
event_deathmsg()
{
    new 
id read_data(2);
    
set_task(0.1"task_removefrost"id)
    
set_pev(idpev_flagspev(idpev_flags) & ~FL_FROZEN);
}

public 
task_frost(const args[2]) 
{     
    static 
ent
    ent 
args[0]
    
    new 
id args[1];
    
// invalid entity
    
if (!pev_valid(ent)) return;
    
    
// get origin
    
static origin[3], Float:originF[3]
    
pev(entpev_originoriginF);
    
FVecIVec(originForigin);

    
// explosion
    
create_blast3(origin);

    
// frost nade explode sound
    
engfunc(EngFunc_EmitSoundentCHAN_WEAPONsound_frost1.0ATTN_NORM0PITCH_NORM)
    
    
// collisions
    
static victim
    victim 
= -1;
    
    while((
victim engfunc(EngFunc_FindEntityInSpherevictimoriginF240.0)) != 0
    {
        if(
get_pcvar_num(cvar_frostnade_frostself))
        {
            if(!
is_user_alive(victim) || bool_frosted[victim] || get_user_team(id) == get_user_team(victim))
            {
                if(
victim != id || !is_user_alive(id))
                    continue;
                
            }
        }
        
        else 
        {
                if(!
is_user_alive(victim) || bool_frosted[victim] || get_user_team(id) == get_user_team(victim))
                    continue;
        }
        
    
        new 
rgb;
        
get_color(rgb3)        
        
        
// light blue glow while freezed
        
fm_set_rendering(victim,kRenderFxGlowShell,,gb,kRenderNormal,25)
        
        
// play freeze sound
        
engfunc(EngFunc_EmitSoundvictimCHAN_WEAPONsound_frost_player1.0ATTN_NORM0PITCH_NORM)
        
        
// add a blue tint to their screen
        
message_begin(MSG_ONEg_msgid_screenfade_victim);
        
write_short(~0); // duration
        
write_short(~0); // hold time
        
write_short(0x0004); // flags: FFADE_STAYOUT
        
write_byte(r); // red
        
write_byte(g); // green
        
write_byte(b); // blue
        
write_byte(100); // alpha
        
message_end();
        
        
// prevent from jumping
        
if (pev(victimpev_flags) & FL_ONGROUND)
            
set_pev(victimpev_gravity999999.9// set really high
        
else
            
set_pev(victimpev_gravity0.000001// no gravity
        
        
if(get_pcvar_num(cvar_frostnade_dmg))
        {
            new 
Float:health;
            
pev(victimpev_healthhealth);
            
            
health -= float(get_pcvar_num(cvar_frostnade_dmg))
            
            if(
health <= 0)
            {
                
user_silentkill(victim);
                
make_deathmsg(idvictim0"frostnade")
            }
            
            else
                
set_pev(victimpev_healthhealth);
        }
        
        
// freeze the victim, and set a task to remove the freeze
        
bool_frosted[victim] = true;    
        
bool_checkfrost[victim] = true;
        
set_task(get_pcvar_float(cvar_frostnade_duration), "task_removefrost"victim)
    }

    
// get rid of the old grenade
    
engfunc(EngFunc_RemoveEntityent)
}

public 
task_removefrost(id) {
    if (!
bool_frosted[id]) // not alive / not frozen anymore
        
return;
    
    
// unfreeze
    
bool_frosted[id] = false;
    
set_task(1.0"task_checkfrost"id)
    
    
// restore normal gravity
    
set_pev(idpev_gravity1.0)
    
    
// play the broken glass sound
    
engfunc(EngFunc_EmitSoundidCHAN_VOICEsound_frost_break1.0ATTN_NORM0PITCH_NORM)
    
    
fm_set_rendering(id)
    
    
// clear screen fade
    
message_begin(MSG_ONEg_msgid_screenfade_id);
    
write_short(0); // duration
    
write_short(0); // hold time
    
write_short(0); // flags
    
write_byte(0); // red
    
write_byte(0); // green
    
write_byte(0); // blue
    
write_byte(0); // alpha
    
message_end();
    
    
// get player's origin
    
static origin[3], Float:originF[3]
    
pev(idpev_originoriginF)
    
FVecIVec(originForigin)

    
// glass shatter
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BREAKMODEL);
    
write_coord(origin[0]);        // x
    
write_coord(origin[1]);        // y
    
write_coord(origin[2] + 24);    // z
    
write_coord(16);        // size x
    
write_coord(16);        // size y
    
write_coord(16);        // size z
    
write_coord(random_num(-50,50));// velocity x
    
write_coord(random_num(-50,50));// velocity y
    
write_coord(25);        // velocity z
    
write_byte(10);            // random velocity
    
write_short(frostnade);        // model
    
write_byte(10);            // count
    
write_byte(25);            // life
    
write_byte(0x01);        // flags: BREAK_GLASS
    
message_end();
}

public 
task_checkfrost(id) {
    
bool_checkfrost[id] = false;
}
    
get_color(&red, &grn, &blucvarid)
{
    new 
color[16], r[4], g[4], b[4];
    
    if(
cvarid == 1)
        
get_pcvar_string(cvar_hudcolorcolor15)
        
    else if(
cvarid == 2)
        
get_pcvar_string(cvar_fadecolorcolor15)
    
        
    else if(
cvarid == 3)
        
get_pcvar_string(cvar_frostnade_colorcolor15)
        
    
parse(colorr3g3b3)
    
    
red str_to_num(r);
    
grn str_to_num(g);
    
blu str_to_num(b);
}

create_blast3(const origin[3]) {
    
// smallest ring
    
new rgb;
    
get_color(rgb3)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMCYLINDER);
    
write_coord(origin[0]); // start X
    
write_coord(origin[1]); // start Y
    
write_coord(origin[2]); // start Z
    
write_coord(origin[0]); // something X
    
write_coord(origin[1]); // something Y
    
write_coord(origin[2] + 385); // something Z
    
write_short(frostnade_explotion); // sprite
    
write_byte(0); // startframe
    
write_byte(0); // framerate
    
write_byte(4); // life
    
write_byte(60); // width
    
write_byte(0); // noise
    
write_byte(r); // red
    
write_byte(g); // green
    
write_byte(b); // blue
    
write_byte(200); // brightness
    
write_byte(0); // speed
    
message_end();

    
// medium ring
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMCYLINDER);
    
write_coord(origin[0]); // start X
    
write_coord(origin[1]); // start Y
    
write_coord(origin[2]); // start Z
    
write_coord(origin[0]); // something X
    
write_coord(origin[1]); // something Y
    
write_coord(origin[2] + 470); // something Z
    
write_short(frostnade_explotion); // sprite
    
write_byte(0); // startframe
    
write_byte(0); // framerate
    
write_byte(4); // life
    
write_byte(60); // width
    
write_byte(0); // noise
    
write_byte(r); // red
    
write_byte(g); // green
    
write_byte(b); // blue
    
write_byte(200); // brightness
    
write_byte(0); // speed
    
message_end();

    
// largest ring
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMCYLINDER);
    
write_coord(origin[0]); // start X
    
write_coord(origin[1]); // start Y
    
write_coord(origin[2]); // start Z
    
write_coord(origin[0]); // something X
    
write_coord(origin[1]); // something Y
    
write_coord(origin[2] + 555); // something Z
    
write_short(frostnade_explotion); // sprite
    
write_byte(0); // startframe
    
write_byte(0); // framerate
    
write_byte(4); // life
    
write_byte(60); // width
    
write_byte(0); // noise
    
write_byte(r); // red
    
write_byte(g); // green
    
write_byte(b); // blue
    
write_byte(200); // brightness
    
write_byte(0); // speed
    
message_end();

I am newbie scripter so please help me
(Sorry for my bad english. I'm from Poland)
krzyzak333 is offline
krzyzak333
Junior Member
Join Date: Mar 2009
Location: Poland
Old 02-04-2010 , 15:12   Re: Problem with frostnades
Reply With Quote #2

~~BUMP~~
Please help me
krzyzak333 is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-04-2010 , 16:00   Re: Problem with frostnades
Reply With Quote #3

If you need frostnades plugin then you can use this: https://forums.alliedmods.net/showthread.php?t=41126
__________________
Impossible is Nothing
Sylwester is offline
krzyzak333
Junior Member
Join Date: Mar 2009
Location: Poland
Old 02-04-2010 , 16:19   Re: Problem with frostnades
Reply With Quote #4

Yeah, I know, but in https://forums.alliedmods.net/showthread.php?t=41126 these frostnades when somebody is freezed, he can fire weapon etc. and players can be chilled. I want only freeze.
krzyzak333 is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-04-2010 , 17:44   Re: Problem with frostnades
Reply With Quote #5

PM Avalanche?
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
CeriasZ
New Member
Join Date: Jun 2012
Old 06-10-2012 , 05:44   Re: Problem with frostnades
Reply With Quote #6

I have a problem with frostnades, because when a terror use frostnade in his area he will freeze to and ct can kill him.

[Sorry for my bad English]
CeriasZ is offline
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 16:40.


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