Поиск Плагин ходьба по снегу, звук снега

old

Сообщения
20
Реакции
0
Предупреждения
10
Привет ребят, ищу плагин когда идешь, слышишь как под ногами хрустит снег, никак не могу найти.
 
Сообщения
1,549
Реакции
1,555
Помог
2 раз(а)
Тебе нужно слышать звуки снега не на снежных картах ?
Насколько я знаю,то снежные текстуры ( на картах ) принимают стандартный звук ходьбы по снегу
 

old

Сообщения
20
Реакции
0
Предупреждения
10
MayroN, да именно так, нужно слышать звуки снега не на снежных картах
16 Ноя 2024
@MayroN,у скальпеля в плагины, по-моему была такая функция что звук ходьбы по снегу, на обычных картах.
 
Сообщения
92
Реакции
17
Помог
1 раз(а)
old, " у скальпеля в плагины, по-моему была такая функция что звук ходьбы по снегу, на обычных картах."

Привет. Да, верно. У него в плагине есть такое. New Year RBS.
 

old

Сообщения
20
Реакции
0
Предупреждения
10
@dreamxleo,да только мне не нужен весь плагин, а только данная функция.
 
Сообщения
92
Реакции
17
Помог
1 раз(а)
Loki, я думаю, тут 95% и так знают то, что я сказал)). Ну если что, прошу прощения, больше не буду. :dntknw: :ok:
 
Сообщения
145
Реакции
8
Предупреждения
1
Офф-топик / Офф-форум
dreamxleo, я тебя простил ! Го пиво пить )))
 
Сообщения
1,549
Реакции
1,555
Помог
2 раз(а)
Привет ребят, ищу плагин когда идешь, слышишь как под ногами хрустит снег, никак не могу найти.
Вот собственно готовая вырезка из плагина от Alka ( которая нуждается в доработке )

Из минусов
-Звуки слышно,когда упёрся в стенку и нажата клавиша ходьбы
-На Shift'е слышно звуки ходьбы

Код:
#include <amxmodx>
#include <fakemeta>

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

#define STEP_DELAY 0.5

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 Float:g_fNextStep[33];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
  
    register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink", 0);
}

public plugin_precache()
{
    new i;
    for(i = 0 ; i < sizeof g_szStepSound ; i++)
        precache_sound(g_szStepSound[i]);
}

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;
}

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);
}
 
Сообщения
20
Реакции
9
Помог
1 раз(а)
Как насчёт такого варианта
Код:
#pragma semicolon 1

#include <amxmodx>

#define PLUGIN    "Snow Steps"
#define VERSION    "1.0"
#define AUTHOR    "Admrfsh"

#include <reapi>
#include <fakemeta>
#include <regex>

new g_iCurPlayerId;

