PlaytimeStats: some last improvements

This commit is contained in:
Dogan 2019-10-03 23:48:45 +02:00
parent 75bd84defe
commit 00c4b27444

View File

@ -58,10 +58,10 @@ public void OnClientDisconnect(int client)
int iPlayTime = GetTime() - g_iConnectionTime[client];
int iAuthID = GetSteamAccountID(client);
if(iAuthID == 0)
return;
char sName[MAX_NAME_LENGTH];
GetClientName(client, sName, sizeof(sName));
char sSafeName[(2*MAX_NAME_LENGTH)+1];
@ -153,6 +153,10 @@ public void SQL_OnQueryCompletedTopTime(Database db, DBResultSet results, const
int iTime[12];
char sBuffer[12][128];
Panel mSayPanel = new Panel(GetMenuStyleHandle(MenuStyle_Radio));
mSayPanel.SetTitle("[UNLOZE Time] Record Holders:");
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
for(int i = 1; i <= 12; i++)
{
int iFieldNum;
@ -167,41 +171,24 @@ public void SQL_OnQueryCompletedTopTime(Database db, DBResultSet results, const
iTime[i - 1] = (iTime[i - 1] / 60) % 60;
Format(sBuffer[i - 1], 128, "%d. %s - %d Minutes", i, sName[i - 1], iTime[i - 1]);
mSayPanel.DrawText(sBuffer[i - 1]);
}
SendMsay(iSerial, sBuffer);
}
public void SendMsay(int iSerial, char[][] message)
{
int client = GetClientFromSerial(iSerial);
Panel mSayPanel = new Panel();
mSayPanel.SetTitle("[UNLOZE Time] Record Holders:");
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
mSayPanel.DrawText(message[0]);
mSayPanel.DrawText(message[1]);
mSayPanel.DrawText(message[2]);
mSayPanel.DrawText(message[3]);
mSayPanel.DrawText(message[4]);
mSayPanel.DrawText(message[5]);
mSayPanel.DrawText(message[6]);
mSayPanel.DrawText(message[7]);
mSayPanel.DrawText(message[8]);
mSayPanel.DrawText(message[9]);
mSayPanel.DrawText(message[10]);
mSayPanel.DrawText(message[11]);
mSayPanel.DrawText(message[12]);
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
mSayPanel.DrawItem("Exit", ITEMDRAW_CONTROL);
mSayPanel.DrawItem("1. Got it!", ITEMDRAW_RAWLINE);
mSayPanel.Send(client, Handler_DoNothing, 10);
mSayPanel.SetKeys(1023);
mSayPanel.Send(client, Handler_Menu, 0);
delete mSayPanel;
}
public int Handler_DoNothing(Menu menu, MenuAction action, int param1, int param2)
public int Handler_Menu(Menu menu, MenuAction action, int param1, int param2)
{
/* Do nothing */
switch(action)
{
case MenuAction_Select, MenuAction_Cancel:
delete menu;
}
}
stock bool IsValidClient(int client)