AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Client set ping (https://forums.alliedmods.net/showthread.php?t=255097)

Freezo Begin 01-10-2015 14:12

Client set ping
 
Hey , Again so i need someone to explain to me some functions in this script :

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_forward(FM_UpdateClientData"fw_updateClientData")
}

public 
fw_updateClientData(id)
{
    if ( ! ( 
pev(idpev_button) & IN_SCORE ) ) 
        return;
    
    new 
ping 10
    
new ping1
    
new offset1
    
    
for(new player 1player get_maxplayers(); player++)
    {
        if(!
is_user_connected(id))
            continue;
        
        for(new 
offset1 0offset1 4offset1++)
        {
            if ((
ping offset1) % == 0)
            {
                
ping1 = (ping offset1) / 4
                
break;
            }
        }
        
message_begin(MSG_ONE_UNRELIABLESVC_PINGS_id)
        
write_byte((offset1 64) + (* (player 1)))
        
write_short(ping1)
        
write_byte(0)
        
message_end()
    }


  • First why doing a loop to check if a (ping - 1 or 2 or 3 or 4 ) / 4 equal to 0
  • Why set it like this ping1 = (ping - offset1) / 4
  • i don't get this at all write_byte((offset1 * 64) + (1 + 2 * (player - 1))) :shock:


All times are GMT -4. The time now is 15:19.

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