PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#pragma tabsize 0
#pragma newdecls required
public Plugin myinfo =
{
name = "Map Crash Fix",
author = "Kashinoda",
description = "Prevent client crashes on map change",
version = "1.0.0",
url = "http://alliedmods.net/"
};
public void OnPluginStart()
{
HookEvent("server_spawn", EventNewMap);
}
public void EventNewMap(Event event, const char[] name, bool dontBroadcast)
{
CreateTimer(2.0, RetryPlayers);
LogMessage("Map change, reconnecting players in 2 seconds...");
}
public Action RetryPlayers(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientConnected(i))
{
ClientCommand(i, "retry");
LogMessage("Sending retry to %N", i);
}
}
}
Hey, the URL wasn't quite right. May as well also set the version to 1.0.0 so that people know the first major version.
https://semver.org/
Edit:
I guess if you wanna be super tedious you could only hook the event for CS:GO.
PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#pragma tabsize 0
#pragma newdecls required
public Plugin myinfo =
{
name = "[CSGO] Panorama Map Crash Fix",
author = "Kashinoda",
description = "Prevent client crashes on map change",
version = "1.1.0",
url = "http://alliedmods.net/"
};
public void OnPluginStart()
{
if (GetEngineVersion() == Engine_CSGO)
{
HookEvent("server_spawn", EventNewMap);
}
else
{
LogError("This plugin is degisned to fix a bug for CS:GO");
}
}
public void EventNewMap(Event event, const char[] name, bool dontBroadcast)
{
CreateTimer(2.0, RetryPlayers);
LogMessage("Map change, reconnecting players in 2 seconds...");
}
public Action RetryPlayers(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientConnected(i))
{
ClientCommand(i, "retry");
LogMessage("Sending retry to %N", i);
}
}
}
__________________