AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [L4D] Auto-Redirect. (https://forums.alliedmods.net/showthread.php?t=102448)

Horex 09-02-2009 15:11

[L4D] Auto-Redirect.
 
Please make for me plugin. It shouldn't be hard for you.

I need to redirect clients to another server directly. Without ask.

Plugin must autoexec client command on player when joins:
"disconnect; password mypassword; connect myserverip"

Here is a source code of plugin.
I was using it this way:
sm_cexec "#all" "disconnect; password mypassword; connect myserverip"
and all players was redirected to another server
Code:

/*
 * ma_cexec equivalent for sourcemod
 *
 * Coded by dubbeh - www.yegods.net
 *
 */

#include <sourcemod>

#pragma semicolon 1
#define PLUGIN_VERSION "1.0.0.3"

public Plugin:myinfo =
{
    name = "Client Execute",
    author = "dubbeh",
    description = "Execute commands on clients for SourceMod",
    version = PLUGIN_VERSION,
    url = "http://www.yegods.net/"
};


public OnPluginStart ()
{
    CreateConVar ("sm_cexec_version", PLUGIN_VERSION, "Client Exec version", FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY);
    /* register the sm_cexec console command */
    RegAdminCmd ("sm_cexec", ClientExec, ADMFLAG_RCON);
}

public Action:ClientExec (client, args)
{
    decl String:szClient[MAX_NAME_LENGTH] = "";
    decl String:szCommand[80] = "";
    static iClient = -1, iMaxClients = 0;

    iMaxClients = GetMaxClients ();

    if (args == 2)
    {
        GetCmdArg (1, szClient, sizeof (szClient));
        GetCmdArg (2, szCommand, sizeof (szCommand));

        if (!strcmp (szClient, "#all", false))
        {
            for (iClient = 1; iClient <= iMaxClients; iClient++)
            {
                if (IsClientConnected (iClient) && IsClientInGame (iClient))
                {
                    if (IsFakeClient (iClient))
                        FakeClientCommand (iClient, szCommand);
                    else
                        ClientCommand (iClient, szCommand);
                }
            }
        }
        else if (!strcmp (szClient, "#bots", false))
        {
            for (iClient = 1; iClient <= iMaxClients; iClient++)
            {
                if (IsClientConnected (iClient) && IsClientInGame (iClient) && IsFakeClient (iClient))
                    FakeClientCommand (iClient, szCommand);
            }
        }
        else if ((iClient = FindTarget (client, szClient, false, true)) != -1)
        {
            if (IsFakeClient (iClient))
                FakeClientCommand (iClient, szCommand);
            else
                ClientCommand (iClient, szCommand);
        }
    }
    else
    {
        ReplyToCommand (client, "sm_cexec invalid format");
        ReplyToCommand (client, "Usage: sm_cexec \"<user>\" \"<command>\"");
    }

    return Plugin_Handled;
}


savagekid 09-02-2009 18:19

Re: [L4D] Auto-Redirect.
 
This would be nice, it would be like CS/CS:S where you can switch between clan servers with great ease.

Horex 09-03-2009 05:07

Re: [L4D] Auto-Redirect.
 
How to execute this?

PHP Code:

public Event_PlayerLeftStartArea(Handle:event, const String:name[], bool:dontBroadcast)
{
    
ServerCommand("sm_exec "#all" "disconnect; password nw; wait 10; connect 83.143.134.224:27025");



savagekid 09-04-2009 16:46

Re: [L4D] Auto-Redirect.
 
You can't, it has to be made into a plugin.


All times are GMT -4. The time now is 04:00.

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