All pastes #156768 Raw Edit

Untitled

public cpp v1 · immutable
·published 2006-09-01 00:30 UTC
rendered paste body
ES_CON_COMMAND(emitsound,               "Plays a sound from an entity.",               5,               "<emitter-type> <id> <sound> <volume> <attenuation>"){    if (engine->Cmd_Argc() < 5)    {        DxMsg(0,"Syntax: es_xemitsound <emitter-type> <id> <sound> [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);    }}