new Float:sv_gravity,
    Float:sv_stopspeed,
    Float:sv_maxspeed,
    Float:sv_spectatormaxspeed,
    Float:sv_accelerate,
    Float:sv_airaccelerate,
    Float:sv_wateraccelerate,
    Float:sv_friction,
    Float:edgefriction,
    Float:sv_waterfriction,
    Float:sv_bounce,
    Float:sv_stepsize,
    Float:sv_maxvelocity,
    Float:sv_zmax,
    Float:sv_wateramp,
    Float:sv_rollangle,
    Float:sv_rollspeed,
    Float:sv_skycolor_r,
    Float:sv_skycolor_g,
    Float:sv_skycolor_b,
    Float:sv_skyvec_x,
    Float:sv_skyvec_y,
    Float:sv_skyvec_z,
    sv_skyname[32];

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
   
    RegisterHookChain(RG_PM_Move, "OnEvent_PM_Move_Pre", false);
    RegisterHookChain(RG_PM_Move, "OnEvent_PM_Move_Post", true);
    RegisterHookChain(RH_SV_StartSound, "OnEvent_SV_StartSound_Pre", false);
    RegisterHookChain(RG_CBasePlayer_Spawn, "OnEvent_Player_Spawn_Post", true);

    bind_pcvar_float(get_cvar_pointer("sv_gravity"), sv_gravity);
    bind_pcvar_float(get_cvar_pointer("sv_stopspeed"), sv_stopspeed);
    bind_pcvar_float(get_cvar_pointer("sv_maxspeed"), sv_maxspeed);
    bind_pcvar_float(get_cvar_pointer("sv_spectatormaxspeed"), sv_spectatormaxspeed);
    bind_pcvar_float(get_cvar_pointer("sv_accelerate"), sv_accelerate);
    bind_pcvar_float(get_cvar_pointer("sv_airaccelerate"), sv_airaccelerate);
    bind_pcvar_float(get_cvar_pointer("sv_wateraccelerate"), sv_wateraccelerate);
    bind_pcvar_float(get_cvar_pointer("sv_friction"), sv_friction);
    bind_pcvar_float(get_cvar_pointer("edgefriction"), edgefriction);
    bind_pcvar_float(get_cvar_pointer("sv_waterfriction"), sv_waterfriction);
    bind_pcvar_float(get_cvar_pointer("sv_bounce"), sv_bounce);
    bind_pcvar_float(get_cvar_pointer("sv_stepsize"), sv_stepsize);
    bind_pcvar_float(get_cvar_pointer("sv_maxvelocity"), sv_maxvelocity);
    bind_pcvar_float(get_cvar_pointer("sv_zmax"), sv_zmax);
    bind_pcvar_float(get_cvar_pointer("sv_wateramp"), sv_wateramp);
    bind_pcvar_float(get_cvar_pointer("sv_rollangle"), sv_rollangle);
    bind_pcvar_float(get_cvar_pointer("sv_rollspeed"), sv_rollspeed);
    bind_pcvar_float(get_cvar_pointer("sv_skycolor_r"), sv_skycolor_r);
    bind_pcvar_float(get_cvar_pointer("sv_skycolor_g"), sv_skycolor_g);
    bind_pcvar_float(get_cvar_pointer("sv_skycolor_b"), sv_skycolor_b);
    bind_pcvar_float(get_cvar_pointer("sv_skyvec_x"), sv_skyvec_x);
    bind_pcvar_float(get_cvar_pointer("sv_skyvec_x"), sv_skyvec_y);
    bind_pcvar_float(get_cvar_pointer("sv_skyvec_x"), sv_skyvec_z);
    bind_pcvar_string(get_cvar_pointer("sv_skyname"), sv_skyname, 32);
}

public OnEvent_PM_Move_Pre(const iPlayerId)
{
    g_iCurPlayerId = iPlayerId;
}

public OnEvent_PM_Move_Post()
{
    g_iCurPlayerId = 0;
}

public OnEvent_SV_StartSound_Pre(const iRecipients, const iEntityId, const iChannel, const szSample[], const iVolume, Float:fAttenuation, const fFlags, const iPitch)
{
    if (g_iCurPlayerId == iEntityId)
    {
        static Regex:hRegex;
        static szBuffer[16];
       
        if ((hRegex = regex_match(szSample, "^^player\/pl_(\w+)(\d+).wav$")) >= REGEX_OK)
        {
            g_iCurPlayerId = 0;

            regex_substr(hRegex, 1, szBuffer, charsmax(szBuffer));
            regex_free(hRegex);
           
            if (!strcmp(szBuffer, "step") ||
                !strcmp(szBuffer, "metal") ||
                !strcmp(szBuffer, "dirt") ||
                !strcmp(szBuffer, "duct") ||
                !strcmp(szBuffer, "grate") ||
                !strcmp(szBuffer, "tile"))
            {
                if (get_member(iEntityId, m_iStepLeft))
                {
                    switch (random_num(0, 2))
                    {
                        case 0: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow2.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 1: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow4.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 2: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow6.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                    }
                }
                else
                {
                    switch (random_num(0, 2))
                    {
                        case 0: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow1.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 1: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow3.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 2: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow5.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                    }
                }
            }
            else
            {
                engfunc(EngFunc_EmitSound, iEntityId, iChannel, szSample, iVolume / 255.0, fAttenuation, fFlags, iPitch);
            }

            return HC_BREAK;
        }
    }

    return HC_CONTINUE;
}

