core/smn_player.cpp
changeset 2591 15213de19689
parent 2375 d96cbbc866df
child 2961 c3bb13e8760b
     1.1 --- a/core/smn_player.cpp	Thu Feb 19 14:23:36 2009 +1300
     1.2 +++ b/core/smn_player.cpp	Thu Feb 19 19:19:44 2009 +1300
     1.3 @@ -1551,6 +1551,24 @@
     1.4  	return bShowActivity ? 1 : 0;
     1.5  }
     1.6  
     1.7 +static cell_t sm_GetClientSerial(IPluginContext *pContext, const cell_t *params)
     1.8 +{
     1.9 +	int client = params[1];
    1.10 +
    1.11 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
    1.12 +	if (!pPlayer)
    1.13 +	{
    1.14 +		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.15 +	}
    1.16 +
    1.17 +	return pPlayer->GetSerial();
    1.18 +}
    1.19 +
    1.20 +static cell_t sm_GetClientFromSerial(IPluginContext *pContext, const cell_t *params)
    1.21 +{
    1.22 +	return g_Players.GetClientFromSerial(params[1]);
    1.23 +}
    1.24 +
    1.25  REGISTER_NATIVES(playernatives)
    1.26  {
    1.27  	{"AddUserFlags",			AddUserFlags},
    1.28 @@ -1604,6 +1622,8 @@
    1.29  	{"IsClientInKickQueue",		IsClientInKickQueue},
    1.30  	{"ProcessTargetString",		ProcessTargetString},
    1.31  	{"FormatActivitySource",	FormatActivitySource},
    1.32 +	{"GetClientSerial",			sm_GetClientSerial},
    1.33 +	{"GetClientFromSerial",		sm_GetClientFromSerial},
    1.34  	{NULL,						NULL}
    1.35  };
    1.36