Zplague Conectar-se

Seu portal de Zombie Plague no Brasil


Compartilhe

description[Plugin] PM_CheckVelocity debugger

more_horiz
Nome do plugin: PM_CheckVelocity debugger

Função do plugin : Bloqueia Floods de mensagens que aparecem assim no console -> PM  Got a velocity too high on <- tirando esses Floods com esse plugin da menos lag no servidor :)

Código:

#include <   amxmodx >
#include <   fakemeta >
#include <   orpheu >
#include <   orpheu_stocks >

#define PLUGIN "PM_CheckVelocity debugger"
#define VERSION "0.1"
#define AUTHOR "meTaLiCroSS"

new OrpheuStruct:g_pPMove

public plugin_init( )
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    OrpheuRegisterHook( OrpheuGetDLLFunction( "pfnPM_Move", "PM_Move" ), "PM_Move" );
    OrpheuRegisterHook( OrpheuGetFunction( "PM_CheckVelocity" ), "PM_CheckVelocity" );
}

public PM_Move( OrpheuStruct:ppmove, server )
{
    g_pPMove = ppmove;
}

public PM_CheckVelocity( )
{
    static i, iPlayer, szConsolePrint[64], Float:flMaxVelocity, Float:vecVelocity[3]
    iPlayer = OrpheuGetStructMember( g_pPMove, "player_index" ) + 1;
    flMaxVelocity = Float:OrpheuGetStructMember( OrpheuStruct:OrpheuGetStructMember( g_pPMove, "movevars" ), "maxvelocity" );
    OrpheuGetStructMember( g_pPMove, "velocity", vecVelocity );
    
    for(i = 0; i < 3; i++)
    {
        if(vecVelocity[i] > flMaxVelocity)
        {
            formatex( szConsolePrint, charsmax(szConsolePrint), "PM %d Got a velocity too high on %d^n", iPlayer, i );
            engfunc( EngFunc_AlertMessage, at_aiconsole, szConsolePrint )
            
            vecVelocity[i] = flMaxVelocity // skip original engine message
            OrpheuSetStructMember( g_pPMove, "velocity", vecVelocity )
            
        }
        else if(vecVelocity[i] < -flMaxVelocity)
        {
            formatex( szConsolePrint, charsmax(szConsolePrint), "PM %d Got a velocity too low on %d^n", iPlayer, i );
            engfunc( EngFunc_AlertMessage, at_aiconsole, szConsolePrint )
            
            vecVelocity[i] = -flMaxVelocity // skip original engine message
            OrpheuSetStructMember( g_pPMove, "velocity", vecVelocity )
        }
    }
    /*
    if (pmove->velocity[i] > pmove->movevars->maxvelocity)
   {
        pmove->Con_DPrintf ("PM  Got a velocity too high on %i\n", i);
        pmove->velocity[i] = pmove->movevars->maxvelocity;
    }
    else if (pmove->velocity[i] < -pmove->movevars->maxvelocity)
    {
        pmove->Con_DPrintf ("PM  Got a velocity too low on %i\n", i);
        pmove->velocity[i] = -pmove->movevars->maxvelocity;
    }*/
}  

descriptionRe: [Plugin] PM_CheckVelocity debugger

more_horiz
Grande Metalicross :)
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum