01-29-2012, 20:04
I was playing some Infected game mode and was annoyed about the noobs rejoining when they got infected. So I made this little plugin.
If someone tries to reconnect, he won't be able to but this message will appear:
When map changes, everyone will be able to join again.
sv_config.ini entries:
Thanks zxz... and @kraze1994 for testing
If someone tries to reconnect, he won't be able to but this message will appear:
When map changes, everyone will be able to join again.
sv_config.ini entries:
Code:
[NoReconnect]
DenyReconnect=1
//Player is not allowed to reconnect, change to 0 to disable
ImmunePlayers=xuid1,xuid2,xuid3
//Players allowed to reconnect, add xuids seperated by a ,
NotifyReconnect=0
//If DenyReconnect is 0 and this 1, server will notify when a player is reconnecting
Source code (Click to View)
CSHARP Code
- using System;
- using System.Collections;
- using Addon;
-
- namespace Infection_NoReconnect
- {
- public class Class1 : CPlugin
- {
- string ReconDeny;
- string ReconNotify;
- string[] ImmunePlayers;
- public override void OnPlayerConnect(ServerClient Client)
- {
- if (!players.Contains(Client.XUID))
- players.Add(Client.XUID);
- else
- ServerSay("^1"+ Client.Name + " reconnected", false);
- //ServerCommand("kickClient " + Client.ClientNum + " \"You must wait for the game to end\"");
- }
-
- public override void OnMapChange()
- {
- //Clear players and let everyone rejoin
- players.Clear();
- }
-
- public override void OnServerLoad()
- {
- ServerPrint("\n NoReconnect Plugin 1.1 loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz, Pozzuh and Surtek\n");
- ServerPrint(" <a href="http://www.youtube.com/zxz0O0" target="_blank" rel="noopener" class="mycode_url">www.youtube.com/zxz0O0</a> \n <a href="http://www.itsmods.com" target="_blank" rel="noopener" class="mycode_url">www.itsmods.com</a>\n");
- ReconDeny = GetServerCFG("NoReconnect", "DenyReconnect", "1");
- ReconNotify = GetServerCFG("NoReconnect", "NotifyReconnect", "0");
- ImmunePlayers = GetServerCFG("NoReconnect", "ImmunePlayers", string.Empty).Split(',');
- }
- public override string OnCheckBan(string xuid)
- {
- //When reconnecting..
- if (ReconDeny == "1")
- {
- if (players.Contains(xuid))
- {
- //If immune player
- foreach (string XUID in ImmunePlayers)
- {
- if (xuid == XUID)
- return null;
- }
- //if not immune
- return "Reconnect denied! Wait until the round is finished.";
- }
- }
- //else
- return null;
- }
- }
- }