fucking ass formatting broke the command and compiler cant tell where the fucking error was

This commit is contained in:
jenz 2023-05-05 01:29:30 +02:00
parent 874bc4e7ca
commit 0c8a683d23

View File

@ -778,7 +778,7 @@ int MenuHandler_Menu_Trace_SprayBan(Menu hMenu, MenuAction action, int iParam1,
}
else
{
if (SprayBanClient(iParam1, target, StringToInt(sOption), "Inappropriate Spray"))
if (SprayBanClient1(iParam1, target, StringToInt(sOption), "Inappropriate Spray"))
{
ShowActivity2(iParam1, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", target);
LogAction(iParam1, target, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", iParam1, target, g_sSprayHash[target]);
@ -1056,7 +1056,7 @@ int MenuHandler_Menu_SprayBan_Length(Menu hMenu, MenuAction action, int iParam1,
}
else
{
if (SprayBanClient(iParam1, target, StringToInt(sOption), "Inappropriate Spray"))
if (SprayBanClient1(iParam1, target, StringToInt(sOption), "Inappropriate Spray"))
{
ShowActivity2(iParam1, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", target);
LogAction(iParam1, target, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", iParam1, target, g_sSprayHash[target]);
@ -1890,8 +1890,12 @@ public Action Command_SprayBan(int client, int argc)
if ((iTarget = FindTarget(client, sTarget)) <= 0)
return Plugin_Handled;
if (!SprayBanClient(client, iTarget, StringToInt(sLength), sReason))
//unknown command sm_sprayban, ok m8 (a fucking line beak in formatting the Query broke this shit for years omfg)
if (!SprayBanClient1(client, iTarget, StringToInt(sLength), sReason))
{
PrintToChat(client, "Well shit nigga");
return Plugin_Handled;
}
ShowActivity2(client, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", iTarget);
LogAction(client, iTarget, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", client, iTarget, g_sSprayHash[iTarget]);
@ -2693,66 +2697,74 @@ public void ConVarChanged_DecalFrequency(ConVar cvar, const char[] sOldValue, co
}
}
bool SprayBanClient(int client, int target, int iBanLength, const char[] sReason)
public bool SprayBanClient1(int client, int target, int iBanLength, const char[] sReason)
{
if (!IsValidClient(target))
{
ReplyToCommand(client, "[SprayManager] Target is no longer valid.");
return false;
}
if (!IsValidClient(target))
{
ReplyToCommand(client, "[SprayManager] Target is no longer valid.");
return false;
}
if (g_hDatabase == null || !g_bFullyConnected)
{
ReplyToCommand(client, "[SprayManager] Database is not connected.");
return false;
}
if (g_hDatabase == null || !g_bFullyConnected)
{
ReplyToCommand(client, "[SprayManager] Database is not connected.");
return false;
}
if (g_bSprayBanned[target])
{
ReplyToCommand(client, "[SprayManager] %N is already spray banned.", target);
return false;
}
if (g_bSprayBanned[target])
{
ReplyToCommand(client, "[SprayManager] %N is already spray banned.", target);
return false;
}
char sQuery[512];
char sAdminName[64];
char sTargetName[64];
char sTargetSteamID[32];
char sAdminSteamID[32];
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));
Format(sAdminName, sizeof(sAdminName), "%N", client);
GetClientName(target, sTargetName, sizeof(sTargetName));
if (client)
GetClientAuthId(client, AuthId_Steam2, sAdminSteamID, sizeof(sAdminSteamID));
else
strcopy(sAdminSteamID, sizeof(sAdminSteamID), "STEAM_ID_SERVER");
if (client)
GetClientAuthId(client, AuthId_Steam2, sAdminSteamID, sizeof(sAdminSteamID));
else
strcopy(sAdminSteamID, sizeof(sAdminSteamID), "STEAM_ID_SERVER");
GetClientAuthId(target, AuthId_Steam2, sTargetSteamID, sizeof(sTargetSteamID));
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];
SQL_EscapeString(g_hDatabase, sAdminName, sSafeAdminName, 2 * strlen(sAdminName) + 1);
SQL_EscapeString(g_hDatabase, sTargetName, sSafeTargetName, 2 * strlen(sTargetName) + 1);
SQL_EscapeString(g_hDatabase, sReason, sSafeReason, 2 * strlen(sReason) + 1);
char[] sSafeAdminName = new char[2 * strlen(sAdminName) + 1];
char[] sSafeTargetName = new char[2 * strlen(sTargetName) + 1];
char[] sSafeReason = new char[2 * strlen(sReason) + 1];
SQL_EscapeString(g_hDatabase, sAdminName, sSafeAdminName, 2 * strlen(sAdminName) + 1);
SQL_EscapeString(g_hDatabase, sTargetName, sSafeTargetName, 2 * strlen(sTargetName) + 1);
SQL_EscapeString(g_hDatabase, sReason, sSafeReason, 2 * strlen(sReason) + 1);
int banlength = 0;
if (iBanLength > 0)
{
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');",
sTargetSteamID, sSafeTargetName, iBanLength ? (GetTime() + (iBanLength * 60)) : 0, sAdminSteamID, sSafeAdminName, GetTime(), strlen(sSafeReason) > 1 ? sSafeReason : "none");
//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");
*/
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
SQL_TQuery(g_hDatabase, DummyCallback, sQuery);
strcopy(g_sBanIssuer[target], sizeof(g_sBanIssuer[]), sAdminName);
strcopy(g_sBanIssuerSID[target], sizeof(g_sBanIssuerSID[]), sAdminSteamID);
strcopy(g_sBanReason[target], sizeof(g_sBanReason[]), strlen(sReason) ? sReason : "none");
g_bSprayBanned[target] = true;
g_iSprayBanTimestamp[target] = GetTime();
g_iSprayUnbanTimestamp[target] = iBanLength ? (GetTime() + (iBanLength * 60)) : 0;
g_fNextSprayTime[target] = 0.0;
strcopy(g_sBanIssuer[target], sizeof(g_sBanIssuer[]), sAdminName);
strcopy(g_sBanIssuerSID[target], sizeof(g_sBanIssuerSID[]), sAdminSteamID);
strcopy(g_sBanReason[target], sizeof(g_sBanReason[]), strlen(sReason) ? sReason : "none");
g_bSprayBanned[target] = true;
g_iSprayBanTimestamp[target] = GetTime();
g_iSprayUnbanTimestamp[target] = iBanLength ? (GetTime() + (iBanLength * 60)) : 0;
g_fNextSprayTime[target] = 0.0;
g_iAllowSpray = target;
SprayClientDecalToAll(target, 0, ACTUAL_NULL_VECTOR);
return true;
g_iAllowSpray = target;
SprayClientDecalToAll(target, 0, ACTUAL_NULL_VECTOR);
return true;
}
bool SprayUnbanClient(int target, int client=-1)