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 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); ShowActivity2(iParam1, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", target);
LogAction(iParam1, target, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", iParam1, target, g_sSprayHash[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 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); ShowActivity2(iParam1, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", target);
LogAction(iParam1, target, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", iParam1, target, g_sSprayHash[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) if ((iTarget = FindTarget(client, sTarget)) <= 0)
return Plugin_Handled; 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; return Plugin_Handled;
}
ShowActivity2(client, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", iTarget); ShowActivity2(client, "\x01\x04[SprayManager] ", "\x01Spray banned \x04%N", iTarget);
LogAction(client, iTarget, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", client, iTarget, g_sSprayHash[iTarget]); LogAction(client, iTarget, "\"%L\" spray banned \"%L\" (Hash: \"%s\")", client, iTarget, g_sSprayHash[iTarget]);
@ -2693,7 +2697,7 @@ 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)) if (!IsValidClient(target))
{ {
@ -2713,7 +2717,7 @@ bool SprayBanClient(int client, int target, int iBanLength, const char[] sReason
return false; return false;
} }
char sQuery[512]; char sQuery[1024];
char sAdminName[64]; char sAdminName[64];
char sTargetName[64]; char sTargetName[64];
char sTargetSteamID[32]; char sTargetSteamID[32];
@ -2736,9 +2740,18 @@ bool SprayBanClient(int client, int target, int iBanLength, const char[] sReason
SQL_EscapeString(g_hDatabase, sTargetName, sSafeTargetName, 2 * strlen(sTargetName) + 1); SQL_EscapeString(g_hDatabase, sTargetName, sSafeTargetName, 2 * strlen(sTargetName) + 1);
SQL_EscapeString(g_hDatabase, sReason, sSafeReason, 2 * strlen(sReason) + 1); SQL_EscapeString(g_hDatabase, sReason, sSafeReason, 2 * strlen(sReason) + 1);
Format(sQuery, sizeof(sQuery), "INSERT INTO `spraymanager` (`steamid`, `name`, `unbantime`, `issuersteamid`, `issuername`, `issuedtime`, `issuedreason`) VALUES ('%s', '%s', '%d', '%s', '%s', '%d', '%s');", int banlength = 0;
sTargetSteamID, sSafeTargetName, iBanLength ? (GetTime() + (iBanLength * 60)) : 0, sAdminSteamID, sSafeAdminName, GetTime(), strlen(sSafeReason) > 1 ? sSafeReason : "none"); 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)");
//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_sBanIssuer[target], sizeof(g_sBanIssuer[]), sAdminName);
@ -2751,7 +2764,6 @@ bool SprayBanClient(int client, int target, int iBanLength, const char[] sReason
g_iAllowSpray = target; g_iAllowSpray = target;
SprayClientDecalToAll(target, 0, ACTUAL_NULL_VECTOR); SprayClientDecalToAll(target, 0, ACTUAL_NULL_VECTOR);
return true; return true;
} }