AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CSGO] Panorama Map Crash Fix (v1.4.0 30/03/2019) (https://forums.alliedmods.net/showthread.php?t=315212)

Kashinoda 03-28-2019 09:25

[CSGO] Panorama Map Crash Fix (v1.4.0 30/03/2019)
 
1 Attachment(s)
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


B3none 03-28-2019 10:47

Re: [CSGO] Map Crash Fix All (v1 28/03/2019)
 
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[] namebool dontBroadcast)
{
    
CreateTimer(2.0RetryPlayers);    
    
LogMessage("Map change, reconnecting players in 2 seconds...");
}

public 
Action RetryPlayers(Handle timer)
{
    for (
int i 1<= MaxClientsi++)
    {
        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[] namebool dontBroadcast)
{
    
CreateTimer(2.0RetryPlayers);    
    
LogMessage("Map change, reconnecting players in 2 seconds...");
}

public 
Action RetryPlayers(Handle timer)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientConnected(i))
        {
            
ClientCommand(i"retry");
            
LogMessage("Sending retry to %N"i);
        }
    }



TheBOSS 03-28-2019 11:07

Re: [CSGO] Panorama Map Crash Fix (v1.0.1 28/03/2019)
 
error 017: undefined symbol "RetryPlayers"
SM 1.9

Kashinoda 03-28-2019 11:15

Re: [CSGO] Panorama Map Crash Fix (v1.0.1 28/03/2019)
 
Quote:

Originally Posted by TheBOSS (Post 2645198)
error 017: undefined symbol "RetryPlayers"
SM 1.9

Try the new smx I've attached. It's working for me on SM 1.9.0.6275 and 1.9.0.6269, I don't have any older servers to test on.

Quote:

Originally Posted by b3none (Post 2645194)
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.

I enjoy being tedious, thanks for the tips. Updated.

B3none 03-28-2019 11:25

Re: [CSGO] Panorama Map Crash Fix (v1.0.0 28/03/2019)
 
Doh! Forgot to edit the event callback name:
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"OnServerSpawn);
    }
    else
    {
        
LogError("This plugin is degisned to fix a bug for CS:GO");
    }
}
 
public 
void OnServerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
CreateTimer(2.0RetryPlayers);    
    
LogMessage("Map change, reconnecting players in 2 seconds...");
}

public 
Action RetryPlayers(Handle timer)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientConnected(i))
        {
            
ClientCommand(i"retry");
            
LogMessage("Sending retry to %N"i);
        }
    }



Gerticek 03-28-2019 12:28

Re: [CSGO] Panorama Map Crash Fix (v1.1.0 28/03/2019)
 
Works thank you very much.

NanoC 03-28-2019 12:46

Re: [CSGO] Panorama Map Crash Fix (v1.1.0 28/03/2019)
 
Should we delete the BOT Benson's plugin before install this one?

Kashinoda 03-28-2019 12:50

Re: [CSGO] Panorama Map Crash Fix (v1.1.0 28/03/2019)
 
Quote:

Originally Posted by NanoC (Post 2645222)
Should we delete the BOT Benson's plugin before install this one?

They may conflict, I'd advise running just one.

Cruze 03-28-2019 14:46

Re: [CSGO] Panorama Map Crash Fix (v1.1.0 28/03/2019)
 
Can confirm no crashes since 5-7 map changes in bhop server using mapchooser extended! Thanks for sharing this dude!! :bacon!:

sneaK 03-28-2019 23:33

Re: [CSGO] Panorama Map Crash Fix (v1.1.0 28/03/2019)
 
Odd, when testing by myself, the server looped retrys and I could never get in-game. Seems as though server_spawn is being fired every time the first client joins. Windows server, hibernation disabled. I'll try messing with configurations and report back if I get it solved. Great solution, much more proper than the existing one!


All times are GMT -4. The time now is 09:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.