Вот собственно плагин
Код:
#include < amxmodx >
new const PLUGIN[] = "Say Signal"
new const VERSION[] = "1.0"
new const AUTHOR[] = "[jsn]"
new const SEND_SOUND[] = "buttons/lightswitch2.wav"
new const RCV_SOUND[] = "buttons/blip1.wav"
new g_AllowSwitch
new bool:g_bPlayForMe[ 33 ]
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
g_AllowSwitch = register_cvar( "ss_allow_switch", "1" )
register_clcmd( "say", "say_signal" )
register_clcmd( "say_team", "say_team_signal" )
register_clcmd( "say .signal", "cmd_switch" )
register_clcmd( "say_team .signal", "cmd_switch" )
}
public plugin_precache()
{
precache_sound( SEND_SOUND )
precache_sound( RCV_SOUND )
}
public say_signal( id )
{
send_signal( id )
static plist[ 32 ], pnum, pid
get_players( plist, pnum, ( is_user_alive( id ) ) ? "c" : "bc" )
for ( --pnum; pnum >= 0; pnum-- )
{
pid = plist[ pnum ]
rcv_signal( pid, id )
}
return PLUGIN_CONTINUE
}
public say_team_signal( id )
{
send_signal( id )
static plist[ 32 ], pnum, pid
switch ( get_user_team( id ) )
{
case 1: get_players( plist, pnum, ( is_user_alive( id ) ) ? "ce" : "bce", "TERRORIST" )
case 2: get_players( plist, pnum, ( is_user_alive( id ) ) ? "ce" : "bce", "CT" )
case 3: get_players( plist, pnum, "ce", "SPECTATOR" )
}
for ( --pnum; pnum >= 0; pnum-- )
{
pid = plist[ pnum ]
rcv_signal ( pid, id )
}
return PLUGIN_CONTINUE
}
public cmd_switch( id )
{
if ( !get_pcvar_num( g_AllowSwitch ) )
return PLUGIN_CONTINUE
switch( g_bPlayForMe[id] )
{
case true:
{
g_bPlayForMe[ id ] = false
client_print( id, print_chat, "[Say Signal] Disabled for you." )
}
case false:
{
g_bPlayForMe[ id ] = true
client_print( id, print_chat, "[Say Signal] Enabled for you.")
}
}
return PLUGIN_CONTINUE
}
send_signal( id )
if ( g_bPlayForMe[ id ] )
emit_sound( id, CHAN_ITEM, SEND_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
rcv_signal( pid, id )
if ( g_bPlayForMe[ pid ] && pid != id )
emit_sound( pid, CHAN_ITEM, RCV_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
public client_connect( id )
g_bPlayForMe[ id ] = true
Вложения
-
2.1 KB Просмотры: 16
Последнее редактирование модератором: