diff -r b747916c9e02 -r dc5dcaaeb744 extensions/cstrike/natives.cpp --- a/extensions/cstrike/natives.cpp Sat Nov 17 05:40:58 2007 +0000 +++ b/extensions/cstrike/natives.cpp Sat Nov 17 05:41:47 2007 +0000 @@ -69,6 +69,45 @@ return pUnk->GetBaseEntity(); } +static cell_t CS_PrintHintText(IPluginContext *pContext, const cell_t *params) +{ + int client = params[1]; + IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(params[1]); + + if (!pPlayer) + { + return pContext->ThrowNativeError("Client index %d is invalid", client); + } + + if (!pPlayer->IsInGame()) + { + return pContext->ThrowNativeError("Client %d is not in game", client); + } + + g_pSM->SetGlobalTarget(client); + + char buffer[192]; + g_pSM->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; + } + + bf_write *pBitBuf = usermsgs->StartMessage(g_msgHintText, ¶ms[1], 1, USERMSG_RELIABLE); + if (pBitBuf == NULL) + { + return pContext->ThrowNativeError("Could not send a usermessage"); + } + pBitBuf->WriteByte(1); + pBitBuf->WriteString(buffer); + usermsgs->EndMessage(); + + return 1; +} + + static cell_t CS_RespawnPlayer(IPluginContext *pContext, const cell_t *params) { static ICallWrapper *pWrapper = NULL; @@ -124,3 +163,9 @@ {"CS_SwitchTeam", CS_SwitchTeam}, {NULL, NULL} }; + +sp_nativeinfo_t g_CS_PrintHintText[] = +{ + {"PrintHintText", CS_PrintHintText}, + {NULL, NULL}, +};