AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   RCON, Orpheu and HLDS 2013 offsets (https://forums.alliedmods.net/showthread.php?t=237547)

nonserviam 03-26-2014 00:29

RCON, Orpheu and HLDS 2013 offsets
 
Hello,

I problem code with HLDS 2013 offsets.

6XXX HLDS 2013 engine not operating follow third party plugin. Does not report any error. Can you suggest a fix for OrpheuRegisterHook? or other way?

Thank you.

Code:

#include <amxmodx>
#include <amxmisc>
#include <orpheu>
#include <orpheu_advanced>

#define PLUGIN "Rcon ip ban"
#define VERSION "0.3"
#define AUTHOR "kanagava"
//thq to DJ_West

new Trie:a_ip
new rcon[64]
new ip[16]
new rcon_bantime
new max_falied_rcon

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Pre", OrpheuHookPre)
    OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon"), "On_Rcon", OrpheuHookPre)
    register_cvar("max_falied_rcon","3")
    register_cvar("rcon_bantime","800.0")
    a_ip = TrieCreate()
}

public plugin_cfg()
{
    get_cvar_string("rcon_password",rcon,64)
    max_falied_rcon = get_cvar_pointer("max_falied_rcon")
    rcon_bantime = get_cvar_pointer("rcon_bantime")
}

public OrpheuHookReturn:On_Rcon_Validate_Pre()
{
    static s_Rcon[32]
    read_argv(2, s_Rcon, charsmax(s_Rcon))
    if (!equal(s_Rcon, rcon) && ip[0])
    {
        if(get_pcvar_num(max_falied_rcon))
        {
            if(TrieKeyExists(a_ip,ip))
            {
                new warns
                TrieGetCell(a_ip,ip,warns)
                if(++warns > get_pcvar_num(max_falied_rcon))
                {
                    server_cmd("addip %f %s",get_pcvar_float(rcon_bantime),ip)
                    TrieDeleteKey(a_ip,ip)
                    server_cmd("writeip")
                }
                else
                {
                    TrieSetCell(a_ip,ip,warns)
                }
            }
            else
            {
                TrieSetCell(a_ip,ip,1)
            }
        }
        else
        {
            server_cmd("addip %f %s",get_pcvar_float(rcon_bantime),ip)
            server_cmd("writeip")
        }
    }
}

public OrpheuHookReturn:On_Rcon(p_Adress)
{
    static i_Adress[22]
    OrpheuGetBytesAtAddress(p_Adress, i_Adress, charsmax(i_Adress))
    if (i_Adress[0] == 3)
        formatex(ip, charsmax(ip), "%i.%i.%i.%i",i_Adress[4], i_Adress[5], i_Adress[6], i_Adress[7])
}



All times are GMT -4. The time now is 05:57.

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