Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions core/logic/sprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <am-float.h>
#include <am-string.h>
#include <IDBDriver.h>
#include <IGameHelpers.h>
#include <ITranslator.h>
#include <bridge/include/IScriptManager.h>
#include <bridge/include/CoreProvider.h>
Expand Down Expand Up @@ -1199,6 +1200,22 @@ size_t atcprintf(char *buffer, size_t maxlen, const char *format, IPluginContext
arg++;
break;
}
case 'E':
{
CHECK_ARGS(0);
cell_t *value;
pCtx->LocalToPhysAddr(params[arg], &value);

CBaseEntity *entity = gamehelpers->ReferenceToEntity(*value);
if (!entity)
return pCtx->ThrowNativeError("Entity index %d is invalid (arg %d)", *value, arg);

const char *classname = gamehelpers->GetEntityClassname(entity);
if (!AddString(&buf_p, llen, classname, width, prec, flags))
return pCtx->ThrowNativeError("Escaped string would be truncated (arg %d)", arg);
arg++;
break;
}
case 's':
{
CHECK_ARGS(0);
Expand Down