core/smn_player.cpp
changeset 1049 9891871e223d
parent 1035 dff088cf776e
child 1104 b9597374d13a
     1.1 --- a/core/smn_player.cpp	Sat Jul 07 17:51:29 2007 +0000
     1.2 +++ b/core/smn_player.cpp	Sat Jul 07 18:17:49 2007 +0000
     1.3 @@ -52,6 +52,22 @@
     1.4  static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
     1.5  {
     1.6  	int index = params[1];
     1.7 +
     1.8 +	if (index == 0)
     1.9 +	{
    1.10 +		static ConVar *hostname = NULL;
    1.11 +		if (!hostname)
    1.12 +		{
    1.13 +			hostname = icvar->FindVar("hostname");
    1.14 +			if (!hostname)
    1.15 +			{
    1.16 +				return pCtx->ThrowNativeError("Could not find \"hostname\" cvar");
    1.17 +			}
    1.18 +		}
    1.19 +		pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), hostname->GetString(), NULL);
    1.20 +		return 1;
    1.21 +	}
    1.22 +
    1.23  	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.24  	{
    1.25  		return pCtx->ThrowNativeError("Client index %d is invalid", index);