Quote:
Originally Posted by Backstabnoob
I don't think that's correct. The first parameter is the index of an entity the sound should come from, if it's 0, the server will most likely crash or you'll get an error in the log. If you want to play it for everyone, use the client command spk or find an entity that could be used for this.
|
Code:
static cell AMX_NATIVE_CALL emit_sound(AMX *amx, cell *params) /* 7 param */
{
int len;
char* szSample = get_amxstring(amx, params[3], 0, len);
REAL vol = amx_ctof(params[4]);
REAL att = amx_ctof(params[5]);
int channel = params[2];
int pitch = params[7];
int flags = params[6];
if (params[1] == 0)
{
for (int i = 1; i <= gpGlobals->maxClients ; ++i)
{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame)
EMIT_SOUND_DYN2(pPlayer->pEdict, channel, szSample, vol, att, flags, pitch);
}
} else {
edict_t* pEdict = INDEXENT(params[1]);
if (!FNullEnt(pEdict))
EMIT_SOUND_DYN2(pEdict, channel, szSample, vol, att, flags, pitch);
}
return 1;
}
Nice one buddy
__________________