Raised This Month: $ Target: $400
 0% 

Winter Environment


Post New Thread Reply   
 
Thread Tools Display Modes
amokossi
Senior Member
Join Date: Apr 2008
Old 12-27-2010 , 15:31   Re: Winter Environment
Reply With Quote #81

Hi,

I also want to exchange the v_c4.mdl (Bomb in the HAnd while running).

Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Winter Environment"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define STEP_DELAY 0.5

new const g_szBombModels[][] = {

        "models/ch-m/c4-christmastree2.mdl",
        "models/ch-m/c4-christmastree.mdl",
        "models/ch-m/frost_man.mdl",
        "models/ch-m/present1.mdl"
};
new const g_szBombModelsHand[][] = {

        "models/ch-m/c4-hand.mdl"
};
new const g_szBombSounds[][] = {

        "ch-s/bmb_planted.wav",
        "ch-s/bmb_defused.wav",
        "ch-s/bmb_defuse_failure.wav"
};
new const g_szStepSound[][] = {

        "player/pl_snow1.wav",
        "player/pl_snow2.wav",
        "player/pl_snow3.wav",
        "player/pl_snow4.wav",
        "player/pl_snow5.wav",
        "player/pl_snow6.wav"
};
new g_iLedSprite;

new Float:g_fNextStep[33];

public plugin_init() {

        register_plugin(PLUGIN, VERSION, AUTHOR);
here also add something??
        register_forward(FM_SetModel, "fwd_SetModel", 1);
        register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink", 0);

        register_logevent("logevent_BombPlanted", 3, "2=Planted_The_Bomb");
        register_logevent("logevent_BombDefused", 3, "2=Defused_The_Bomb");
        register_logevent("logevent_BombExploded", 6, "3=Target_Bombed");

        register_message(SVC_TEMPENTITY, "message_TempEntity");
}

public plugin_precache()
{
        engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"));

        new i;
        for(i = 0 ; i < sizeof g_szBombModels ; i++)
                precache_model(g_szBombModels[i]);
        for(i = 0 ; i < sizeof g_szBombModelsHand ; i++)
                precache_model(g_szBombModelsHand[i]);
        for(i = 0 ; i < sizeof g_szBombSounds ; i++)
                precache_sound(g_szBombSounds[i]);
        for(i = 0 ; i < sizeof g_szStepSound ; i++)
                precache_sound(g_szStepSound[i]);

        g_iLedSprite = precache_model("sprites/ledglow.spr");
}

public fwd_SetModel(ent, const szModel[])
{
        if(!pev_valid(ent))
                return FMRES_IGNORED;

        if(equal(szModel, "models/w_c4.mdl"))
        {
                static iRndModel; iRndModel = random_num(0, sizeof g_szBombModels - 1);
                engfunc(EngFunc_SetModel, ent, g_szBombModels[iRndModel]);

                return FMRES_SUPERCEDE;
        }
 if(equal(szModel, "models/v_c4.mdl"))
        {
                static iRndModel; iRndModel = random_num(0, sizeof g_szBombModelsHand - 1);
                engfunc(EngFunc_SetModel, ent, g_szBombModelsHand[iRndModel]);

                return FMRES_SUPERCEDE;
        } 
        return FMRES_IGNORED;
}

public fwd_PlayerPreThink(id)
{
        if(!is_user_alive(id))
                return FMRES_IGNORED;

        static Float:fGmTime ; fGmTime = get_gametime();
        if(g_fNextStep[id] < fGmTime)
        {
                if(fm_get_user_speed(id) && (pev(id, pev_flags) & FL_ONGROUND) && is_user_outside(id))
                {
                        set_pev(id, pev_flTimeStepSound, 999);
                        engfunc(EngFunc_EmitSound, id, CHAN_AUTO, g_szStepSound[random_num(0, sizeof g_szStepSound - 1)], 0.5, ATTN_NORM, 0, PITCH_NORM);

                        g_fNextStep[id] = fGmTime + STEP_DELAY;
                }
        }
        return FMRES_IGNORED;
}

