added warning message for players before making them retry

This commit is contained in:
jenz 2023-04-16 13:45:37 +02:00
parent 6244beff71
commit 0dfc0c62e7

View File

@ -337,14 +337,54 @@ public Action CheckAuth(Handle timer, int data)
{
LogMessage("%L could not be assigned to a SteamID, kicking client.", client);
//KickClient(client, "Invalid STEAMID");
if (IsClientConnected(client) && !IsFakeClient(client) && !IsClientSourceTV(client))
if (IsValidClient(client))
{
ClientCommand(client, "retry");
Panel hNotifyPanel = new Panel(GetMenuStyleHandle(MenuStyle_Radio));
hNotifyPanel.DrawItem("WARNING: Your SteamID is Invalid: Reconnecting you to the server in 8 Seconds.", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
hNotifyPanel.DrawItem("IMPORTANT: You may disconnect, reconnect if necessary!", ITEMDRAW_RAWLINE);
hNotifyPanel.Send(client, MenuHandler_NotifyPanel, 8);
delete hNotifyPanel;
for (int i = 0; i < 8; i++)
{
PrintToChat(client, "WARNING: Your SteamID is Invalid: Reconnecting you to the server in 8 Seconds.");
}
CreateTimer(8.0, forceClientRetry, GetClientSerial(client));
}
}
return Plugin_Stop;
}
public Action forceClientRetry(Handle timer, int data)
{
int client;
if ((client = GetClientFromSerial(data)) == 0)
return Plugin_Stop;
if (IsValidClient(client))
{
ClientCommand(client, "retry");
}
return Plugin_Handled;
}
stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client) && !IsFakeClient(client))
return true;
return false;
}
int MenuHandler_NotifyPanel(Menu hMenu, MenuAction iAction, int iParam1, int iParam2)
{
switch (iAction)
{
case MenuAction_Select, MenuAction_Cancel:
delete hMenu;
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------