Raised This Month: $ Target: $400
 0% 

get total ping


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 03-07-2009 , 09:46   Re: get total ping
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
new iPlayers[32], iNumiTotalPingiPingiLoss

// get the players num and save their id into iPlayers array
get_players(iPlayersiNum)
for(new 
ii<iNumi++)
{
    
// 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


thank
i am trying to script a plugin
but still have many error.
PHP Code:
#include <amxmodx>

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

public 
TotalPing(){
    new 
iPlayers[32],iServerPingiNumiTotalPingiPingiLoss

    
// get the players num and save their id into iPlayers array
    
get_players(iPlayersiNum)
    for(new 
ii<iNumi++)
    {
        
// 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
        iServerPing 
== iTotalPing get_playersnum()
    }  
}

public 
Pingshow(){
    if(
iServerPing) <= 20{
        
client_print(0,print_chat,"ServerPing is very good")
            }
     else if(
iServerPing) >= 21 && (iServerPing) <= 50{
        
client_print(0,print_chat,"ServerPing is generally")
            }
     else(
iServerPing) >= 51{
        
client_print(0,print_chat,"ServerPing is Bad")
            }


Last edited by biscuit628; 03-07-2009 at 10:12.
biscuit628 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