SVC_SPAWNSTATICSOUND channel has only
CHAN_STATIC.
and also playback sound different quality
Can also use this method by
PRoSToTeM@
PHP Code:
#include <amxmodx>
#define BIT(%0) (1<<(%0))
#define BITSUM(%0) (BIT(%0)-1)
new g_iWritingBits;
new g_iCurrentByte;
public plugin_init()
{
register_clcmd("say /emit2","cmdSound");
}
public cmdSound(id)
{
message_begin(MSG_ONE,SVC_SOUND,_,id);
MSG_StartBitWriting();
new iFlags = 0;
MSG_WriteBits(iFlags,9);
MSG_WriteBits(CHAN_WEAPON,3);
MSG_WriteBits(0,11);
MSG_WriteBits(precache_sound("weapons/ak47-1.wav"),8);
MSG_WriteOneBit(0);
MSG_WriteOneBit(0);
MSG_WriteOneBit(0);
MSG_EndBitWriting();
message_end();
}
MSG_StartBitWriting()
{
g_iWritingBits = 0;
g_iCurrentByte = 0;
}
MSG_WriteBits(iValue,iBits)
{
if(iBits > 25)
{
return;
}
g_iCurrentByte |= ((iValue & BITSUM(iBits)) << g_iWritingBits);
g_iWritingBits += iBits;
while(g_iWritingBits >= 8)
{
write_byte(g_iCurrentByte & BITSUM(8));
g_iCurrentByte >>= 8;
g_iWritingBits -= 8;
}
}
MSG_WriteOneBit(iBit)
{
MSG_WriteBits(iBit,1);
}
MSG_EndBitWriting()
{
if(g_iWritingBits)
{
write_byte(g_iCurrentByte);
}
}
EmitSound2 was written mainly for anti-cheat, maybe prove useful for someone