From f8816ab5566c5ac296a390cf04ed5baeefbee9f1 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 13 Sep 2007 17:30:27 +0000 Subject: [PATCH] added amb932 on a lark... %N maps to a client name, or "Console" --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401426 --- core/sm_stringutil.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/sm_stringutil.cpp b/core/sm_stringutil.cpp index 03d3bd55..a76268c4 100644 --- a/core/sm_stringutil.cpp +++ b/core/sm_stringutil.cpp @@ -789,6 +789,26 @@ reswitch: arg++; break; } + case 'N': + { + CHECK_ARGS(0); + cell_t *value; + pCtx->LocalToPhysAddr(params[arg], &value); + + const char *name = "Console"; + if (*value) + { + CPlayer *player = g_Players.GetPlayerByIndex(*value); + if (!player || !player->IsConnected()) + { + return pCtx->ThrowNativeError("Client index %d is invalid", *value); + } + name = player->GetName(); + } + AddString(&buf_p, llen, name, width, prec); + arg++; + break; + } case 's': { CHECK_ARGS(0);