public OnEvent_Player_Spawn_Post(const iPlayerId) {
    if (!is_user_alive(iPlayerId))
    {
        return;
    }

    message_begin(MSG_ONE, SVC_NEWMOVEVARS, _, iPlayerId);
    write_long(_:sv_gravity);
    write_long(_:sv_stopspeed);
    write_long(_:sv_maxspeed);
    write_long(_:sv_spectatormaxspeed);
    write_long(_:sv_accelerate);
    write_long(_:sv_airaccelerate);
    write_long(_:sv_wateraccelerate);
    write_long(_:sv_friction);
    write_long(_:edgefriction);
    write_long(_:sv_waterfriction);
    write_long(1);
    write_long(_:sv_bounce);
    write_long(_:sv_stepsize);
    write_long(_:sv_maxvelocity);
    write_long(_:sv_zmax);
    write_long(_:sv_wateramp);
    write_byte(0); // mp_footsteps
    write_long(_:sv_rollangle);
    write_long(_:sv_rollspeed);
    write_long(_:sv_skycolor_r);
    write_long(_:sv_skycolor_g);
    write_long(_:sv_skycolor_b);
    write_long(_:sv_skyvec_x);
    write_long(_:sv_skyvec_y);
    write_long(_:sv_skyvec_z);
    write_string(sv_skyname);
    message_end();
}
 
Сообщения
20
Реакции
9
Помог
1 раз(а)
Так должно быть надёжнее
Код:
#pragma semicolon 1

#include <amxmodx>

#define PLUGIN    "Snow Steps"
#define VERSION    "1.01"
#define AUTHOR    "Admrfsh"

#include <reapi>
#include <fakemeta>
#include <regex>

new g_iCurPlayerId;

new Float:sv_gravity,
    Float:sv_stopspeed,
    Float:sv_maxspeed,
    Float:sv_spectatormaxspeed,
    Float:sv_accelerate,
    Float:sv_airaccelerate,
    Float:sv_wateraccelerate,
    Float:sv_friction,
    Float:edgefriction,
    Float:sv_waterfriction,
    Float:sv_bounce,
    Float:sv_stepsize,
    Float:sv_maxvelocity,
    Float:sv_zmax,
    Float:sv_wateramp,
    Float:sv_rollangle,
    Float:sv_rollspeed,
    Float:sv_skycolor_r,
    Float:sv_skycolor_g,
    Float:sv_skycolor_b,
    Float:sv_skyvec_x,
    Float:sv_skyvec_y,
    Float:sv_skyvec_z,
    sv_skyname[32];


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    
    RegisterHookChain(RG_PM_Move, "OnEvent_PM_Move_Pre", false);
    RegisterHookChain(RG_PM_Move, "OnEvent_PM_Move_Post", true);
    RegisterHookChain(RH_SV_StartSound, "OnEvent_SV_StartSound_Pre", false);

    new pCvar;

    #define HOOK_CVAR_FLOAT(%1,%2,%3) \
    pCvar = get_cvar_pointer(%1); \
    bind_pcvar_float(pCvar, %2); \
    hook_cvar_change(pCvar, %3)

    #define HOOK_CVAR_STRING(%1,%2,%3,%4) \
    pCvar = get_cvar_pointer(%1); \
    bind_pcvar_string(pCvar, %2, %3); \
    hook_cvar_change(pCvar, %4)

    HOOK_CVAR_FLOAT("sv_gravity", sv_gravity, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_stopspeed", sv_stopspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_maxspeed", sv_maxspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_spectatormaxspeed", sv_spectatormaxspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_accelerate", sv_accelerate, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_airaccelerate", sv_airaccelerate, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_wateraccelerate", sv_wateraccelerate, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_friction", sv_friction, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("edgefriction", edgefriction, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_waterfriction", sv_waterfriction, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_bounce", sv_bounce, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_stepsize", sv_stepsize, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_maxvelocity", sv_maxvelocity, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_zmax", sv_zmax, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_wateramp", sv_wateramp, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_rollangle", sv_rollangle, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_rollspeed", sv_rollspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skycolor_r", sv_skycolor_r, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skycolor_g", sv_skycolor_g, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skycolor_b", sv_skycolor_b, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skyvec_x", sv_skyvec_x, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skyvec_x", sv_skyvec_y, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skyvec_x", sv_skyvec_z, "OnEvent_Cvar_Change");
    HOOK_CVAR_STRING("sv_skyname", sv_skyname, 32, "OnEvent_Cvar_Change");
    hook_cvar_change(get_cvar_pointer("mp_footsteps"), "OnEvent_Cvar_Change");
}

