|
AlliedModders Donor
|
01-16-2022
, 06:35
Re: [CSGO] Panorama Map Crash Fix (v1.4.0 30/03/2019)
|
#56
|
Quote:
Originally Posted by pokemonmaster
Wouldn't something like this be sufficient and better than timers? player_disconnect is only called once a player fully disconnects and is not called on map changes.
Only issue I can think of so far is that clients connecting from the same IP might face some issues, but that is (probably) easy to get around.
PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
public Plugin myinfo =
{
name = "Panorama Map crash fix test",
author = "pokemonmaster",
description = "",
version = "1.0",
url = "http://alliedmods.net/"
};
StringMap g_Trie_ReconnectingClients;
public void OnPluginStart()
{
g_Trie_ReconnectingClients = new StringMap();
HookEvent("player_disconnect", Event_PlayerDisconnect);
}
public void OnClientAuthorized(int client, const char[] szAuth)
{
PrintToServer("-- Client Authorized %N (%d)", client, client);
char szIP[30];
GetClientIP(client, szIP, sizeof szIP, false);
SetTrieValue(g_Trie_ReconnectingClients, szIP, true);
}
public void OnClientConnected(int client)
{
char szIP[30], iValue;
GetClientIP(client, szIP, sizeof szIP, false);
if(GetTrieValue(g_Trie_ReconnectingClients, szIP, iValue))
{
PrintToServer("-- Reconnecting client %N (%d) connected!", client, client);
ClientCommand(client, "retry");
return;
}
PrintToServer("-- Client %N (%d) connected!", client, client);
}
public void Event_PlayerDisconnect(Event hEvent, char[] szEventName, bool bDontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(!client)
{
return;
}
char szIP[30];
GetClientIP(client, szIP, sizeof szIP, false);
PrintToServer("-- Client Disconnect ---- Event - %N (%d)", client, client);
RemoveFromTrie(g_Trie_ReconnectingClients, szIP);
}
|
Have you done any testing with this? Does it work?
|
|
|
|