From c94e1f7a97b1c7ed6f51083c189088f76417be5c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 7 Jun 2007 04:47:03 +0000 Subject: [PATCH] added %L format specifier for logging player info --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40911 --- core/sm_stringutil.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/core/sm_stringutil.cpp b/core/sm_stringutil.cpp index 92dc0af4..540f4712 100644 --- a/core/sm_stringutil.cpp +++ b/core/sm_stringutil.cpp @@ -722,6 +722,33 @@ reswitch: arg++; break; } + case 'L': + { + CHECK_ARGS(0); + cell_t *value; + pCtx->LocalToPhysAddr(params[arg], &value); + CPlayer *player = g_Players.GetPlayerByIndex(*value); + if (!player || !player->IsConnected()) + { + return pCtx->ThrowNativeError("Client index %d is invalid", *value); + } + char buffer[255]; + const char *auth = player->GetAuthString(); + if (!auth || auth[0] == '\0') + { + auth = "STEAM_ID_PENDING"; + } + int userid = engine->GetPlayerUserId(player->GetEdict()); + UTIL_Format(buffer, + sizeof(buffer), + "%s<%d><%s><>", + player->GetName(), + userid, + auth); + AddString(&buf_p, llen, buffer, width, prec); + arg++; + break; + } case 's': { CHECK_ARGS(0);