Raised This Month: $89 Target: $400
 22% 

Auto-reconnect for particles [ZR]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zeddy_god
Senior Member
Join Date: May 2015
Location: Mumbai, India
Old 07-19-2019 , 08:37   Auto-reconnect for particles [ZR]
Reply With Quote #1

Hey, as you guys may know, if a player downloads map for first time, you can't see particles till you rejoin the server

I've seen servers like PSE have auto-rejoin, where a player joins server and auto-rejoins the first time you reach the server.

Does such a plugin exist in public or can someone code it? Seems fairly simple
__________________
Zeddy_god is offline
gubka
Veteran Member
Join Date: Jan 2012
Location: Dublin
Old 08-02-2019 , 21:49   Re: Auto-reconnect for particles [ZR]
Reply With Quote #2

The best solution is to use ExtraParticleFilesTable which can force the client to load all custom particles on the first time download, but I couldn't make it work for two or more players at the same time, maybe you will figure out. Good luck
__________________
gubka is offline
Send a message via ICQ to gubka Send a message via Skype™ to gubka
Cruze
Senior Member
Join Date: May 2017
Old 08-03-2019 , 07:43   Re: Auto-reconnect for particles [ZR]
Reply With Quote #3

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <clientprefs>

#pragma semicolon 1
#pragma newdecls required

#define DEBUG 1

Handle g_hPreviouslyConnected;

public 
Plugin myinfo =
{
    
name "Force Reconnect New Map Players",
    
author "Cruze",
    
description "Force new map player to reconnect to make sure they see particles.",
    
version "1.0",
    
url "http://steamcommunity.com/profiles/76561198132924835"
};

public 
void OnPluginStart()
{
    
g_hPreviouslyConnected RegClientCookie("Force Reconnect New Map Players""FRNMP Settings"CookieAccess_Private);
    for(
int i 1<= MaxClientsi++)
    {
        if (!
AreClientCookiesCached(i))
        {
            continue;
        }
        
OnClientCookiesCached(i);
    }
}

public 
void OnClientCookiesCached(int client
{
    
CreateTimer(3.0CheckSettingsclientTIMER_FLAG_NO_MAPCHANGE);
}

public 
Action CheckSettings(Handle timerany client)
{
    
char sValue[PLATFORM_MAX_PATH], map[32];
    
GetCurrentMap(mapsizeof(map));
    
GetClientCookie(clientg_hPreviouslyConnectedsValuesizeof(sValue));
    
#if defined DEBUG
    
PrintToServer("FRNP: %s"map);
    
PrintToServer("FRNP: client cookie value %s"sValue);
    
#endif 
    
if(StrContains(sValuemapfalse) == -1)
    {
        
Format(sValuesizeof(sValue), "%s %s"sValuemap);
        
#if defined DEBUG
        
PrintToServer("FRNP: %s"sValue);
        
#endif 
        
SetClientCookie(clientg_hPreviouslyConnectedsValue);
        if(
IsValidClient(client))
        {
            
PrintToChat(client"[SM] You will be reconnected to server as it's your first connect in this map.");
            
#if defined DEBUG
            
PrintToServer("FRNP: %N's first connect in this map."client);
            
#endif 
            
CreateTimer(3.0Reconnectclient);
        }
    }
    else
    {
        
#if defined DEBUG
        
PrintToServer("FRNP: Not first connect of %N"client);
        
#endif 
    
}
}

public 
void OnClientPostAdminCheck(int client)
{
    
OnClientCookiesCached(client);
}

public 
Action Reconnect(Handle timerany client)
{
    if(
IsValidClient(client))
    {
        
ClientCommand(client"retry");
    }
}

stock bool IsValidClient(int client)
{
    if(
client <= ) return false;
    if(
client MaxClients) return false;
    if(!
IsClientConnected(client)) return false;
    if(
IsClientReplay(client)) return false;
    if(
IsClientSourceTV(client)) return false;
    return 
IsClientInGame(client);

I tried but I think SetClientCookie is not working properly. Correct the code if you can please
__________________
Taking paid private requests! Add me on steam!

Discord: Cruze#4947 | AlliedModders Releases | Github | Steam | PayPal
Cruze is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 08-04-2019 , 16:23   Re: Auto-reconnect for particles [ZR]
Reply With Quote #4

Quote:
Originally Posted by Cruze View Post
I tried but I think SetClientCookie is not working properly. Correct the code if you can please
I imagine this is a very slow an unoptimized way of checking each client.

Also with enough maps added into a single cookie it would probably hit max length and stop working?

Quote:
Originally Posted by gubka View Post
The best solution is to use ExtraParticleFilesTable which can force the client to load all custom particles on the first time download, but I couldn't make it work for two or more players at the same time, maybe you will figure out. Good luck
Could you post the code for this?

Last edited by Agent Wesker; 08-04-2019 at 16:24.
Agent Wesker is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:29.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode