core/sm_stringutil.cpp
changeset 906 21fcb8ccdf2b
parent 905 4b0a5d2f1cbe
child 909 4feac08f6764
     1.1 --- a/core/sm_stringutil.cpp	Thu Jun 07 04:47:03 2007 +0000
     1.2 +++ b/core/sm_stringutil.cpp	Thu Jun 07 05:53:32 2007 +0000
     1.3 @@ -727,24 +727,31 @@
     1.4  				CHECK_ARGS(0);
     1.5  				cell_t *value;
     1.6  				pCtx->LocalToPhysAddr(params[arg], &value);
     1.7 -				CPlayer *player = g_Players.GetPlayerByIndex(*value);
     1.8 -				if (!player || !player->IsConnected())
     1.9 -				{
    1.10 -					return pCtx->ThrowNativeError("Client index %d is invalid", *value);
    1.11 -				}
    1.12  				char buffer[255];
    1.13 -				const char *auth = player->GetAuthString();
    1.14 -				if (!auth || auth[0] == '\0')
    1.15 +				if (*value)
    1.16  				{
    1.17 -					auth = "STEAM_ID_PENDING";
    1.18 +					CPlayer *player = g_Players.GetPlayerByIndex(*value);
    1.19 +					if (!player || !player->IsConnected())
    1.20 +					{
    1.21 +						return pCtx->ThrowNativeError("Client index %d is invalid", *value);
    1.22 +					}
    1.23 +					const char *auth = player->GetAuthString();
    1.24 +					if (!auth || auth[0] == '\0')
    1.25 +					{
    1.26 +						auth = "STEAM_ID_PENDING";
    1.27 +					}
    1.28 +					int userid = engine->GetPlayerUserId(player->GetEdict());
    1.29 +					UTIL_Format(buffer, 
    1.30 +						sizeof(buffer), 
    1.31 +						"%s<%d><%s><>", 
    1.32 +						player->GetName(),
    1.33 +						userid,
    1.34 +						auth);
    1.35 +				} else {
    1.36 +					UTIL_Format(buffer,
    1.37 +						sizeof(buffer),
    1.38 +						"Console<0><Console><Console>");
    1.39  				}
    1.40 -				int userid = engine->GetPlayerUserId(player->GetEdict());
    1.41 -				UTIL_Format(buffer, 
    1.42 -					sizeof(buffer), 
    1.43 -					"%s<%d><%s><>", 
    1.44 -					player->GetName(),
    1.45 -					userid,
    1.46 -					auth);
    1.47  				AddString(&buf_p, llen, buffer, width, prec);
    1.48  				arg++;
    1.49  				break;