Broadcast sound to single client
Posted: Thu Mar 04, 2010 12:23 am
I have been trying to get this code to broadcast a sound to a single entity on the server but thus far I haven't had much luck. Can someone please tell me what I am missing? Thanks for any help!
Code: Select all
void BroadCastSoundClient(gentity_t *ent, char *path) {
gentity_t *te;
vec3_t origin;
if(!strlen(path))
return;
origin[0] = origin[1] = origin[2] = 0;
te = G_TempEntity(origin, EV_GLOBAL_SOUND);
te->s.eventParm = G_SoundIndex(path);
//only send to a single client
te->r.svFlags |= SVF_SINGLECLIENT;
te->r.singleClient = ent->s.number;
te->s.otherEntityNum = ent->s.number;
}