Raised This Month: $ Target: $400
 0% 

get total ping


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
iNspiratioN
Member
Join Date: Feb 2009
Location: Lithuania
Old 03-07-2009 , 14:09   Re: get total ping
Reply With Quote #8

You want it to show it?


Like this?
PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("ServerPing","1.0","Biscuit")
    
register_cvar("ServerPing","-999")
}

public 
TotalPing(){
    new 
iPlayers[32], ServerPingiNumiTotalPingiPingiLoss
    
    
// get the players num and save their id into iPlayers array
    
get_players(iPlayersiNum)
    for(new 
i=0iNumi++)
    {
        
// for each array cell that contain the id of a connected player, retrieve the player ping
        
get_user_ping(iPlayers[i], iPingiLoss)
        
        
// add this ping ti the variable iTotalPing
        
iTotalPing += iPing
    
}
    
ServerPing iTotalPing iNum
    set_cvar_num
("ServerPing",ServerPing)
}

public 
Pingshow(){
    new 
id read_data(1)
    new 
ServerPing
    ServerPing 
get_cvar_num ("ServerPing")
    if(
ServerPing <= 20){
        
client_print(idprint_chat"ServerPing is good")
    }else if (
ServerPing >= 21 && ServerPing <= 50){
        
client_print(idprint_chat"ServerPing is generally")
    }else{
        
client_print(idprint_chat"ServerPing is bad")
    }

P.S acctualy i don't get it what you want...
iNspiratioN is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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