Quote:
Originally Posted by ConnorMcLeod
PHP Code:
new iPlayers[32], iNum, iTotalPing, iPing, iLoss
// get the players num and save their id into iPlayers array get_players(iPlayers, iNum) for(new i; i<iNum; i++) { // for each array cell that contain the id of a connected player, retrieve the player ping get_user_ping(iPlayers[i], iPing, iLoss)
// 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],iServerPing, iNum, iTotalPing, iPing, iLoss
// get the players num and save their id into iPlayers array
get_players(iPlayers, iNum)
for(new i; i<iNum; i++)
{
// for each array cell that contain the id of a connected player, retrieve the player ping
get_user_ping(iPlayers[i], iPing, iLoss)
// 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")
}
}