MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / EmitSound

Function EmitSound

extensions/sdktools/vsound.cpp:821–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

819}
820
821static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
822{
823 cell_t *addr, *cl_array;
824 CellRecipientFilter crf;
825 unsigned int numClients;
826 int client;
827 IGamePlayer *pPlayer = NULL;
828
829 pContext->LocalToPhysAddr(params[1], &cl_array);
830 numClients = params[2];
831
832 /* Client validation */
833 for (unsigned int i = 0; i < numClients; i++)
834 {
835 client = cl_array[i];
836 pPlayer = playerhelpers->GetGamePlayer(client);
837
838 if (!pPlayer)
839 {
840 return pContext->ThrowNativeError("Client index %d is invalid", client);
841 } else if (!pPlayer->IsInGame()) {
842 return pContext->ThrowNativeError("Client %d is not in game", client);
843 }
844 }
845
846 crf.Initialize(cl_array, numClients);
847
848 char *sample;
849 pContext->LocalToString(params[3], &sample);
850
851 int entity = SoundReferenceToIndex(params[4]);
852 int channel = params[5];
853 int level = params[6];
854 int flags = params[7];
855 float vol = sp_ctof(params[8]);
856 int pitch = params[9];
857 int speakerentity = params[10];
858
859 Vector *pOrigin = NULL, origin;
860 Vector *pDir = NULL, dir;
861
862 pContext->LocalToPhysAddr(params[11], &addr);
863 if (addr != pContext->GetNullRef(SP_NULL_VECTOR))
864 {
865 pOrigin = &origin;
866 origin.x = sp_ctof(addr[0]);
867 origin.y = sp_ctof(addr[1]);
868 origin.z = sp_ctof(addr[2]);
869 }
870
871 pContext->LocalToPhysAddr(params[12], &addr);
872 if (addr != pContext->GetNullRef(SP_NULL_VECTOR))
873 {
874 pDir = &dir;
875 dir.x = sp_ctof(addr[0]);
876 dir.y = sp_ctof(addr[1]);
877 dir.z = sp_ctof(addr[2]);
878 }

Callers

nothing calls this directly

Calls 6

SoundReferenceToIndexFunction · 0.85
GetGamePlayerMethod · 0.80
IsInGameMethod · 0.80
IsDedicatedServerMethod · 0.80
InitializeMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected