PrintToChat/PrintToCenter natives will now break out of displaying if FormatString throws an error

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401023
This commit is contained in:
David Anderson 2007-06-25 23:14:24 +00:00
parent 1d2f3a9cd5
commit 5e7b7589be

View File

@ -278,6 +278,12 @@ static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
char buffer[192]; char buffer[192];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
/* Check for an error before printing to the client */
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
{
return 0;
}
g_HL2.TextMsg(client, HUD_PRINTTALK, buffer); g_HL2.TextMsg(client, HUD_PRINTTALK, buffer);
return 1; return 1;
@ -303,6 +309,12 @@ static cell_t PrintCenterText(IPluginContext *pContext, const cell_t *params)
char buffer[192]; char buffer[192];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
/* Check for an error before printing to the client */
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
{
return 0;
}
g_HL2.TextMsg(client, HUD_PRINTCENTER, buffer); g_HL2.TextMsg(client, HUD_PRINTCENTER, buffer);
return 1; return 1;