AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Improved the player ping Or set fake ping ? (https://forums.alliedmods.net/showthread.php?t=336459)

Supremache 02-21-2022 17:42

Improved the player ping Or set fake ping ?
 
I found this code on a mod and i want to understand what does this code do, because i don't understand it.
PHP Code:

new g_iOffset[33][2];
new 
g_iArgumentPing[33][3];
new 
g_iPingOverride[33] =
{
    -
1, ...
}
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_UpdateClientData"Update_Client_Data");    
    
set_task(2.0"TaskCalculateArguments"0""0"b"0);
}

public 
Update_Client_Data(id)
{
    if( !(
pevidpev_button ) & IN_SCORE ) && !( pevidpev_oldbuttons ) & IN_SCORE ) )
        return;
    
    static 
playersending;
    
sending 0;
    
    for( 
player 1player <= g_iMaxClientsplayer++ )
    {
        if( !
is_user_connectedplayer ) )
             continue;
        
        switch( 
sending )
        {
            case 
0:
            {
                
message_beginMSG_ONE_UNRELIABLESVC_PINGS_id );
                
write_byte( ( g_iOffsetplayer ][ ] * 64 ) + ( * ( player ) ) );
                
write_shortg_iArgumentPingplayer ][ ] );
                
sending++;
            }
            
            case 
1:
            {
                
write_byte( ( g_iOffsetplayer ][ ] * 128 ) + ( * ( player ) ) );
                
write_shortg_iArgumentPingplayer ][ ] );
                
sending++;
            }
            
            case 
2:
            {
                
write_byte( ( * ( player ) ) );
                
write_shortg_iArgumentPingplayer ][ ] );
                
write_byte);
                
message_end( );
                
sending 0;
            }
        }
    }
    
    if (
sending)
    {
        
write_byte);
        
message_end( );
    }
}

public 
TaskCalculateArguments()
{
    static 
playerping;
    
    for( 
player 1player <= g_iMaxClientsplayer++ )
    {
        if( 
g_iPingOverrideplayer ] < )
        {
            
ping random_num(-44) + 12;
        }
        else
        {
            
ping g_iPingOverrideplayer ];
        }
        for( 
g_iOffset player ][ ] = 0g_iOffsetplayer ][ ] < 4g_iOffsetplayer ][ ]++ )
        {
            if( ( 
ping g_iOffsetplayer ][ ] ) % == )
            {
                
g_iArgumentPingplayer ][ ] = ( ping g_iOffsetplayer ][ ] ) / 4;
                break;
            }
        }
        
        for (
g_iOffset[player][1] = 0g_iOffset[player][1] < 2g_iOffset[player][1]++)
        {
            if( ( 
ping g_iOffsetplayer ][ ] ) % == )
            {
                
g_iArgumentPingplayer ][ ] = ( ping g_iOffsetplayer ][ ] ) / 2;
                break;
            }
        }
        
g_iArgumentPingplayer ][ ] = ping;
    }



DJEarthQuake 02-22-2022 01:59

Re: Improved the player ping Or set fake ping ?
 
It is something that looks like it works but it is all fake. That's why it checks if one is pressing down on the scoreboard key.

Supremache 02-22-2022 12:31

Re: Improved the player ping Or set fake ping ?
 
So, it's for set a fake ping?

DJEarthQuake 02-25-2022 00:36

Re: Improved the player ping Or set fake ping ?
 
Right; fake! SVC_PINGS is ping when IN_SCORE.
Code:

Ping Faker 1.5

                        /\
  ___                  /  \                  ___
 /  \    __        /    \        __    /
/    \  /  \  _  / <()> \  _  /  \  /
      \_/    \_/ \_/________\_/ \_/    \_/
 __________________/__I___I___\________________
                  /_I___I___I__\
                /I___I___I___I_\
                /___I___I___I___I\
              /__I___I___I___I___\
              /_I___I___I___I___I__\
            /I___I___I___I___I___I_\
            /___I___I___I___I___I___I\
          /__I___I___I___I___I___I___\
          /_I___I___I___I___I___I___I__\


Supremache 02-25-2022 09:01

Re: Improved the player ping Or set fake ping ?
 
I get it, thank you for your reply


All times are GMT -4. The time now is 08:44.

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