AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie:Reloaded (https://forums.alliedmods.net/forumdisplay.php?f=132)
-   -   Auto-reconnect for particles [ZR] (https://forums.alliedmods.net/showthread.php?t=317554)

Zeddy_god 07-19-2019 08:37

Auto-reconnect for particles [ZR]
 
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

gubka 08-02-2019 21:49

Re: Auto-reconnect for particles [ZR]
 
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

Cruze 08-03-2019 07:43

Re: Auto-reconnect for particles [ZR]
 
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 :)

Agent Wesker 08-04-2019 16:23

Re: Auto-reconnect for particles [ZR]
 
Quote:

Originally Posted by Cruze (Post 2661663)
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 (Post 2661620)
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?

Rugal 01-27-2021 11:17

Re: Auto-reconnect for particles [ZR]
 
Here is the right plugin.

https://forums.alliedmods.net/showthread.php?t=330267

flukeeszy365 02-01-2021 06:28

Re: Auto-reconnect for particles [ZR]
 
Quote:

Originally Posted by Rugal (Post 2734500)

it's working for ZE server right?


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

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