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

Function EmitSentence

extensions/sdktools/vsound.cpp:1425–1524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1423}
1424
1425static cell_t EmitSentence(IPluginContext *pContext, const cell_t *params)
1426{
1427 cell_t *addr;
1428 CellRecipientFilter crf;
1429 unsigned int numClients;
1430 int client;
1431 IGamePlayer *pPlayer = NULL;
1432
1433 pContext->LocalToPhysAddr(params[1], &addr);
1434 numClients = params[2];
1435
1436 /* Client validation */
1437 for (unsigned int i = 0; i < numClients; i++)
1438 {
1439 client = addr[i];
1440 pPlayer = playerhelpers->GetGamePlayer(client);
1441
1442 if (!pPlayer)
1443 {
1444 return pContext->ThrowNativeError("Client index %d is invalid", client);
1445 } else if (!pPlayer->IsInGame()) {
1446 return pContext->ThrowNativeError("Client %d is not in game", client);
1447 }
1448 }
1449
1450 crf.Initialize(addr, numClients);
1451
1452 int sentence = params[3];
1453 int entity = SoundReferenceToIndex(params[4]);
1454 int channel = params[5];
1455 int level = params[6];
1456 int flags = params[7];
1457 float vol = sp_ctof(params[8]);
1458 int pitch = params[9];
1459 int speakerentity = params[10];
1460
1461 Vector *pOrigin = NULL, origin;
1462 Vector *pDir = NULL, dir;
1463
1464 pContext->LocalToPhysAddr(params[11], &addr);
1465 if (addr != pContext->GetNullRef(SP_NULL_VECTOR))
1466 {
1467 pOrigin = &origin;
1468 origin.x = sp_ctof(addr[0]);
1469 origin.y = sp_ctof(addr[1]);
1470 origin.z = sp_ctof(addr[2]);
1471 }
1472
1473 pContext->LocalToPhysAddr(params[12], &addr);
1474 if (addr != pContext->GetNullRef(SP_NULL_VECTOR))
1475 {
1476 pDir = &dir;
1477 dir.x = sp_ctof(addr[0]);
1478 dir.y = sp_ctof(addr[1]);
1479 dir.z = sp_ctof(addr[2]);
1480 }
1481
1482 bool updatePos = params[13] ? true : false;

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected