|
本帖最后由 opopp 于 2012-2-4 19:16 编辑
amx_fps_show (0/1)
amx_fps_bots (0/1)
amx_fps_sfc (0/1)
- #include <amxmodx>
- #include <engine>
-
- new g_fps[33][11];
- new g_i[33];
- new g_maxplayers;
-
- public plugin_init() {
- register_plugin("fps", "fps", "fps")
- register_srvcmd("players","show_info")
-
- g_maxplayers = get_maxplayers()
- }
-
- public show_info()
- {
- new name[32]
- new ping,loss
-
- server_print("NAME | FPS | Ping | Loss")
-
- for(new i=1;i<=g_maxplayers;i++)
- {
- if(!is_user_connected(i) || is_user_bot(i))
- continue;
-
- get_user_ping(i,ping,loss)
- get_user_name(i,name,31)
-
- server_print("%s | %ifps | %iping | %iloss",name,get_user_fps(i),ping,loss)
- }
- }
-
- //code from get_fps tutorial
- public client_putinserver(id)
- set_task(0.1, "count", id, "", 0, "b");
-
- public client_disconnect(id)
- remove_task(id);
-
- public client_PreThink(id)
- g_fps[id][10]++;
-
- public count(id) {
-
- if ( g_i[id] < 9 )
- g_i[id]++;
- else
- g_i[id] = 0;
-
- g_fps[id][g_i[id]] = g_fps[id][10];
- g_fps[id][10] = 0;
- }
-
- get_user_fps(id)
- {
- new i;
- new j = 0;
-
- for ( i = 0; i < 9; i++ )
- j += g_fps[id][i];
-
- return j - 5;
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|