I'm trying to write a plugin that displays a list of players from the database in the menu command !week
PHP Code:
#include <sourcemod>
public Plugin:myinfo =
{
name = "Wins Stat",
author = "User",
description = "",
version = "1" ,
url = ""
};
new Handle:g_SQL = INVALID_HANDLE, bool:MYSQL;
public OnPluginStart()
{
RegConsoleCmd("week", week);
if (!SQL_CheckConfig("wins_stats"))
{
SetFailState("section \"wins_stats\" not found databases.cfg");
return;
}
decl String:error[256];
g_SQL = SQL_Connect("wins_stats", true, error, 256);
if (g_SQL == INVALID_HANDLE)
{
LogError(error);
SetFailState("no connect DB");
return;
}
new String:driver[15]; SQL_ReadDriver(g_SQL, driver, 15);
MYSQL = StrEqual(driver, "mysql", false);
LogMessage("set %s connection", MYSQL ? "MYSQL" : "SQLite");
if (!MYSQL)
{
SQL_TQuery(g_SQL, SQL_DefCallback, "SELECT id, week, name, steam_id, place, week_wins FROM wins");
}
}
public SQL_DefCallback(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE) LogError(error);
}
public Action:week(client, args)
{
if (client > 0 && args < 1) ShowMyPanel(client);
return Plugin_Handled;
}
ShowMyPanel(client)
{
new Handle:panel = CreatePanel();
SetPanelTitle(panel, "TOP 10:\n \n");
DrawPanelItem(panel, "Exit");
SendPanelToClient(panel, client, Select_Panel, 0);
CloseHandle(panel);
ClientCommand(client, "playgamesound items/nvg_off.wav");
}
public Select_Panel(Handle:panel, MenuAction:action, client, option)
{
if (action == MenuAction_Select)
{
if (option < 11) ShowMyPanel(client);
}
}
Tell me how it can be concluded that 10 players in the menu