Skip to content

Commit

Permalink
Merge pull request #169 from ampreeT/dialogue-friend-fix
Browse files Browse the repository at this point in the history
Fixed `CAI_BaseNPC::FindNamedEntity` not catching friends
  • Loading branch information
ampreeT authored Nov 13, 2024
2 parents 9a377be + c5231b4 commit 2ca775f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripting/include/srccoop/entitypatch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,13 @@ public MRESReturn Hook_FindNamedEntity(int _this, Handle hReturn, Handle hParams
{
char szName[MAX_CLASSNAME];
DHookGetParamString(hParams, 1, szName, sizeof(szName));
if ((strcmp(szName, "Player", false) == 0) || (strcmp(szName, "!player", false) == 0))
if ((strcmp(szName, "Player", false) == 0)
|| (strcmp(szName, "!player", false) == 0)
|| (strcmp(szName, "!nearestfriend", false) == 0)
|| (strcmp(szName, "!friend", false) == 0))
{
CBaseEntity pActor = CBaseEntity(DHookGetParam(hParams, 2));
if (pActor.IsValid())
if (pActor != NULL_CBASEENTITY)
{
CBasePlayer pBestPlayer = GetNearestPlayer(pActor);
if (pBestPlayer != NULL_CBASEENTITY)
Expand Down

0 comments on commit 2ca775f

Please sign in to comment.