public logevent_BombPlanted()
{
        emit_sound(0, CHAN_AUTO, g_szBombSounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public logevent_BombDefused()
{
        client_cmd(0, "wait;stopsound");
        emit_sound(0, CHAN_AUTO, g_szBombSounds[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public logevent_BombExploded()
{
        emit_sound(0, CHAN_AUTO, g_szBombSounds[2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public message_TempEntity(msg_id, msg_dest, msg_ent)
{
        if(get_msg_arg_int(1) == TE_GLOWSPRITE)
        {
                if(get_msg_arg_int(5) == g_iLedSprite)
                        return PLUGIN_HANDLED;
        }
        return PLUGIN_CONTINUE;
}

stock Float:is_user_outside(id)
{
        new Float:vOrigin[3], Float:fDist;
        pev(id, pev_origin, vOrigin);

        fDist = vOrigin[2];

        while(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_EMPTY)
                vOrigin[2] += 5.0;

        if(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_SKY)
                return (vOrigin[2] - fDist);

        return 0.0;
}

stock Float:fm_get_user_speed(id)
{
        if(!is_user_connected(id))
                return 0.0;

        static Float:fVelocity[3];
        pev(id, pev_velocity, fVelocity);

        fVelocity[2] = 0.0;

        return vector_length(fVelocity);
}
something is wrong...

/groups/amxmodx/tmp3/textc2c06w.sma(82) : warning 217: loose indentation
/groups/amxmodx/tmp3/textc2c06w.sma(89) : warning 217: loose indentation
Header size: 768 bytes
Code size: 3672 bytes
Data size: 2636 bytes
Stack/heap size: 16384 bytes; estimated max. usage=42 cells (168 bytes)
Total requirements: 23460 bytes



Thx for any Help!
Ossi

Last edited by amokossi; 12-27-2010 at 15:34.
amokossi is offline
Send a message via ICQ to amokossi Send a message via MSN to amokossi
Rosenstein
Senior Member
Join Date: Feb 2008
Location: Serbia
Old 12-28-2010 , 11:20   Re: Winter Environment
Reply With Quote #82

Here, no more loose indents but I don't know will it work.

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

#define PLUGIN "Winter Environment"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define STEP_DELAY 0.5

new const g_szBombModels[][] = {

        
"models/ch-m/c4-christmastree2.mdl",
        
"models/ch-m/c4-christmastree.mdl",
        
"models/ch-m/frost_man.mdl",
        
"models/ch-m/present1.mdl"
};
new const 
g_szBombModelsHand[][] = {

        
"models/ch-m/c4-hand.mdl"
};
new const 
g_szBombSounds[][] = {

        
"ch-s/bmb_planted.wav",
        
"ch-s/bmb_defused.wav",
        
"ch-s/bmb_defuse_failure.wav"
};
new const 
g_szStepSound[][] = {

        
"player/pl_snow1.wav",
        
"player/pl_snow2.wav",
        
"player/pl_snow3.wav",
        
"player/pl_snow4.wav",
        
"player/pl_snow5.wav",
        
"player/pl_snow6.wav"
};
new 
g_iLedSprite;

new 
Float:g_fNextStep[33];

public 
plugin_init() {

        
register_plugin(PLUGINVERSIONAUTHOR);
        
register_forward(FM_SetModel"fwd_SetModel"1);
        
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink"0);

        
register_logevent("logevent_BombPlanted"3"2=Planted_The_Bomb");
        
register_logevent("logevent_BombDefused"3"2=Defused_The_Bomb");
        
register_logevent("logevent_BombExploded"6"3=Target_Bombed");

        
register_message(SVC_TEMPENTITY"message_TempEntity");
}

public 
plugin_precache()
{
        
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_snow"));

        new 
i;
        for(
sizeof g_szBombModels i++)
                
precache_model(g_szBombModels[i]);
        for(
sizeof g_szBombModelsHand i++)
                
precache_model(g_szBombModelsHand[i]);
        for(
sizeof g_szBombSounds i++)
                
precache_sound(g_szBombSounds[i]);
        for(
sizeof g_szStepSound i++)
                
precache_sound(g_szStepSound[i]);

        
g_iLedSprite precache_model("sprites/ledglow.spr");
}

public 
fwd_SetModel(ent, const szModel[])
{
        if(!
pev_valid(ent))
                return 
FMRES_IGNORED;

        if(
equal(szModel"models/w_c4.mdl"))
        {
                static 
iRndModeliRndModel random_num(0sizeof g_szBombModels 1);
                
engfunc(EngFunc_SetModelentg_szBombModels[iRndModel]);

                return 
FMRES_SUPERCEDE;
        }
    if(
equal(szModel"models/v_c4.mdl"))
        {
                static 
iRndModeliRndModel random_num(0sizeof g_szBombModelsHand 1);
                
engfunc(EngFunc_SetModelentg_szBombModelsHand[iRndModel]);

                return 
FMRES_SUPERCEDE;
        } 
    return 
FMRES_IGNORED;
}

public 
fwd_PlayerPreThink(id)
{
        if(!
is_user_alive(id))
                return 
FMRES_IGNORED;

        static 
Float:fGmTime fGmTime get_gametime();
        if(
g_fNextStep[id] < fGmTime)
        {
                if(
fm_get_user_speed(id) && (pev(idpev_flags) & FL_ONGROUND) && is_user_outside(id))
                {
                        
set_pev(idpev_flTimeStepSound999);
                        
engfunc(EngFunc_EmitSoundidCHAN_AUTOg_szStepSound[random_num(0sizeof g_szStepSound 1)], 0.5ATTN_NORM0PITCH_NORM);

                        
g_fNextStep[id] = fGmTime STEP_DELAY;
                }
        }
        return 
FMRES_IGNORED;
}

public 
logevent_BombPlanted()
{
        
emit_sound(0CHAN_AUTOg_szBombSounds[0], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
logevent_BombDefused()
{
        
client_cmd(0"wait;stopsound");
        
emit_sound(0CHAN_AUTOg_szBombSounds[1], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
logevent_BombExploded()
{
        
emit_sound(0CHAN_AUTOg_szBombSounds[2], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
message_TempEntity(msg_idmsg_destmsg_ent)
{
        if(
get_msg_arg_int(1) == TE_GLOWSPRITE)
        {
                if(
get_msg_arg_int(5) == g_iLedSprite)
                        return 
PLUGIN_HANDLED;
        }
        return 
PLUGIN_CONTINUE;
}

stock Float:is_user_outside(id)
{
        new 
Float:vOrigin[3], Float:fDist;
        
pev(idpev_originvOrigin);

        
fDist vOrigin[2];

        while(
engfunc(EngFunc_PointContentsvOrigin) == CONTENTS_EMPTY)
                
vOrigin[2] += 5.0;

        if(
engfunc(EngFunc_PointContentsvOrigin) == CONTENTS_SKY)
                return (
vOrigin[2] - fDist);

        return 
0.0;
}

stock Float:fm_get_user_speed(id)
{
        if(!
is_user_connected(id))
                return 
0.0;

        static 
Float:fVelocity[3];
        
pev(idpev_velocityfVelocity);

        
fVelocity[2] = 0.0;

        return 
vector_length(fVelocity);

__________________
+1
Rosenstein is offline
amokossi
Senior Member
Join Date: Apr 2008
Old 12-29-2010 , 15:30   Re: Winter Environment
Reply With Quote #83

Hm no its not working. Even if I do the following:
I used the original code. I deleted all the models in the upper part and only put the new inHandmodel (marked red). At the bottom where is defined which model have to be replaced I changed from w_c4.mdl to v_c4.mdl (marked red).
Its, precaching but not changing the model. I guess it should be possible to change also the inHand model if its possible to change the planted model right?

This is the model I wamt to use. The model is fine. It'S working if I use contentreplacement. but this plugin is crashing the server after each mapchange.
http://www.renemoerke.de/psych/c4-hand.mdl

Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Winter Environment"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define STEP_DELAY 0.5

new const g_szBombModels[][] = {

        "models/ch-m/c4-hand.mdl"
};
new const g_szBombSounds[][] = {

        "ch-s/bmb_planted.wav",
        "ch-s/bmb_defused.wav",
        "ch-s/bmb_defuse_failure.wav"
};
new const g_szStepSound[][] = {

        "player/pl_snow1.wav",
        "player/pl_snow2.wav",
        "player/pl_snow3.wav",
        "player/pl_snow4.wav",
        "player/pl_snow5.wav",
        "player/pl_snow6.wav"
};
new g_iLedSprite;

new Float:g_fNextStep[33];

public plugin_init() {

        register_plugin(PLUGIN, VERSION, AUTHOR);

        register_forward(FM_SetModel, "fwd_SetModel", 1);
        register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink", 0);

        register_logevent("logevent_BombPlanted", 3, "2=Planted_The_Bomb");
        register_logevent("logevent_BombDefused", 3, "2=Defused_The_Bomb");
        register_logevent("logevent_BombExploded", 6, "3=Target_Bombed");

        register_message(SVC_TEMPENTITY, "message_TempEntity");
}

public plugin_precache()
{
        engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"));

        new i;
        for(i = 0 ; i < sizeof g_szBombModels ; i++)
                precache_model(g_szBombModels[i]);
        for(i = 0 ; i < sizeof g_szBombSounds ; i++)
                precache_sound(g_szBombSounds[i]);
        for(i = 0 ; i < sizeof g_szStepSound ; i++)
                precache_sound(g_szStepSound[i]);

        g_iLedSprite = precache_model("sprites/ledglow.spr");
}

public fwd_SetModel(ent, const szModel[])
{
        if(!pev_valid(ent))
                return FMRES_IGNORED;

        if(equal(szModel, "models/v_c4.mdl"))
        {
                static iRndModel; iRndModel = random_num(0, sizeof g_szBombModels - 1);
                engfunc(EngFunc_SetModel, ent, g_szBombModels[iRndModel]);

                return FMRES_SUPERCEDE;
        }
        return FMRES_IGNORED;
}

public fwd_PlayerPreThink(id)
{
        if(!is_user_alive(id))
                return FMRES_IGNORED;

        static Float:fGmTime ; fGmTime = get_gametime();
        if(g_fNextStep[id] < fGmTime)
        {
                if(fm_get_user_speed(id) && (pev(id, pev_flags) & FL_ONGROUND) && is_user_outside(id))
                {
                        set_pev(id, pev_flTimeStepSound, 999);
                        engfunc(EngFunc_EmitSound, id, CHAN_AUTO, g_szStepSound[random_num(0, sizeof g_szStepSound - 1)], 0.5, ATTN_NORM, 0, PITCH_NORM);

                        g_fNextStep[id] = fGmTime + STEP_DELAY;
                }
        }
        return FMRES_IGNORED;
}

public logevent_BombPlanted()
{
        emit_sound(0, CHAN_AUTO, g_szBombSounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public logevent_BombDefused()
{
        client_cmd(0, "wait;stopsound");
        emit_sound(0, CHAN_AUTO, g_szBombSounds[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public logevent_BombExploded()
{
        emit_sound(0, CHAN_AUTO, g_szBombSounds[2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public message_TempEntity(msg_id, msg_dest, msg_ent)
{
        if(get_msg_arg_int(1) == TE_GLOWSPRITE)
        {
                if(get_msg_arg_int(5) == g_iLedSprite)
                        return PLUGIN_HANDLED;
        }
        return PLUGIN_CONTINUE;
}

stock Float:is_user_outside(id)
{
        new Float:vOrigin[3], Float:fDist;
        pev(id, pev_origin, vOrigin);

        fDist = vOrigin[2];

        while(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_EMPTY)
                vOrigin[2] += 5.0;

        if(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_SKY)
                return (vOrigin[2] - fDist);

        return 0.0;
}

stock Float:fm_get_user_speed(id)
{
        if(!is_user_connected(id))
                return 0.0;

        static Float:fVelocity[3];
        pev(id, pev_velocity, fVelocity);

        fVelocity[2] = 0.0;

        return vector_length(fVelocity);
}
Not working...

Last edited by amokossi; 12-29-2010 at 15:41.
amokossi is offline
Send a message via ICQ to amokossi Send a message via MSN to amokossi
Lik_1981
Junior Member
Join Date: Feb 2010
Location: Russia. Sevastopol.
Old 12-30-2010 , 04:13   Re: Winter Environment
Reply With Quote #84

Hello. A lot of players were confused that sound after plant play so long. and this sound prevent terrorists hear enemy when terrorists defence plant.

I made some changes. There are only two sounds (from this original plugin) in my version. First of them its "bugaga" sounds when "bomb has been planted", and second of them is "jingle bells" sounds when "bomb has been defused" оr "target succesfully bombed"

"jingle bells" still play 9 seconds after begin of the round and after that stops by stopsound command.

it's made for Public servers whitout fun & meat maps
where players wants to see clanwar teamplay.

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Winter Environment"
#define VERSION "1.0"
#define AUTHOR "Alka"

new const g_szBombModels[][] = {
    
    
"models/ch-m/c4-christmastree2.mdl",
    
"models/ch-m/c4-christmastree.mdl",
    
"models/ch-m/frost_man.mdl",
    
"models/ch-m/present1.mdl"
};
new const 
g_szBombSounds[][] = {
    
    
"ch-s/bmb_planted.wav",
    
"ch-s/bmb_defused.wav",
    
"ch-s/bmb_defuse_failure.wav"
};

new 
g_iLedSprite;

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_forward(FM_SetModel"fwd_SetModel"1);
    
register_logevent("logevent_StartRound"2"0=World triggered""1=Round_Start");    
    
register_logevent("logevent_BombPlanted"3"2=Planted_The_Bomb");
    
register_logevent("logevent_BombDefused"3"2=Defused_The_Bomb");
    
register_logevent("logevent_BombExploded"6"3=Target_Bombed");
    
register_message(SVC_TEMPENTITY"message_TempEntity");
}

public 
plugin_precache()
{
    
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString
"env_snow"));
    
    new 
i;
    for(
sizeof g_szBombModels i++)
        
precache_model(g_szBombModels[i]);
    for(
sizeof g_szBombSounds i++)
        
precache_sound(g_szBombSounds[i]);
    
    
g_iLedSprite precache_model("sprites/ledglow.spr");
}

public 
fwd_SetModel(ent, const szModel[])
{
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED;
    
    if(
equal(szModel"models/w_c4.mdl"))
    {
        static 
iRndModeliRndModel random_num(0sizeof g_szBombModels 1);
        
engfunc(EngFunc_SetModelentg_szBombModels[iRndModel]);
        
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;
}

public 
logevent_StartRound()
{
set_task(9.5"stopsound");
}

public 
stopsound ()
{
client_cmd(0"mp3 stop; stopsound");
}

public 
logevent_BombPlanted()
{
    
emit_sound(0CHAN_AUTOg_szBombSounds[1], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
logevent_BombDefused()
{
    
emit_sound(0CHAN_AUTOg_szBombSounds[0], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
logevent_BombExploded()
{
    
emit_sound(0CHAN_AUTOg_szBombSounds[0], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
message_TempEntity(msg_idmsg_destmsg_ent)
{
    if(
get_msg_arg_int(1) == TE_GLOWSPRITE)
    {
        if(
get_msg_arg_int(5) == g_iLedSprite)
            return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;

it's my first work, don't kill me plz ))
Lik_1981 is offline
Send a message via ICQ to Lik_1981 Send a message via Skype™ to Lik_1981
rx1983
Senior Member
Join Date: Jan 2009
Location: BRASIL
Old 01-30-2011 , 10:31   Re: Winter Environment
Reply With Quote #85

that part was very useful to stop the annoying sound in the new round.

PHP Code:
public logevent_StartRound()
{
set_task(4"stopsound");
}

public 
stopsound ()
    {
client_cmd(0"mp3 stop; stopsound");
    } 
but this message is appearing on screen at all times.



sorry, I did some tests and the error has nothing to do with the plugin ..
I will continue to do further tests ..
__________________

Last edited by rx1983; 01-30-2011 at 10:52. Reason: add error :s
rx1983 is offline
Send a message via MSN to rx1983
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-08-2012 , 02:20   Re: Winter Environment
Reply With Quote #86

Alka, can you adding a fix for the de_aztec and other maps? Because on the maps with rain the weather isn't changed.
ZASTRELIS is offline
IonutZu
Junior Member
Join Date: May 2011
Old 11-08-2012 , 13:45   Re: Winter Environment
Reply With Quote #87

Nice plugin, i'll start using it after 1dec. ^_^
IonutZu is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-09-2012 , 02:13   Re: Winter Environment
Reply With Quote #88

Quote:
Originally Posted by IonutZu View Post
Nice plugin, i'll start using it after 1dec. ^_^
I'm from Siberia, already using
ZASTRELIS is offline
Old 11-09-2012, 02:40
Mar00y
This message has been deleted by asherkin. Reason: Spam.
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-09-2012 , 02:49   Re: Winter Environment
Reply With Quote #89

Quote:
Originally Posted by Mar00y View Post
I do need some screenshots to prove it once again.
what do you mean?
ZASTRELIS is offline
SeRGiOPaOk4
Junior Member
Join Date: Nov 2011
Location: Greece/Thessaloniki
Old 12-14-2012 , 11:09   Re: Winter Environment
Reply With Quote #90

is there any way to WALK(with shift) and the other players don't listen to your steps?
SeRGiOPaOk4 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 21:16.


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