View Single Post
boink
Member
Join Date: May 2021
Location: Australia
Old 07-02-2023 , 18:48   Re: [CSGO] Transfer all players to another server at once
Reply With Quote #4

Using the server_redirect.inc api will allow you to make a separate plugin to manage redirects, here's an example of a command that will send ALL players in the server, but you can extend it by using the ProcessTargetString function to retrieve players by target.

PHP Code:
#include <server_redirect>

char serverIP[] = "xxx.xxx.xxx.x";

public 
void OnPluginStart() {
    
// sm_sendtoserver <port>
    
RegAdminCmd("sm_sendtoserver"Command_ServerChangeADMFLAG_ROOT);
}


public 
Action Command_ServerChange(int clientint args) {
    
char arg[64];
    if(
args 1) {
        return 
Plugin_Handled;
    }

    
GetCmdArg(1arg64);

    
char ip[64];
    
FormatEx(ipsizeof(ip), "%s:%s"serverIParg);

    
int port StringToInt(arg);

    for(
int i 1<= MaxClientsi++) {
        if(
IsClientInGame(i) && IsClientConnected(i)) {
            
RedirectClient(iip);
        }
    }
    return 
Plugin_Handled;

__________________
@.boink. on Discord | DM for Plugin Requests | Tip Jar

Last edited by boink; 07-02-2023 at 18:48.
boink is offline