Приветствую.Есть плагин который воспроизводит звуки при убийстве.Включается он по команде /sound.Нужно добавить оповещение в чат при включении/отключении команды и запомнить выбор игрока (желательно чтобы записывался в mysql).То есть чтобы не приходилось постоянно включать/отключать звуки.Сколько будет стоить переделать плагин я не знаю поэтому пишите цену сами.На всякий случай прикреплю исходник.
Код:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#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 char ];
new const SOUNDS_KILL[ ][ ] =
{
"soundkills/firstkill.wav",
"soundkills/doublekill.wav",
"soundkills/tripplekill.wav",
"soundkills/multikill.wav",
"soundkills/crazy.wav",
"soundkills/rampage.wav",
"soundkills/headshot.wav",
"soundkills/knife.wav",
"soundkills/grenade.wav"
};
public plugin_init( )
{
register_plugin( "", "", "" );
register_logevent( "LogEV_RoundStart", 2, "1=Round_Start" );
register_clcmd( "say /sounds", "Command_Sounds" );
register_clcmd( "say_team /sounds", "Command_Sounds" );
RegisterHam( Ham_Killed, "player", "CPlayer__Killed_Post", .Post = 1 );
}
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( iPlayer )
{
if( g_bszSoundsEnable{ iPlayer } )
{
g_bszSoundsEnable{ iPlayer } = false;
client_print( iPlayer, print_chat, "Звуки убийств отключены." );
}
else
{
g_bszSoundsEnable{ iPlayer } = true;
client_print( iPlayer, print_chat, "Звуки убийств включены." );
}
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[ 6 ] );
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[ 7 ] );
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[ 8 ] );
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 ] );
g_iKillCount[ iAttacker ] = 5;
}
}
}
}
public client_putinserver( iPlayer )
{
g_bszSoundsEnable{ iPlayer } = true;
g_iKillCount[ iPlayer ] = 0;
}