1.1 --- a/plugins/include/clients.inc Wed Apr 11 20:07:20 2007 +0000
1.2 +++ b/plugins/include/clients.inc Thu Apr 12 00:45:53 2007 +0000
1.3 @@ -18,6 +18,13 @@
1.4 #endif
1.5 #define _clients_included
1.6
1.7 +enum NetFlow
1.8 +{
1.9 + NetFlow_Outgoing = 0, /**< Outgoing traffic */
1.10 + NetFlow_Incoming, /**< Incoming traffic */
1.11 + NetFlow_Both /**< Incoming and outgoing traffic */
1.12 +};
1.13 +
1.14 /**
1.15 * Called on client connection.
1.16 *
1.17 @@ -380,3 +387,110 @@
1.18 * @error Invalid client index, client not in game, or no mod support.
1.19 */
1.20 native GetClientFrags(client);
1.21 +
1.22 +/**
1.23 + * Returns the client's send data rate in bytes/sec.
1.24 + *
1.25 + * @param client Player's index.
1.26 + * @return Data rate.
1.27 + * @error Invalid client index, client not in game, or fake client.
1.28 + */
1.29 +native GetDataRate(client);
1.30 +
1.31 +/**
1.32 + * Returns if a client is timing out
1.33 + *
1.34 + * @param client Player's index.
1.35 + * @return True if client is timing out, false otherwise.
1.36 + * @error Invalid client index, client not in game, or fake client.
1.37 + */
1.38 +native bool:IsTimingOut(client);
1.39 +
1.40 +/**
1.41 + * Returns the client's connection time in seconds.
1.42 + *
1.43 + * @param client Player's index.
1.44 + * @return Connection time.
1.45 + * @error Invalid client index, client not in game, or fake client.
1.46 + */
1.47 +native Float:GetTimeConnected(client);
1.48 +
1.49 +/**
1.50 + * Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering.
1.51 + *
1.52 + * @param client Player's index.
1.53 + * @param flow Traffic flowing direction.
1.54 + * @return Latency.
1.55 + * @error Invalid client index, client not in game, or fake client.
1.56 + */
1.57 +native Float:GetLatency(client, NetFlow:flow);
1.58 +
1.59 +/**
1.60 + * Returns the client's average packet latency in seconds.
1.61 + *
1.62 + * @param client Player's index.
1.63 + * @param flow Traffic flowing direction.
1.64 + * @return Average latency.
1.65 + * @error Invalid client index, client not in game, or fake client.
1.66 + */
1.67 +native Float:GetAvgLatency(client, NetFlow:flow);
1.68 +
1.69 +/**
1.70 + * Returns the client's average packet loss, values go from 0 to 1 (for percentages).
1.71 + *
1.72 + * @param client Player's index.
1.73 + * @param flow Traffic flowing direction.
1.74 + * @return Average packet loss.
1.75 + * @error Invalid client index, client not in game, or fake client.
1.76 + */
1.77 +native Float:GetAvgLoss(client, NetFlow:flow);
1.78 +
1.79 +/**
1.80 + * Returns the client's average packet choke, values go from 0 to 1 (for percentages).
1.81 + *
1.82 + * @param client Player's index.
1.83 + * @param flow Traffic flowing direction.
1.84 + * @return Average packet choke.
1.85 + * @error Invalid client index, client not in game, or fake client.
1.86 + */
1.87 +native Float:GetAvgChoke(client, NetFlow:flow);
1.88 +
1.89 +/**
1.90 + * Returns the client's data flow in bytes/sec.
1.91 + *
1.92 + * @param client Player's index.
1.93 + * @param flow Traffic flowing direction.
1.94 + * @return Data flow.
1.95 + * @error Invalid client index, client not in game, or fake client.
1.96 + */
1.97 +native Float:GetAvgData(client, NetFlow:flow);
1.98 +
1.99 +/**
1.100 + * Returns the client's average packet frequency in packets/sec.
1.101 + *
1.102 + * @param client Player's index.
1.103 + * @param flow Traffic flowing direction.
1.104 + * @return Packet frequency.
1.105 + * @error Invalid client index, client not in game, or fake client.
1.106 + */
1.107 +native Float:GetAvgPackets(client, NetFlow:flow);
1.108 +
1.109 +/**
1.110 + * Translates an userid index to the real player index.
1.111 + *
1.112 + * @param userid Userid value.
1.113 + * @return Client value.
1.114 + * @error Returns 0 if invalid userid.
1.115 + */
1.116 +native GetClientOfUserId(userid);
1.117 +
1.118 +/**
1.119 + * Executes a client command on the server without being networked.
1.120 + *
1.121 + * @param client Index of the client.
1.122 + * @param fmt Format of the client command.
1.123 + * @param ... Format parameters
1.124 + * @noreturn
1.125 + * @error Invalid client index, or client not connected.
1.126 + */
1.127 +native FakeClientCommand(client, const String:fmt[], any:...);