changed how getclientAuthID is called
This commit is contained in:
parent
8d6f4d98aa
commit
e167a1aca9
@ -54,6 +54,7 @@ char g_sBanIssuer[MAXPLAYERS + 1][64];
|
||||
char g_sBanIssuerSID[MAXPLAYERS + 1][32];
|
||||
char g_sBanReason[MAXPLAYERS + 1][32];
|
||||
char g_sSprayHash[MAXPLAYERS + 1][16];
|
||||
char g_csSID[MAXPLAYERS + 1][65];
|
||||
|
||||
int g_iClientToClientSprayLifetime[MAXPLAYERS + 1][MAXPLAYERS + 1];
|
||||
int g_iClientSprayLifetime[MAXPLAYERS + 1] = { 2, ... };
|
||||
@ -275,13 +276,11 @@ public void select_sprays_to_hide(Handle hParent, Handle hChild, const char[] er
|
||||
{
|
||||
if (!IsValidClient(i) || IsFakeClient(i))
|
||||
continue;
|
||||
char sAuthID_target[32];
|
||||
GetClientAuthId(i, AuthId_Steam2, sAuthID_target, sizeof(sAuthID_target), false);
|
||||
if (StrContains(sAuthID_target, "STEAM_0") == -1 && StrContains(sAuthID_target, "STEAM_1") == -1)
|
||||
if (StrContains(g_csSID[i], "STEAM_0") == -1 && StrContains(g_csSID[i], "STEAM_1") == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (StrEqual(sAuthID, sAuthID_target))
|
||||
if (StrEqual(sAuthID, g_csSID[i]))
|
||||
{
|
||||
g_bHasSprayHidden[client][i] = true;
|
||||
PaintWorldDecalToOne(g_iHiddenDecalIndex, g_vecSprayOrigin[i], client);
|
||||
@ -296,6 +295,7 @@ public void select_sprays_to_hide(Handle hParent, Handle hChild, const char[] er
|
||||
|
||||
public void OnClientPostAdminCheck(int client)
|
||||
{
|
||||
GetClientAuthId(client, AuthId_Steam2, g_csSID[client], sizeof(g_csSID[]));
|
||||
if (g_hDatabase != null)
|
||||
{
|
||||
ClearPlayerInfo(client);
|
||||
@ -332,16 +332,18 @@ public void OnClientPostAdminCheck(int client)
|
||||
|
||||
public void update_client_online(int client, int is_online)
|
||||
{
|
||||
char sAuthID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
|
||||
if (!g_hDatabase)
|
||||
{
|
||||
return;
|
||||
}
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE `sprayhidemanage` SET `is_online` = %i WHERE `steamidtarget` = '%s';", is_online, sAuthID);
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE `sprayhidemanage` SET `is_online` = %i WHERE `steamidtarget` = '%s';", is_online, g_csSID[client]);
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
Format(g_csSID[client], sizeof(g_csSID[]), "");
|
||||
if (IsValidClient(client))
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
@ -601,11 +603,9 @@ int MenuHandler_Menu_ListBans(Menu hMenu, MenuAction action, int iParam1, int iP
|
||||
|
||||
void Menu_Trace(int client, int target)
|
||||
{
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(target, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
Menu TraceMenu = new Menu(MenuHandler_Menu_Trace);
|
||||
TraceMenu.SetTitle("Sprayed by: %N (%s)", target, sSteamID);
|
||||
TraceMenu.SetTitle("Sprayed by: %N (%s)", target, g_csSID[client]);
|
||||
|
||||
if (g_bInvokedThroughTopMenu[client])
|
||||
TraceMenu.ExitBackButton = true;
|
||||
@ -1524,10 +1524,8 @@ public Action Command_MarkNSFW(int client, int argc)
|
||||
g_bHasNSFWSpray[client] = true;
|
||||
|
||||
char sQuery[256];
|
||||
char sClientSteamID[32];
|
||||
|
||||
GetClientAuthId(client, AuthId_Steam2, sClientSteamID, sizeof(sClientSteamID));
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraynsfwlist` (`sprayhash`, `sprayersteamid`, `setbyadmin`) VALUES ('%s', '%s', '%d');", g_sSprayHash[client], sClientSteamID, 0);
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraynsfwlist` (`sprayhash`, `sprayersteamid`, `setbyadmin`) VALUES ('%s', '%s', '%d');", g_sSprayHash[client], g_csSID[client], 0);
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
@ -1683,12 +1681,8 @@ public Action Command_HideSpray(int client, int argc)
|
||||
g_bHasSprayHidden[client][iTarget] = true;
|
||||
PrintToChat(client, "\x01\x04[SprayManager]\x01 You have hidden \x04%N\x01's spray.", iTarget); //'
|
||||
|
||||
char sAuthID[32];
|
||||
char sAuthID_target[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
GetClientAuthId(iTarget, AuthId_Steam2, sAuthID_target, sizeof(sAuthID_target), false);
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "INSERT IGNORE INTO `sprayhidemanage` (`steamidhider`, `steamidtarget`) VALUES ('%s', '%s');", sAuthID, sAuthID_target);
|
||||
Format(sQuery, sizeof(sQuery), "INSERT IGNORE INTO `sprayhidemanage` (`steamidhider`, `steamidtarget`) VALUES ('%s', '%s');", g_csSID[client], g_csSID[iTarget]);
|
||||
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -1712,13 +1706,8 @@ public Action Command_HideSpray(int client, int argc)
|
||||
g_bHasSprayHidden[client][i] = true;
|
||||
PrintToChat(client, "\x01\x04[SprayManager]\x01 You have hidden \x04%N\x01's spray.", i); //'
|
||||
|
||||
char sAuthID[32];
|
||||
char sAuthID_target[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
GetClientAuthId(i, AuthId_Steam2, sAuthID_target, sizeof(sAuthID_target), false);
|
||||
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "INSERT IGNORE INTO `sprayhidemanage` (`steamidhider`, `steamidtarget`) VALUES ('%s', '%s');", sAuthID, sAuthID_target);
|
||||
Format(sQuery, sizeof(sQuery), "INSERT IGNORE INTO `sprayhidemanage` (`steamidhider`, `steamidtarget`) VALUES ('%s', '%s');", g_csSID[client], g_csSID[i]);
|
||||
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -1744,6 +1733,12 @@ public Action Command_UnhideSpray(int client, int argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (!g_hDatabase)
|
||||
{
|
||||
ReplyToCommand(client, "Database connection offline.");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
int iTarget;
|
||||
@ -1757,12 +1752,8 @@ public Action Command_UnhideSpray(int client, int argc)
|
||||
g_bHasSprayHidden[client][iTarget] = false;
|
||||
PrintToChat(client, "\x01\x04[SprayManager]\x01 You have unhidden \x04%N\x01's spray.", iTarget); // '
|
||||
|
||||
char sAuthID[32];
|
||||
char sAuthID_target[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
GetClientAuthId(iTarget, AuthId_Steam2, sAuthID_target, sizeof(sAuthID_target), false);
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `steamidtarget` = '%s';", sAuthID, sAuthID_target);
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `steamidtarget` = '%s';", g_csSID[client], g_csSID[iTarget]);
|
||||
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -1794,12 +1785,8 @@ public Action Command_UnhideSpray(int client, int argc)
|
||||
g_bHasSprayHidden[client][i] = false;
|
||||
PrintToChat(client, "\x01\x04[SprayManager]\x01 You have unhidden \x04%N\x01's spray.", i); //'
|
||||
|
||||
char sAuthID[32];
|
||||
char sAuthID_target[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
GetClientAuthId(i, AuthId_Steam2, sAuthID_target, sizeof(sAuthID_target), false);
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `steamidtarget` = '%s';", sAuthID, sAuthID_target);
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `steamidtarget` = '%s';", g_csSID[client], g_csSID[i]);
|
||||
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -2369,22 +2356,25 @@ public Action HookSprayer(int iClients[MAXPLAYERS], int &iNumClients, char sSoun
|
||||
|
||||
public Action Timer_UpdateHideSprays(Handle hTimer)
|
||||
{
|
||||
if (!g_hDatabase)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (!IsValidClient(client) || IsFakeClient(client))
|
||||
continue;
|
||||
|
||||
char sAuthID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
||||
if (StrContains(sAuthID, "STEAM_0") == -1 && StrContains(sAuthID, "STEAM_1") == -1)
|
||||
if (StrContains(g_csSID[client], "STEAM_0") == -1 && StrContains(g_csSID[client], "STEAM_1") == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "SELECT `steamidtarget` FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `is_online` = 1;", sAuthID);
|
||||
Format(sQuery, sizeof(sQuery), "SELECT `steamidtarget` FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `is_online` = 1;", g_csSID[client]);
|
||||
SQL_TQuery(g_hDatabase, select_sprays_to_hide, sQuery, GetClientSerial(client), DBPrio_Normal);
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Timer_PerformPlayerTraces(Handle hTimer)
|
||||
@ -2408,10 +2398,7 @@ public Action Timer_PerformPlayerTraces(Handle hTimer)
|
||||
|
||||
if (IsPointInsideAABB(vecPos, g_SprayAABB[x]))
|
||||
{
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(x, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
PrintHintText(i, "Sprayed by: %N (%s) [%s]", x, sSteamID, g_bHasNSFWSpray[x] ? "NSFW" : "SFW");
|
||||
PrintHintText(i, "Sprayed by: %N (%s) [%s]", x, g_csSID[x], g_bHasNSFWSpray[x] ? "NSFW" : "SFW");
|
||||
StopSound(i, SNDCHAN_STATIC, "UI/hint.wav");
|
||||
|
||||
bLookingatSpray[i] = true;
|
||||
@ -2720,19 +2707,16 @@ public bool SprayBanClient1(int client, int target, int iBanLength, const char[]
|
||||
char sQuery[1024];
|
||||
char sAdminName[64];
|
||||
char sTargetName[64];
|
||||
char sTargetSteamID[32];
|
||||
char sAdminSteamID[32];
|
||||
|
||||
Format(sAdminName, sizeof(sAdminName), "%N", client);
|
||||
GetClientName(target, sTargetName, sizeof(sTargetName));
|
||||
|
||||
if (client)
|
||||
GetClientAuthId(client, AuthId_Steam2, sAdminSteamID, sizeof(sAdminSteamID));
|
||||
Format(sAdminSteamID, sizeof(sAdminSteamID), g_csSID[client]);
|
||||
else
|
||||
strcopy(sAdminSteamID, sizeof(sAdminSteamID), "STEAM_ID_SERVER");
|
||||
|
||||
GetClientAuthId(target, AuthId_Steam2, sTargetSteamID, sizeof(sTargetSteamID));
|
||||
|
||||
char[] sSafeAdminName = new char[2 * strlen(sAdminName) + 1];
|
||||
char[] sSafeTargetName = new char[2 * strlen(sTargetName) + 1];
|
||||
char[] sSafeReason = new char[2 * strlen(sReason) + 1];
|
||||
@ -2746,11 +2730,11 @@ public bool SprayBanClient1(int client, int target, int iBanLength, const char[]
|
||||
banlength = GetTime() + (iBanLength * 60);
|
||||
}
|
||||
int issuedtime = GetTime();
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraymanager` (`steamid`, `name`, `unbantime`, `issuersteamid`, `issuername`, `issuedtime`, `issuedreason`) VALUES ('%s', '%s', '%d', '%s', '%s', '%d', '%s')", sTargetSteamID, sSafeTargetName, banlength, sAdminSteamID, sSafeAdminName, issuedtime, "GAN (Gay Ass Nigga)");
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraymanager` (`steamid`, `name`, `unbantime`, `issuersteamid`, `issuername`, `issuedtime`, `issuedreason`) VALUES ('%s', '%s', '%d', '%s', '%s', '%d', '%s')", g_csSID[target], sSafeTargetName, banlength, sAdminSteamID, sSafeAdminName, issuedtime, "GAN (Gay Ass Nigga)");
|
||||
|
||||
//compiler accepts but does absolutely not like this formatting, just secretly decides to crash over it
|
||||
/*
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraymanager` (`steamid`, `name`, `unbantime`, `issuersteamid`, `issuername`, `issuedtime`, `issuedreason`) VALUES ('%s', '%s', '%d', '%s', '%s', '%d', '%s');", sTargetSteamID, sSafeTargetName, iBanLength ? (GetTime() + (iBanLength * 60)) : 0, sAdminSteamID, sSafeAdminName, GetTime(), strlen(sSafeReason) > 1 ? sSafeReason : "none");
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraymanager` (`steamid`, `name`, `unbantime`, `issuersteamid`, `issuername`, `issuedtime`, `issuedreason`) VALUES ('%s', '%s', '%d', '%s', '%s', '%d', '%s');", g_csSID[target], sSafeTargetName, iBanLength ? (GetTime() + (iBanLength * 60)) : 0, sAdminSteamID, sSafeAdminName, GetTime(), strlen(sSafeReason) > 1 ? sSafeReason : "none");
|
||||
*/
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -2794,10 +2778,7 @@ bool SprayUnbanClient(int target, int client=-1)
|
||||
}
|
||||
|
||||
char sQuery[128];
|
||||
char sClientSteamID[32];
|
||||
|
||||
GetClientAuthId(target, AuthId_Steam2, sClientSteamID, sizeof(sClientSteamID));
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `spraymanager` WHERE steamid = '%s';", sClientSteamID);
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `spraymanager` WHERE steamid = '%s';", g_csSID[target]);
|
||||
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -2836,16 +2817,14 @@ bool BanClientSpray(int client, int target)
|
||||
|
||||
char sQuery[256];
|
||||
char sTargetName[64];
|
||||
char sTargetSteamID[32];
|
||||
|
||||
GetClientName(target, sTargetName, sizeof(sTargetName));
|
||||
GetClientAuthId(target, AuthId_Steam2, sTargetSteamID, sizeof(sTargetSteamID));
|
||||
|
||||
char[] sSafeTargetName = new char[2 * strlen(sTargetName) + 1];
|
||||
SQL_EscapeString(g_hDatabase, sTargetName, sSafeTargetName, 2 * strlen(sTargetName) + 1);
|
||||
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `sprayblacklist` (`sprayhash`, `sprayer`, `sprayersteamid`) VALUES ('%s', '%s', '%s');",
|
||||
g_sSprayHash[target], sSafeTargetName, sTargetSteamID);
|
||||
g_sSprayHash[target], sSafeTargetName, g_csSID[target]);
|
||||
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
@ -2890,11 +2869,13 @@ bool UnbanClientSpray(int client, int target)
|
||||
void AdminForceSprayNSFW(int client)
|
||||
{
|
||||
char sQuery[256];
|
||||
char sClientSteamID[32];
|
||||
|
||||
GetClientAuthId(client, AuthId_Steam2, sClientSteamID, sizeof(sClientSteamID));
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraynsfwlist` (`sprayhash`, `sprayersteamid`, `setbyadmin`) VALUES ('%s', '%s', '%d');", g_sSprayHash[client], sClientSteamID, 1);
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraynsfwlist` (`sprayhash`, `sprayersteamid`, `setbyadmin`) VALUES ('%s', '%s', '%d');", g_sSprayHash[client], g_csSID[client], 1);
|
||||
|
||||
if (g_hDatabase == null || !g_bFullyConnected)
|
||||
{
|
||||
ReplyToCommand(client, "[SprayManager] Database is not connected.");
|
||||
return;
|
||||
}
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
g_bHasNSFWSpray[client] = true;
|
||||
@ -2927,11 +2908,14 @@ void AdminForceSprayNSFW(int client)
|
||||
void AdminForceSpraySFW(int client)
|
||||
{
|
||||
char sQuery[256];
|
||||
char sClientSteamID[32];
|
||||
|
||||
GetClientAuthId(client, AuthId_Steam2, sClientSteamID, sizeof(sClientSteamID));
|
||||
Format(sQuery, sizeof(sQuery), "DELETE FROM `spraynsfwlist` WHERE `sprayhash` = '%s';", g_sSprayHash[client]);
|
||||
|
||||
if (g_hDatabase == null || !g_bFullyConnected)
|
||||
{
|
||||
ReplyToCommand(client, "[SprayManager] Database is not connected.");
|
||||
return;
|
||||
}
|
||||
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
|
||||
|
||||
g_bHasNSFWSpray[client] = false;
|
||||
@ -2967,12 +2951,8 @@ void UpdatePlayerInfo(int client)
|
||||
if (g_hDatabase == null || !g_bFullyConnected)
|
||||
return;
|
||||
|
||||
char sSteamID[32];
|
||||
char sQuery[128];
|
||||
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
Format(sQuery, sizeof(sQuery), "SELECT * FROM `spraymanager` WHERE `steamid` = '%s';", sSteamID);
|
||||
|
||||
Format(sQuery, sizeof(sQuery), "SELECT * FROM `spraymanager` WHERE `steamid` = '%s';", g_csSID[client]);
|
||||
SQL_TQuery(g_hDatabase, OnSQLCheckBanQuery, sQuery, GetClientSerial(client), DBPrio_Normal);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user