[CSGO] Panorama Map Crash

Post Reply
User avatar
Andreeas
Hero Member
Hero Member
Posts: 601
Joined: Wed Jan 22, 2020 8:17 pm
Jucator SA:MP ?: Nu
Nick:: Andreeas
Jucator CS ?: Nu

[CSGO] Panorama Map Crash

Post by Andreeas »

Description
This tries to fix client crashes that have been happening since Valve introduced Panorama. This is achieved by forcing clients to reconnect on map change.

This does not look for hooks in Sourcemod plugins, it uses AddCommandListener to detect a map change then instantly sends 'retry' to all connected clients.

I believe any map change sends the 'changelevel' command to the server so this should work with any plugin, tested with sm_map without issues.

Why does this happen?
Maps are rendered in either HDR, LDR or both, when clients switch from one to the other CSGO crashes.
https://github.com/ValveSoftware/csg...ux/issues/1965

Installation
Place smx file in csgo/addons/sourcemod/plugins/

Changelog
1.4.0 - Simpler code using AddCommandListenier. Previous versions hooked onto the server_spawn event and had to use a timer as clients were not shown as connected, the retry command is now sent as early as possible and no timer is required.
1.3.0 - Do not send 'retry' to Bots
1.2.0 - Do not send 'retry' if client joins empty server
1.1.0 - Game type check and versioning by b3none
1.0.0 - Initial release

Code: Select all

#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.4.0",
    url = "http://alliedmods.net/" 
};

public void OnPluginStart() 
{ 
   AddCommandListener(MapChange, "changelevel");
   AddCommandListener(MapChange, "map");
       
} 

public Action MapChange (int client, const char[] cmd, int argc)
{
    LogMessage("Map changing, sending 'retry' to clients"); 

      for (int i = 1; i <= MaxClients; i++) 
        {
          if (IsClientConnected(i) && !IsFakeClient(i))
              {                 
                 ClientCommand(i, "retry"); 
                 LogMessage("Sending retry to %N", i); 
              } 
        }     
}
Console Output

Code: Select all

map aim_office
L 03/30/2019 - 14:39:05: [test.smx] Map changing, sending 'retry' to clients
L 03/30/2019 - 14:39:05: [test.smx] Sending retry to Kashinoda
L 03/30/2019 - 14:39:05: "Kashinoda<63><STEAM_1:0:xxxxxx><TERRORIST>" disconnected (reason "Disconnect")
L 03/30/2019 - 14:39:05: "Kashinoda<63><STEAM_1:0:xxxxxx><TERRORIST>" [256 704 544] committed suicide with "world"
L 03/30/2019 - 14:39:05: "Kashinoda<63><STEAM_1:0:xxxxxx>" switched from team <TERRORIST> to <Unassigned>
Dropped Kashinoda from server: Disconnect
L 03/30/2019 - 14:39:05: [META] Loaded 0 plugins (1 already loaded)
---- Host_Changelevel ----
L 03/30/2019 - 14:39:05: [META] Loaded 0 plugins (1 already loaded)
*** Map Load: workshop/260679898/aim_office: Map Group funL 03/30/2019 - 14:39:05: Log file closed
Server logging data to file logs/L164_132_203_029_27015_201903301439_000.log
L 03/30/2019 - 14:39:05: Log file started (file "logs/L164_132_203_029_27015_201903301439_000.log") (game "/home/csgosv/serverfiles/csgo") (version "7436")
L 03/30/2019 - 14:39:05: Loading map "workshop/260679898/aim_office"
L 03/30/2019 - 14:39:05: server cvars start

Download
Source
Post Reply

Return to “General Purpose”