Проверенный
Участник
- Сообщения
- 2,288
- Реакции
- 1,740
- Помог
- 31 раз(а)
- Ошибка
-
Плагин не отключает звуки через команду в чат.
- ОС
- Linux
- Билд
-
version
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.3.0.628-dev
Build date: 13:49:36 Dec 20 2017 (1348)
Build from: https://github.com/dreamstalker/rehlds/commit/780afd0
- ReGamedll
-
game version
ReGameDLL version: 5.3.0.279-dev
Build date: 12:34:05 Dec 17 2017
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/565e9cd
- Список метамодулей
-
meta list
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.75 ini Start Never
[ 2] WHBlocker RUN - whblocker_mm_i386.so v1.5.695 ini Chlvl ANY
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.8.3-Re ini Start ANY
[ 4] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY ANY
[ 5] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 6] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 7] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 8] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 9] MySQL RUN - mysql_amxx_i386.so v1.8.3-Re pl3 ANY ANY
[10] CSX RUN - csx_amxx_i386.so v1.8.3-Re pl3 ANY ANY
[11] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.0 pl3 ANY Never
[12] FakeMeta RUN - fakemeta_amxx_i386.so v1.8.3-Re pl3 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.8.3-Re pl3 ANY ANY
[14] ReAPI RUN - reapi_amxx_i386.so v5.2.0.143-dev pl3 ANY Never
[15] CStrike RUN - cstrike_amxx_i386.so v1.8.3-Re pl3 ANY ANY
[16] Engine RUN - engine_amxx_i386.so v1.8.3-Re pl3 ANY ANY
16 plugins, 16 running
- Список плагинов
-
Kill_sound 1.0 Unknown kill_sound.amxx running
- Исходный код
-
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define SAVE // Сохранять настройки игроков? Закомментировать для отключения
#if defined(SAVE)
#include <nvault>
#define FILE_NAME "killsounds" // название файла, в котором будут храниться настройки
#define SAVE_TYPE 2 // тип сохранения: 1 - nickname, 2 - steamid, 3 - ip
#define AUTORESET // автоматически удалять "неактивных" игроков. Закомментировать для отключения
#define AUTORESET_DAYS 7 // если авто-очистка включена, то считать игрока "неактивным", если он не посещал сервер <значение> дней
new g_nVault;
#endif
#define MAX_CLIENTS 32
#define m_LastHitGroup 75
#define m_bitsDamageType 76
#define m_pActiveItem 373
#define m_iId 43
new g_iKillCount[ MAX_CLIENTS +1 ];
new bool: g_bszFirstBlood;
new bool:g_bszSoundsEnable[MAX_CLIENTS +1];
new const SOUNDS_KILL[ ][ ] =
{
"nezhnosound/firstkill.wav",
"nezhnosound/doublekill.wav",
"nezhnosound/triplekill.wav",
"nezhnosound/multikill.wav",
"nezhnosound/ultrakill.wav",
"nezhnosound/killingspree.wav",
"nezhnosound/megakill.wav",
"nezhnosound/holyshit.wav",
"nezhnosound/ludicrouskill.wav",
"nezhnosound/godlike.wav",
"nezhnosound/unstoppable.wav",
"nezhnosound/monsterkill.wav",
"nezhnosound/headshot.wav",
"nezhnosound/knife2.wav",
"nezhnosound/grenade.wav"
};
public plugin_init( )
{
register_plugin( "Kill_sound", "1.0", "Unknown" );
register_logevent( "LogEV_RoundStart", 2, "1=Round_Start" );
register_clcmd( "say /sound", "Command_Sounds" );
register_clcmd( "say_team /sound", "Command_Sounds" );
RegisterHam( Ham_Killed, "player", "CPlayer__Killed_Post", .Post = 1 );
#if defined(SAVE)
g_nVault = nvault_open(FILE_NAME);
#if defined(AUTORESET)
nvault_prune(g_nVault, 0, get_systime() - (86400 * AUTORESET_DAYS));
#endif
#endif
}
#if defined(SAVE)
public plugin_end()
nvault_close(g_nVault);
save_data(id)
{
new trackid[64];
if (!get_trackid(id, trackid, charsmax(trackid)))
return 0;
new value[2];
formatex(value, charsmax(value), "%d", g_bszSoundsEnable[id] ? 1 : 2); // патамуша nvault_get/lookup вернет "0" в случае, если ключ не найден.
nvault_set(g_nVault, trackid, value);
return 1;
}
#if AMXX_VERSION_NUM >= 183 && SAVE_TYPE == 2
load_data(id, const trackid[])
#else
load_data(id)
#endif
{
#if AMXX_VERSION_NUM >= 183 && SAVE_TYPE == 2
if (!authid_is_valid(trackid))
return 0;
#else
new trackid[72];
if (!get_trackid(id, trackid, charsmax(trackid)))
return 0;
#endif
new nResult = nvault_get(g_nVault, trackid);
if (!nResult)
return 0;
#if defined(AUTORESET)
nvault_touch(g_nVault, trackid, -1);
#endif
g_bszSoundsEnable[id] = nResult == 1 ? true : false;
return 1;
}
get_trackid(id, trackid[], len)
{
#if SAVE_TYPE == 1
get_user_name(id, trackid, len);
#endif // #elseif trabl
#if SAVE_TYPE == 2
get_user_authid(id, trackid, len);
if (!authid_is_valid(trackid))
return 0;
#endif
#if SAVE_TYPE == 3
get_user_ip(id, trackid, len, 1);
#endif
return 1;
}
#if SAVE_TYPE == 2
authid_is_valid(const authid[])
{
if (contain(authid, ":") != -1) // re Subb98
return 1;
return 0;
}
#endif
#endif // defined(SAVE)
public plugin_precache( )
{
for( new i = 0; i < sizeof SOUNDS_KILL; i++ )
engfunc( EngFunc_PrecacheSound, SOUNDS_KILL[ i ] );
}
public LogEV_RoundStart( )
{
g_bszFirstBlood = true;
for( new iPlayers = MAX_CLIENTS; iPlayers > 0; iPlayers-- )
g_iKillCount[ iPlayers ] = 0;
}
public Command_Sounds( id, iPlayer )
{
if( g_bszSoundsEnable[iPlayer] )
{
g_bszSoundsEnable[iPlayer] = false;
client_print_color(id, print_team_default, "^1* ^3Звуки убийств ^4выключены^1.");
}
else
{
g_bszSoundsEnable[iPlayer] = true;
client_print_color(id, print_team_default, "^1* ^3Звуки убийств ^4включены^1.");
}
#if defined(SAVE)
save_data(iPlayer);
#endif
return PLUGIN_HANDLED;
}
public CPlayer__Killed_Post( iVictim, iAttacker, iGib )
{
if( iVictim == iAttacker || !is_user_connected( iAttacker ) )
return;
if( !g_bszSoundsEnable[iAttacker] )
return;
new iBitsDamageType = get_pdata_int( iVictim, m_bitsDamageType );
new iLastHitGroup = get_pdata_int( iVictim, m_LastHitGroup );
new iActiveItem = get_pdata_cbase( iAttacker, m_pActiveItem );
if( pev_valid( iActiveItem ) != 2 )
return;
new iId = get_pdata_int( iActiveItem, m_iId, 4 );
g_iKillCount[ iAttacker ]++;
if( iLastHitGroup == HIT_HEAD )
{
if( g_bszFirstBlood )
{
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 0 ] );
g_bszFirstBlood = false;
}
else
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 12 ] );
return;
}
if( iId == CSW_KNIFE && iBitsDamageType & ( DMG_NEVERGIB | DMG_BULLET ) )
{
if( g_bszFirstBlood )
{
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 0 ] );
g_bszFirstBlood = false;
}
else
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 13 ] );
return;
}
if( ~iBitsDamageType & ( DMG_NEVERGIB | DMG_BULLET ) )
{
if( g_bszFirstBlood )
{
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 0 ] );
g_bszFirstBlood = false;
}
else
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 14 ] );
return;
}
if( g_bszFirstBlood )
{
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 0 ] );
g_bszFirstBlood = false;
}
else
{
switch( g_iKillCount[ iAttacker ] )
{
case 2: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 1 ] );
case 3: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 2 ] );
case 4: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 3 ] );
case 5: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 4 ] );
case 6: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 5 ] );
case 7: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 6 ] );
case 8: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 7 ] );
case 9: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 8 ] );
case 10: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 9 ] );
case 11: client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 10 ] );
case 12:
{
client_cmd( iAttacker, "spk %s", SOUNDS_KILL[ 11 ] );
g_iKillCount[ iAttacker ] = 11;
}
}
}
}
#if defined(SAVE)
#if AMXX_VERSION_NUM >= 183 && SAVE_TYPE == 2
public client_authorized(iPlayer, const authid[])
#else
public client_authorized(iPlayer)
#endif
{
#if AMXX_VERSION_NUM >= 183 && SAVE_TYPE == 2
if (!load_data(iPlayer, authid))
#else
if (!load_data(iPlayer))
#endif
g_bszSoundsEnable[iPlayer] = false;
g_iKillCount[ iPlayer ] = 0;
}
#else
public client_authorized(iPlayer)
{
g_bszSoundsEnable[iPlayer] = false;
g_iKillCount[ iPlayer ] = 0;
}
#endif // defined(SAVE)
Не отключает звуки убийств через команду в чат. Звуки включены, если написать /sound то в чат пишет опять "звуки включены", если еще раз написать пишет "звуки выключены" но они все равно работают
В этой теме было размещено решение! Перейти к решению.
Вложения
-
7.5 KB Просмотры: 512