View Single Post
Author Message
Kashinoda
Member
Join Date: Dec 2017
Old 03-28-2019 , 09:25   [CSGO] Panorama Map Crash Fix (v1.4.0 30/03/2019)
Reply With Quote #1

This is an alternative version of BOT Benson's plugin which was later modified by Agent Wesker.

I made this for my clan server (5-10 players max), I haven't had any client crashes using RCON or CS:GO Map Voting. If you are using RTV, SM Map Voting, Extended Mapchooser etc. you may be better off with BOT Benson's plugin.


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
Quote:
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

PHP Code:
#include <sourcemod> 

#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[] cmdint argc)
{
    
LogMessage("Map changing, sending 'retry' to clients"); 

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

Console Output
Code:
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
Attached Files
File Type: sp Get Plugin or Get Source (PanoramaMapCrashFix-v1.4.0.sp - 2782 views - 870 Bytes)
__________________

Last edited by Kashinoda; 04-11-2019 at 14:21.
Kashinoda is offline