ES_CON_COMMAND(emitsound, "Plays a sound from an entity.", 5, " ") { if (engine->Cmd_Argc() < 5) { DxMsg(0,"Syntax: es_xemitsound [volume]\n"); err("Not enough arguments."); return; } int nIndex = 0; char * szSound = engine->Cmd_Argv(3); esounds->PrecacheSound(szSound); if (FStrEq(engine->Cmd_Argv(1), "player")) { int nUserid = atoi(engine->Cmd_Argv(2)); nIndex = g_EventScriptsPlugin.LookupIndexByUserID(nUserid); } else if (FStrEq(engine->Cmd_Argv(1), "entity")) { nIndex = atoi(engine->Cmd_Argv(2)); } if (nIndex) { MRecipientFilter filter; filter.AddAllPlayers(maxplayers, playerinfomanager); float fVolume = 1.0f; fVolume = atof(engine->Cmd_Argv(4)); float fAttenuation = 0.0f; fAttenuation = atof(engine->Cmd_Argv(5)); esounds->EmitSound(filter, nIndex, 0, szSound, fVolume, fAttenuation); } }