public OnEvent_PM_Move_Pre(const iPlayerId)
{
    g_iCurPlayerId = iPlayerId;
}

public OnEvent_PM_Move_Post()
{
    g_iCurPlayerId = 0;
}

public OnEvent_SV_StartSound_Pre(const iRecipients, const iEntityId, const iChannel, const szSample[], const iVolume, Float:fAttenuation, const fFlags, const iPitch)
{
    if (g_iCurPlayerId == iEntityId)
    {
        static Regex:hRegex;
        static szBuffer[16];
        
        if ((hRegex = regex_match(szSample, "^^player\/pl_(\w+)(\d+).wav$")) >= REGEX_OK)
        {
            g_iCurPlayerId = 0;

            regex_substr(hRegex, 1, szBuffer, charsmax(szBuffer));
            regex_free(hRegex);
            
            if (!strcmp(szBuffer, "step") ||
                !strcmp(szBuffer, "metal") ||
                !strcmp(szBuffer, "dirt") ||
                !strcmp(szBuffer, "duct") ||
                !strcmp(szBuffer, "grate") ||
                !strcmp(szBuffer, "tile"))
            {
                if (get_member(iEntityId, m_iStepLeft))
                {
                    switch (random_num(0, 2))
                    {
                        case 0: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow2.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 1: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow4.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 2: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow6.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                    }
                }
                else
                {
                    switch (random_num(0, 2))
                    {
                        case 0: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow1.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 1: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow3.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                        case 2: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow5.wav", iVolume / 255.0, fAttenuation, fFlags, iPitch);
                    }
                }
            }
            else
            {
                engfunc(EngFunc_EmitSound, iEntityId, iChannel, szSample, iVolume / 255.0, fAttenuation, fFlags, iPitch);
            }

            return HC_BREAK;
        }
    }

    return HC_CONTINUE;
}

public client_putinserver(iPlayerId)
{
    UpdateMoveVars(iPlayerId);
}

public OnEvent_Cvar_Change(const pCvar, const szOldValue[], const szNewValue[])
{
    if (strcmp(szOldValue, szNewValue))
    {
        for (new i = 1; i <= 32; i++)
        {
            if (!is_user_connected(i) ||
                is_user_bot(i))
            {
                continue;
            }
            
            set_task(0.001, "UpdateMoveVars", i);
        }
    }
}

