core/smn_player.cpp
changeset 3418 b0e93f5101ef
parent 3400 6e39456566fe
child 3696 9588d737efe0
     1.1 --- a/core/smn_player.cpp	Thu Oct 20 21:35:50 2011 -0400
     1.2 +++ b/core/smn_player.cpp	Thu Oct 20 21:39:57 2011 -0400
     1.3 @@ -200,6 +200,40 @@
     1.4  	return (pPlayer->IsFakeClient()) ? 1 : 0;
     1.5  }
     1.6  
     1.7 +static cell_t sm_IsClientSourceTV(IPluginContext *pCtx, const cell_t *params)
     1.8 +{
     1.9 +	int index = params[1];
    1.10 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.11 +	{
    1.12 +		return pCtx->ThrowNativeError("Client index %d is invalid", index);
    1.13 +	}
    1.14 +
    1.15 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    1.16 +	if (!pPlayer->IsConnected())
    1.17 +	{
    1.18 +		return pCtx->ThrowNativeError("Client %d is not connected", index);
    1.19 +	}
    1.20 +
    1.21 +	return (pPlayer->IsSourceTV()) ? 1 : 0;
    1.22 +}
    1.23 +
    1.24 +static cell_t sm_IsClientReplay(IPluginContext *pCtx, const cell_t *params)
    1.25 +{
    1.26 +	int index = params[1];
    1.27 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.28 +	{
    1.29 +		return pCtx->ThrowNativeError("Client index %d is invalid", index);
    1.30 +	}
    1.31 +
    1.32 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    1.33 +	if (!pPlayer->IsConnected())
    1.34 +	{
    1.35 +		return pCtx->ThrowNativeError("Client %d is not connected", index);
    1.36 +	}
    1.37 +
    1.38 +	return (pPlayer->IsReplay()) ? 1 : 0;
    1.39 +}
    1.40 +
    1.41  static cell_t IsClientObserver(IPluginContext *pContext, const cell_t *params)
    1.42  {
    1.43  	int client = params[1];
    1.44 @@ -1605,6 +1639,8 @@
    1.45  	{"IsClientAuthorized",		sm_IsClientAuthorized},
    1.46  	{"IsClientConnected",		sm_IsClientConnected},
    1.47  	{"IsFakeClient",			sm_IsClientFakeClient},
    1.48 +	{"IsClientSourceTV",		sm_IsClientSourceTV},
    1.49 +	{"IsClientReplay",			sm_IsClientReplay},
    1.50  	{"IsClientInGame",			sm_IsClientInGame},
    1.51  	{"IsClientObserver",		IsClientObserver},
    1.52  	{"RemoveUserFlags",			RemoveUserFlags},