Update NoSteamManager.sp
This commit is contained in:
parent
bcfcde5be7
commit
b651a070f7
@ -25,6 +25,18 @@ public Plugin myinfo =
|
||||
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:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -239,10 +251,10 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
GetClientIP(client, sAddress, sizeof(sAddress));
|
||||
|
||||
char sConnectionType[32];
|
||||
if(!SteamClientAuthenticated(sAuthID))
|
||||
sConnectionType = "NoAuth";
|
||||
else
|
||||
if(SteamClientAuthenticated(sAuthID))
|
||||
sConnectionType = "SteamLegit";
|
||||
else
|
||||
sConnectionType = "NoAuth";
|
||||
|
||||
if(results.RowCount && results.FetchRow())
|
||||
{
|
||||
@ -280,4 +292,63 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth, type, address) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE type='%s', address='%s';", sAuthID, sConnectionType, sAddress, sConnectionType, sAddress);
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 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:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -268,4 +280,54 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth, type, address) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE type='%s', address='%s';", sAuthID, sConnectionType, sAddress, sConnectionType, sAddress);
|
||||
|
||||
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