public UpdateMoveVars(const iPlayerId)
{
    message_begin(MSG_ONE, SVC_NEWMOVEVARS, _, iPlayerId);
    write_long(_:sv_gravity);
    write_long(_:sv_stopspeed);
    write_long(_:sv_maxspeed);
    write_long(_:sv_spectatormaxspeed);
    write_long(_:sv_accelerate);
    write_long(_:sv_airaccelerate);
    write_long(_:sv_wateraccelerate);
    write_long(_:sv_friction);
    write_long(_:edgefriction);
    write_long(_:sv_waterfriction);
    write_long(1);
    write_long(_:sv_bounce);
    write_long(_:sv_stepsize);
    write_long(_:sv_maxvelocity);
    write_long(_:sv_zmax);
    write_long(_:sv_wateramp);
    write_byte(0); // mp_footsteps
    write_long(_:sv_rollangle);
    write_long(_:sv_rollspeed);
    write_long(_:sv_skycolor_r);
    write_long(_:sv_skycolor_g);
    write_long(_:sv_skycolor_b);
    write_long(_:sv_skyvec_x);
    write_long(_:sv_skyvec_y);
    write_long(_:sv_skyvec_z);
    write_string(sv_skyname);
    message_end();
}
 
Сообщения
20
Реакции
9
Помог
1 раз(а)
Небольшая доработка и фикс
Код:
#pragma semicolon 1

#include <amxmodx>

#define PLUGIN    "Snow Steps"
#define VERSION    "1.02"
#define AUTHOR    "Admrfsh"

#include <reapi>
#include <fakemeta>
#include <regex>

new g_iCurPlayerId = NULLENT;

new Float:sv_gravity,
    Float:sv_stopspeed,
    Float:sv_maxspeed,
    Float:sv_spectatormaxspeed,
    Float:sv_accelerate,
    Float:sv_airaccelerate,
    Float:sv_wateraccelerate,
    Float:sv_friction,
    Float:edgefriction,
    Float:sv_waterfriction,
    Float:sv_bounce,
    Float:sv_stepsize,
    Float:sv_maxvelocity,
    Float:sv_zmax,
    Float:sv_wateramp,
    Float:sv_rollangle,
    Float:sv_rollspeed,
    Float:sv_skycolor_r,
    Float:sv_skycolor_g,
    Float:sv_skycolor_b,
    Float:sv_skyvec_x,
    Float:sv_skyvec_y,
    Float:sv_skyvec_z,
    sv_skyname[32];

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
   
    RegisterHookChain(RG_PM_Move, "OnEvent_PM_Move_Pre", false);
    RegisterHookChain(RG_PM_Move, "OnEvent_PM_Move_Post", true);
    RegisterHookChain(RH_SV_StartSound, "OnEvent_SV_StartSound_Pre", false);

    new pCvar;

    #define HOOK_CVAR_FLOAT(%1,%2,%3) \
    pCvar = get_cvar_pointer(%1); \
    bind_pcvar_float(pCvar, %2); \
    hook_cvar_change(pCvar, %3)

    #define HOOK_CVAR_STRING(%1,%2,%3,%4) \
    pCvar = get_cvar_pointer(%1); \
    bind_pcvar_string(pCvar, %2, %3); \
    hook_cvar_change(pCvar, %4)

    HOOK_CVAR_FLOAT("sv_gravity", sv_gravity, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_stopspeed", sv_stopspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_maxspeed", sv_maxspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_spectatormaxspeed", sv_spectatormaxspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_accelerate", sv_accelerate, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_airaccelerate", sv_airaccelerate, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_wateraccelerate", sv_wateraccelerate, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_friction", sv_friction, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("edgefriction", edgefriction, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_waterfriction", sv_waterfriction, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_bounce", sv_bounce, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_stepsize", sv_stepsize, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_maxvelocity", sv_maxvelocity, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_zmax", sv_zmax, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_wateramp", sv_wateramp, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_rollangle", sv_rollangle, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_rollspeed", sv_rollspeed, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skycolor_r", sv_skycolor_r, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skycolor_g", sv_skycolor_g, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skycolor_b", sv_skycolor_b, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skyvec_x", sv_skyvec_x, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skyvec_x", sv_skyvec_y, "OnEvent_Cvar_Change");
    HOOK_CVAR_FLOAT("sv_skyvec_x", sv_skyvec_z, "OnEvent_Cvar_Change");
    HOOK_CVAR_STRING("sv_skyname", sv_skyname, 32, "OnEvent_Cvar_Change");
    hook_cvar_change(get_cvar_pointer("mp_footsteps"), "OnEvent_Cvar_Change");
}

