added amb543

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401055
This commit is contained in:
David Anderson 2007-07-07 18:17:49 +00:00
parent f2ebf2f4b9
commit 081620b1d3

View File

@ -52,6 +52,22 @@ static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
{
int index = params[1];
if (index == 0)
{
static ConVar *hostname = NULL;
if (!hostname)
{
hostname = icvar->FindVar("hostname");
if (!hostname)
{
return pCtx->ThrowNativeError("Could not find \"hostname\" cvar");
}
}
pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), hostname->GetString(), NULL);
return 1;
}
if ((index < 1) || (index > g_Players.GetMaxClients()))
{
return pCtx->ThrowNativeError("Client index %d is invalid", index);