This repository has been archived by the owner on Aug 15, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 305
Ban Client Code
Daniel McGuinness edited this page Sep 30, 2018
·
1 revision
Sometimes clients are just annoying and you want your hosts to be able to ban players from joining the server for a given amount of time (or what could be forever). To do this you need to use the reference to your server's NetWorker
.
// The amount of time in minutes that we want to ban the player
int minutesToBan = 60; // 1 hour
// Consider the player you want to disconnect is the targetPlayer object
// We will want to get the players network id as we are going to do a generic ban
// Note: If you have the network id from the RPC or any other messaging you can ban from there
ulong playerId = targetPlayer.NetworkId;
// Consider that serverNetworker is the server's networker (this can be NetworkManager.Instance.Networker)
((IServer)serverNetworker).BanPlayer(playerId, minutesToBan)
Getting Started
Network Contract Wizard (NCW)
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
Master Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
-
Connection Cycle Events
-
Rewinding
-
Network Logging
-
Working with Multiple Sockets
-
Modify Master and Standalone servers
-
NAT Hole Punching
-
UDP LAN Discovery
-
Offline Mode
-
Ping Pong
-
Lobby System
-
Upgrading Forge Remastered to Develop branch or different version
-
Forge Networking Classic to Remastered Migration Guide
-
Script to easily use Forge Networking from sources
-
Run Two Unity Instances with Shared Assets for Easiest Dedicated Client Workflow