Raised This Month: $ Target: $400
 0% 

[L4D] Auto-Redirect.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Horex
Member
Join Date: Sep 2009
Old 09-02-2009 , 15:11   [L4D] Auto-Redirect.
Reply With Quote #1

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;
}
Horex is offline
savagekid
Senior Member
Join Date: Apr 2009
Location: Canada
Old 09-02-2009 , 18:19   Re: [L4D] Auto-Redirect.
Reply With Quote #2

This would be nice, it would be like CS/CS:S where you can switch between clan servers with great ease.
__________________

Use Coupon Code "GLOBAL50" To Get 50% Off Every Month.
savagekid is offline
Send a message via MSN to savagekid
Horex
Member
Join Date: Sep 2009
Old 09-03-2009 , 05:07   Re: [L4D] Auto-Redirect.
Reply With Quote #3

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");

Horex is offline
savagekid
Senior Member
Join Date: Apr 2009
Location: Canada
Old 09-04-2009 , 16:46   Re: [L4D] Auto-Redirect.
Reply With Quote #4

You can't, it has to be made into a plugin.
__________________

Use Coupon Code "GLOBAL50" To Get 50% Off Every Month.
savagekid is offline
Send a message via MSN to savagekid
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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