Add GetClientIClient native.
This commit is contained in:
		
							parent
							
								
									b362abf4b2
								
							
						
					
					
						commit
						2e28df3dc6
					
				| @ -356,6 +356,27 @@ static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params) | |||||||
| 	return sp_ftoc(value); | 	return sp_ftoc(value); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static cell_t sm_GetClientIClient(IPluginContext *pContext, const cell_t *params) | ||||||
|  | { | ||||||
|  | 	int client = params[1]; | ||||||
|  | 
 | ||||||
|  | 	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client); | ||||||
|  | 	if (!pPlayer) | ||||||
|  | 	{ | ||||||
|  | 		return pContext->ThrowNativeError("Client index %d is invalid", client); | ||||||
|  | 	} | ||||||
|  | 	else if (!pPlayer->IsConnected()) | ||||||
|  | 	{ | ||||||
|  | 		return pContext->ThrowNativeError("Client %d is not connected", client); | ||||||
|  | 	} | ||||||
|  | 	else if (pPlayer->IsFakeClient()) | ||||||
|  | 	{ | ||||||
|  | 		return pContext->ThrowNativeError("Client %d is a bot", client); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return (cell_t)pPlayer->GetIClient(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params) | static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params) | ||||||
| { | { | ||||||
| 	int client = params[1]; | 	int client = params[1]; | ||||||
| @ -392,6 +413,7 @@ REGISTER_NATIVES(playernatives) | |||||||
| 	{"GetClientAvgChoke",		GetAvgChoke}, | 	{"GetClientAvgChoke",		GetAvgChoke}, | ||||||
| 	{"GetClientAvgData",		GetAvgData}, | 	{"GetClientAvgData",		GetAvgData}, | ||||||
| 	{"GetClientAvgPackets",		GetAvgPackets}, | 	{"GetClientAvgPackets",		GetAvgPackets}, | ||||||
|  | 	{"GetClientIClient",		sm_GetClientIClient }, | ||||||
| 	{"RunAdminCacheChecks",		RunAdminCacheChecks}, | 	{"RunAdminCacheChecks",		RunAdminCacheChecks}, | ||||||
| 	{NULL,						NULL} | 	{NULL,						NULL} | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -738,6 +738,15 @@ native float GetClientAvgData(int client, NetFlow flow); | |||||||
|  */ |  */ | ||||||
| native float GetClientAvgPackets(int client, NetFlow flow); | native float GetClientAvgPackets(int client, NetFlow flow); | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  |  * Returns the client's baseserver IClient pointer. | ||||||
|  |  * | ||||||
|  |  * @param client		Player's index. | ||||||
|  |  * @return				IClient address. | ||||||
|  |  * @error				Invalid client index, client not connected, or fake client. | ||||||
|  |  */ | ||||||
|  | native Address GetClientIClient(int client); | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * Translates an userid index to the real player index. |  * Translates an userid index to the real player index. | ||||||
|  * |  * | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user