Update NoSteamManager.sp
This commit is contained in:
		
							parent
							
								
									bcfcde5be7
								
							
						
					
					
						commit
						b651a070f7
					
				@ -25,6 +25,18 @@ public Plugin myinfo =
 | 
				
			|||||||
	version      = "2.0.0"
 | 
						version      = "2.0.0"
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int errorSize)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						CreateNative("NSM_IsPlayerSteam", Native_IsPlayerSteam);
 | 
				
			||||||
 | 
						CreateNative("NSM_GetPlayerType", Native_GetPlayerType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RegPluginLibrary("NoSteamManager");
 | 
				
			||||||
 | 
						return APLRes_Success;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
// Purpose:
 | 
					// Purpose:
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
@ -239,10 +251,10 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
 | 
				
			|||||||
	GetClientIP(client, sAddress, sizeof(sAddress));
 | 
						GetClientIP(client, sAddress, sizeof(sAddress));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char sConnectionType[32];
 | 
						char sConnectionType[32];
 | 
				
			||||||
	if(!SteamClientAuthenticated(sAuthID))
 | 
						if(SteamClientAuthenticated(sAuthID))
 | 
				
			||||||
		sConnectionType = "NoAuth";
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		sConnectionType = "SteamLegit";
 | 
							sConnectionType = "SteamLegit";
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							sConnectionType = "NoAuth";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(results.RowCount && results.FetchRow())
 | 
						if(results.RowCount && results.FetchRow())
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -281,3 +293,62 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_Low);
 | 
						g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_Low);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public int Native_IsPlayerSteam(Handle hPlugin, int numParams)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = GetNativeCell(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (client < 1 || client > MaxClients)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client index %d is invalid", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (!IsClientConnected(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (IsFakeClient(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is a bot", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char sAuthID[32];
 | 
				
			||||||
 | 
						GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(SteamClientAuthenticated(sAuthID))
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public int Native_GetPlayerType(Handle hPlugin, int numParams)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = GetNativeCell(1);
 | 
				
			||||||
 | 
						int length = GetNativeCell(3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (client < 1 || client > MaxClients)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client index %d is invalid", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (!IsClientConnected(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (IsFakeClient(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is a bot", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char sAuthID[32];
 | 
				
			||||||
 | 
						GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(SteamClientAuthenticated(sAuthID))
 | 
				
			||||||
 | 
							return SetNativeString(1, "SteamLegit", length + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return SetNativeString(1, "NoAuth", length + 1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -25,6 +25,18 @@ public Plugin myinfo =
 | 
				
			|||||||
	version      = "2.0.0"
 | 
						version      = "2.0.0"
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int errorSize)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						CreateNative("NSM_IsPlayerSteam", Native_IsPlayerSteam);
 | 
				
			||||||
 | 
						CreateNative("NSM_GetPlayerType", Native_GetPlayerType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RegPluginLibrary("NoSteamManager");
 | 
				
			||||||
 | 
						return APLRes_Success;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
// Purpose:
 | 
					// Purpose:
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
@ -269,3 +281,53 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_Low);
 | 
						g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_Low);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public int Native_IsPlayerSteam(Handle hPlugin, int numParams)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = GetNativeCell(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (client < 1 || client > MaxClients)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client index %d is invalid", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (!IsClientConnected(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (IsFakeClient(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is a bot", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return RevEmu_IsPlayerSteam(client);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public int Native_GetPlayerType(Handle hPlugin, int numParams)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = GetNativeCell(1);
 | 
				
			||||||
 | 
						int length = GetNativeCell(3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (client < 1 || client > MaxClients)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client index %d is invalid", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (!IsClientConnected(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (IsFakeClient(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is a bot", client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char[] sPlayerType = new char[length + 1];
 | 
				
			||||||
 | 
						RevEmu_GetPlayerType(client, sPlayerType, length + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return SetNativeString(1, sPlayerType, length + 1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user