surfhope
02-17-2012, 08:22
Good afternoon,
I hope that I'm here in the right section for my matter of concern.
In fact I'm speaking about a script that I wrote yesterday, I was able to get rid of most errors/warnings. But there are still two warnings left and and would like the get rid of them too.
bans.sp(51) : warning 217: loose indentation
bans.sp(79) : warning 217: loose indentation
#include sourcemod
public OnPluginStart()
{
PrintToChatAll("The ban plugin has been enabled!");
CreateConVar("sm_sban_enable", "1", "Var for activation");
}
public OnPluginEnd()
{
PrintToChatAll("The ban plugin has been disabled!");
}
public OnClientAuthorized(client, const String:auth[])
{
decl String:ip[17];
GetClientIP( client, ip, sizeof(ip));
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
{
PrintToServer("Could not connect: %s", error)
} else {
new String:query1[100];
Format(query1, sizeof(query1), "SELECT * FROM bans WHERE steamid = '%s' OR ip = '%s'", auth, ip);
new Handle:rowin;
if ((rowin = SQL_Query(db, query1)) != INVALID_HANDLE)
{
if (SQL_GetRowCount(rowin) != 0)
{
new String:query2[100];
Format(query2, sizeof(query2), "SELECT time FROM bans WHERE steamid = '%s' OR ip = '%s'", auth, ip);
new Handle:rowin1;
new bantime;
new String:buffer[100];
CloseHandle(rowin);
if ((rowin1 = SQL_Query(db, query2)) != INVALID_HANDLE)
{
if(SQL_FetchRow(rowin1))
{
bantime = SQL_FetchString(rowin1, 0, buffer, sizeof(buffer));
}
CloseHandle(rowin1);
new String:query3[100];
Format(query3, sizeof(query3), "SELECT reason FROM bans WHERE steamid = '%s' OR ip = '%s'", auth, ip);
new banreason;
new Handle:rowin2;
if ((rowin2 = SQL_Query(db, query3)) != INVALID_HANDLE)
{
if(SQL_FetchRow(rowin2))
{
banreason = SQL_FetchString(rowin2, 0, buffer, sizeof(buffer));
}
CloseHandle(rowin2);
if (bantime == 0) KickClient(client, "You're banned from this server!\nReason: %s\nTime: Endless", banreason);
else KickClient(client, "You're banned from this server!\nReason: %s\nTime: %s", banreason, bantime);
}
}
}
}
}
CloseHandle(db);
}Thanks in advance
Hope
I hope that I'm here in the right section for my matter of concern.
In fact I'm speaking about a script that I wrote yesterday, I was able to get rid of most errors/warnings. But there are still two warnings left and and would like the get rid of them too.
bans.sp(51) : warning 217: loose indentation
bans.sp(79) : warning 217: loose indentation
#include sourcemod
public OnPluginStart()
{
PrintToChatAll("The ban plugin has been enabled!");
CreateConVar("sm_sban_enable", "1", "Var for activation");
}
public OnPluginEnd()
{
PrintToChatAll("The ban plugin has been disabled!");
}
public OnClientAuthorized(client, const String:auth[])
{
decl String:ip[17];
GetClientIP( client, ip, sizeof(ip));
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
{
PrintToServer("Could not connect: %s", error)
} else {
new String:query1[100];
Format(query1, sizeof(query1), "SELECT * FROM bans WHERE steamid = '%s' OR ip = '%s'", auth, ip);
new Handle:rowin;
if ((rowin = SQL_Query(db, query1)) != INVALID_HANDLE)
{
if (SQL_GetRowCount(rowin) != 0)
{
new String:query2[100];
Format(query2, sizeof(query2), "SELECT time FROM bans WHERE steamid = '%s' OR ip = '%s'", auth, ip);
new Handle:rowin1;
new bantime;
new String:buffer[100];
CloseHandle(rowin);
if ((rowin1 = SQL_Query(db, query2)) != INVALID_HANDLE)
{
if(SQL_FetchRow(rowin1))
{
bantime = SQL_FetchString(rowin1, 0, buffer, sizeof(buffer));
}
CloseHandle(rowin1);
new String:query3[100];
Format(query3, sizeof(query3), "SELECT reason FROM bans WHERE steamid = '%s' OR ip = '%s'", auth, ip);
new banreason;
new Handle:rowin2;
if ((rowin2 = SQL_Query(db, query3)) != INVALID_HANDLE)
{
if(SQL_FetchRow(rowin2))
{
banreason = SQL_FetchString(rowin2, 0, buffer, sizeof(buffer));
}
CloseHandle(rowin2);
if (bantime == 0) KickClient(client, "You're banned from this server!\nReason: %s\nTime: Endless", banreason);
else KickClient(client, "You're banned from this server!\nReason: %s\nTime: %s", banreason, bantime);
}
}
}
}
}
CloseHandle(db);
}Thanks in advance
Hope