From 54eb83c30294ba39b3efe71e363358dbc5eb8041 Mon Sep 17 00:00:00 2001 From: LazZzerrr <> Date: Sat, 5 Aug 2023 15:13:32 -0300 Subject: [PATCH] Add new special format specifiers. --- amxmodx/format.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/amxmodx/format.cpp b/amxmodx/format.cpp index cb275d875a..eed8184abf 100644 --- a/amxmodx/format.cpp +++ b/amxmodx/format.cpp @@ -774,6 +774,38 @@ size_t atcprintf(D *buffer, size_t maxlen, const S *format, AMX *amx, cell *para arg++; break; } + case 't': + { + CHECK_ARGS(0); + cell *addr = get_amxaddr(amx, params[arg]); + const char* auth = "Console"; + + if (*addr) + { + CPlayer *player = NULL; + + if (*addr >= 1 && *addr <= gpGlobals->maxClients) + { + player = GET_PLAYER_POINTER_I(*addr); + } + + if (!player || !player->initialized) + { + LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr); + return 0; + } + + auth = GETPLAYERAUTHID(player->pEdict); + if (!auth || auth[0] == '\0') + { + auth = "STEAM_ID_PENDING"; + } + } + + AddString(&buf_p, llen, auth, width, prec); + arg++; + break; + } case '%': *buf_p++ = static_cast(ch); if (!llen)