public OnEvent_PM_Move_Pre(const iPlayerId)
{
    g_iCurPlayerId = iPlayerId;
}

public OnEvent_PM_Move_Post()
{
    g_iCurPlayerId = NULLENT;
}

public OnEvent_SV_StartSound_Pre(const iRecipients, const iEntityId, const iChannel, const szSample[], const iVolume, Float:flAttenuation, const fFlags, const iPitch)
{
    if (g_iCurPlayerId == iEntityId)
    {
        static Regex:hRegex;
        static szBuffer[16];
       
        if ((hRegex = regex_match(szSample, "^^player\/pl_(\w+)\d+.wav$")) >= REGEX_OK)
        {
            g_iCurPlayerId = NULLENT;
           
            regex_substr(hRegex, 1, szBuffer, charsmax(szBuffer));
            regex_free(hRegex);
           
            if (!strcmp(szBuffer, "step") ||
                !strcmp(szBuffer, "metal") ||
                !strcmp(szBuffer, "dirt") ||
                !strcmp(szBuffer, "duct") ||
                !strcmp(szBuffer, "grate") ||
                !strcmp(szBuffer, "tile"))
            {
                // ReGameDLL code
                switch (random_num(0, 1) + get_pmove(pm_iStepLeft) * 2)
                {
                    // right foot
                    case 0: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow1.wav", iVolume / 255.0, flAttenuation, fFlags, iPitch);
                    case 1: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow3.wav", iVolume / 255.0, flAttenuation, fFlags, iPitch);
                    // left foot
                    case 2: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow2.wav", iVolume / 255.0, flAttenuation, fFlags, iPitch);
                    case 3: engfunc(EngFunc_EmitSound, iEntityId, iChannel, "player/pl_snow4.wav", iVolume / 255.0, flAttenuation, fFlags, iPitch);
                }
            }
            else
            {
                engfunc(EngFunc_EmitSound, iEntityId, iChannel, szSample, iVolume / 255.0, flAttenuation, fFlags, iPitch);
            }

            return HC_BREAK;
        }
    }

    return HC_CONTINUE;
}

public client_putinserver(iPlayerId)
{
    UpdateMoveVars(iPlayerId);
}

public OnEvent_Cvar_Change(const pCvar, const szOldValue[], const szNewValue[])
{
    if (strcmp(szOldValue, szNewValue))
    {
        for (new i = 1; i <= 32; i++)
        {
            if (!is_user_connected(i) ||
                is_user_bot(i))
            {
                continue;
            }
           
            set_task(0.1, "UpdateMoveVars", i);
        }
    }
}

public UpdateMoveVars(const iPlayerId)
{
    message_begin(MSG_ONE, SVC_NEWMOVEVARS, _, iPlayerId);
    write_long(_:sv_gravity);
    write_long(_:sv_stopspeed);
    write_long(_:sv_maxspeed);
    write_long(_:sv_spectatormaxspeed);
    write_long(_:sv_accelerate);
    write_long(_:sv_airaccelerate);
    write_long(_:sv_wateraccelerate);
    write_long(_:sv_friction);
    write_long(_:edgefriction);
    write_long(_:sv_waterfriction);
    write_long(1); // entgravity
    write_long(_:sv_bounce);
    write_long(_:sv_stepsize);
    write_long(_:sv_maxvelocity);
    write_long(_:sv_zmax);
    write_long(_:sv_wateramp);
    write_byte(0); // mp_footsteps
    write_long(_:sv_rollangle);
    write_long(_:sv_rollspeed);
    write_long(_:sv_skycolor_r);
    write_long(_:sv_skycolor_g);
    write_long(_:sv_skycolor_b);
    write_long(_:sv_skyvec_x);
    write_long(_:sv_skyvec_y);
    write_long(_:sv_skyvec_z);
    write_string(sv_skyname);
    message_end();
}
 
Последнее редактирование:

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу