From 09208346264206d1a89ea141bb3e6b4931341a3e Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Sat, 26 Apr 2025 23:01:17 -0700 Subject: [PATCH] Fix functionality of ent_setname command --- src/game/server/baseentity.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index 3462fd3700a..8dbc9bf3f24 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -5784,7 +5784,7 @@ void CC_Ent_SetName( const CCommand& args ) { CBaseEntity *pEntity = NULL; - if ( args.ArgC() < 1 ) + if ( args.ArgC() < 2 ) { CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() ); if (!pPlayer) @@ -5795,7 +5795,7 @@ void CC_Ent_SetName( const CCommand& args ) else { // If no name was given set bits based on the picked - if ( FStrEq( args[2],"") ) + if ( FStrEq( args[2], "" ) ) { pEntity = FindPickerEntity( UTIL_GetCommandClient() ); } @@ -5805,9 +5805,9 @@ void CC_Ent_SetName( const CCommand& args ) CBaseEntity *ent = NULL; while ( (ent = gEntList.NextEnt(ent)) != NULL ) { - if ( (ent->GetEntityName() != NULL_STRING && FStrEq(args[1], STRING(ent->GetEntityName()))) || - (ent->m_iClassname != NULL_STRING && FStrEq(args[1], STRING(ent->m_iClassname))) || - (ent->GetClassname()!=NULL && FStrEq(args[1], ent->GetClassname()))) + if (( ent->GetEntityName() != NULL_STRING && FStrEq( args[2], STRING( ent->GetEntityName() ) ) ) || + ( ent->m_iClassname != NULL_STRING && FStrEq( args[2], STRING( ent->m_iClassname ) ) ) || + ( ent->GetClassname() != NULL && FStrEq( args[2], ent->GetClassname() ) ) ) { pEntity = ent; break;