AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amx_redirected in amxx 0.16 (https://forums.alliedmods.net/showthread.php?t=12209)

Malina 04-08-2005 10:39

amx_redirected in amxx 0.16
 
I use amxx 0.16 but I not find plugin redirected to this AMXX version..
I am from Ukraine, sorry, I have problems with english..

I have amx_redirected.amx by AMX 0.9.9 but in AMXX 0.16 he no compiling? have problems? help me

code:

Code:


/* AMX Mod script.
*
* Server Redirection
*  by Namralkeeg
*
* Support Multiple servers. If more than one server is registred, it randomly picks one
* to redirect. If only 1 is registred it just forwards the person to it.
*
* Usage: amx_redirect "ip:port"
*
*/

#include <amxmod>

#define MAX_SERVERS 4
#define MAX_SERVER_STRING 33

new numServers = 0
new serverList[MAX_SERVERS][MAX_SERVER_STRING]
new serverMax = MAX_SERVERS

public redirect()
{
    if (read_argc() != 2)
    {
        server_print("Usage: amx_redirect <ip:port>")
        return PLUGIN_HANDLED
    }
    else if ((numServers + 1) > serverMax)
    {
        server_print("[AMX] Max Number of Redirect Servers Reached.")
        return PLUGIN_HANDLED
    }
    else
    {
        new currServer[MAX_SERVER_STRING]
        read_argv(1,currServer,MAX_SERVER_STRING)
        /* Check for dups. */
        for(new i = 0; i < numServers; i++)
        {
            if(equal(currServer,serverList[i]))
            {
                server_print("[AMX] Redirect Server %s already exists!",currServer)
                return PLUGIN_HANDLED
            }
        }

        copy(serverList[numServers],MAX_SERVER_STRING,currServer)
        server_print("[AMX] Redirect Server added: %s",serverList[numServers])
        numServers++
        return PLUGIN_HANDLED
    }

    return PLUGIN_HANDLED
}

public redirect_reload()
{
    numServers = 0
    server_print("[AMX] Reloading Server Redirect List")
    server_cmd("exec addons/amx/redirect.cfg")
 
    return PLUGIN_HANDLED
}

redirect_client(id,randomServer)
{
  client_cmd(id,"echo ^"Server is currently full^"")
        client_cmd(id,"echo ^"Redirecting to %s^";wait;wait;connect %s",serverList[randomServer],serverList[randomServer])
}

public client_connect(id)
{
    new maxplayers
    new reserved
    new slotsfree
    new reserveType

    if(numServers > 0)
    {
        new randomServer
        if(numServers > 1)
            randomServer = random_num(0,numServers-1)
        else
            randomServer = 0

        if(cvar_exists("amx_reserved_slots"))
            reserved = get_cvar_num("amx_reserved_slots")
        else
            reserved = 0
         
        if(cvar_exists("amx_reservation"))
            reserveType = get_cvar_num("amx_reservation")
        else
            reserveType = 0
                 
        maxplayers = get_maxplayers()

        new players = get_playersnum() + 1 /* on connection we must add you */
        slotsfree = maxplayers - players
        //if ( ((slotsfree <= 0) || (slotsfree <= reserved)) && ((reserveType == 0) || (reserveType == 3)) )
        if ( (reserveType == 0) || (reserveType == 3) )
        {
                if(slotsfree <= 0)
                  redirect_client(id,randomServer)
                else if((slotsfree <= reserved) && (!(get_user_flags(id) & ADMIN_RESERVATION)))
                {
                  redirect_client(id,randomServer)
                  return PLUGIN_HANDLED
                }
        }
        else if( ((reserveType == 1) || (reserveType == 2)) )
        {
          if( !(get_user_flags(id) & ADMIN_RESERVATION) )
          {
              if( slotsfree <= 0 )
              {
                redirect_client(id,randomServer)
                return PLUGIN_HANDLED
              }
          }
        }
    }

    return PLUGIN_CONTINUE
}

public plugin_init()
{
    register_cvar("KEEG_Redirect", "0.3.2",FCVAR_SERVER)
    register_plugin("AMX Redirect","0.3.2","Namralkeeg")
    register_srvcmd("amx_redirect", "redirect")
    register_srvcmd("amx_redirect_reload","redirect_reload")
    server_cmd("exec addons/amx/redirect.cfg")

    return PLUGIN_CONTINUE
}


nightscreem 04-08-2005 10:59

upgrade to 1.01 why 0.16

XxKpAznGuyxX 04-08-2005 13:40

1 Attachment(s)
Quote:

Originally Posted by nightscreem
upgrade to 1.01 why 0.16

WHO CARES WHAT VERSION HE USES!


Any ways here

Malina 04-10-2005 02:19

I have problems :(

When I compile in Linux, I see


Code:

Small compiler 2.1.0    Copyright (c) 1997-2002

redirect.sma(0) : fatal error 101: cannot write to file: "compiled/redirect.sma"

Compilation aborted
1 error.

:((
CHMOD 777
I dont know, why trouble? :(


I lost compilation instrument for WIN32 :((( who can me give this compilation instrument AMX 0.16

Malina 04-10-2005 02:24

I need only v. AMXX 0.16 plz help me :(

1st server full, 2nd 0/32 :((((

v3x 04-10-2005 03:49

Use the web-compiler.. http://amxmodx.org/compiler.php?go=sc

You'll get 2 loose-indentation warnings, ignore them.

Malina 04-10-2005 14:11

Quote:

Originally Posted by v3x
Use the web-compiler.. http://amxmodx.org/compiler.php?go=sc

You'll get 2 loose-indentation warnings, ignore them.

:cry: :cry: :cry: :cry: :cry:

You don't undersand me :(( me need only v 0.16

this compiler use 1.01 version, and finish file name *.amxx

Why I have warnings? :(

Malina 04-10-2005 14:13

I compile and have problems :(


Code:

/home/groups/amxmodx/tmp/php49Eefh.sma(57) : warning 217: loose indentation
/home/groups/amxmodx/tmp/php49Eefh.sma(107) : warning 217: loose indentation

2 Warnings.
Done.

Who can me help? :cry:

PM 04-10-2005 15:26

Quote:

Originally Posted by Malina
I compile and have problems :(


Code:

/home/groups/amxmodx/tmp/php49Eefh.sma(57) : warning 217: loose indentation
/home/groups/amxmodx/tmp/php49Eefh.sma(107) : warning 217: loose indentation

2 Warnings.
Done.

Who can me help? :cry:

You can ignore these warnings. The compiler should have produced a .amx file anyway.

Malina 04-11-2005 06:31

use AMXX 0.16
[ 33] unknown unknown unknown redirect.amx bad load

use AMXX 1.01
[ 24] AMX Redirect 0.3.2 Namralkeeg redirect.amxx running

but he dont redirecting me... :(( don't work :(((


I need only AMXX 0.16 my systems have lags when use AMXX 1.01 :(((


All times are GMT -4. The time now is 09:49.

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