Hi.!
how to use the svc_sound?
https://wiki.alliedmods.net/Half-Lif...ages#SVC_SOUND
I want to play sounds through the index of the sound obtained through the sound_precache
Code:
Name: SVC_SOUND
Structure:
9 bits Flags
8 bits Volume * 255 (flags&1)
8 bits Attenuation * 64 (flags&2)
3 bits Channel
11 bits EntityIndex
] 16 bits SoundIndex (flags&4)
] or
] 8 bits SoundIndex !(flags&4)
n bits Origin
8 bits Pitch (flags&8)
n bits alignment to byte boundary
Code:
#define clamp_byte(%1) ( clamp( %1, 0, 255 ) )
stock emit_sound_byindex( const index, sound_index, channel = CHAN_AUTO, Float:vol = VOL_NORM, Float:atten = ATTN_NORM, pitch = PITCH_NORM, flags = 0 )
{
message_begin( index ? MSG_ONE : MSG_ALL, SVC_SOUND, .player = index );
write_byte( flags );
write_byte( clamp_byte( floatround( vol ) ) );
write_byte( clamp_byte( floatround( atten ) ) );
write_byte( channel );
write_byte( index );
write_byte( sound_index );
write_coord(0);
write_coord(0);
write_coord(0);
write_byte(pitch);
write_byte(0);
message_end();
}
what am I doing wrong? this is what i have done so far and the game ends when i run it