Raised This Month: $51 Target: $400
 12% 

fps check>?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cirovic
Senior Member
Join Date: Sep 2019
Old 07-06-2020 , 15:01   fps check>?
Reply With Quote #1

i need plugin that with command /fps everyone will be able to see everyone FPS in game i saw on some server, so when player type /fps it open menu with back,next and exit and player name with their fps
Cirovic is offline
The RaiD.
Member
Join Date: Jul 2019
Old 07-07-2020 , 10:10   Re: fps check>?
Reply With Quote #2

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine> 
#include <colorchat> 

#define PLUGIN "Players FPS"
#define VERSION "1.0"
#define AUTHOR "Empowers and Admin"
#define Menu_Keys (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
#define MAX_MENUBODY_LEN 1024

new g_fps[33][11]
new g_i[33]

new MenuPos
new MenuPlayers[32]
new g_maxplayers

new cvar_Show
new cvar_Show_sfc
new cvar_Show_Bots

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_menucmd(register_menuid("ShowFPS"), Menu_Keys, "Pressed")
    
    register_clcmd("say /showfps","Show")
    register_clcmd("say_team /showfps","Show")
    register_clcmd("say /sfc","show_in_console")
    register_clcmd("say_team /sfc","show_in_console")
    register_clcmd("amx_scf","show_in_console")
    
    cvar_Show = register_cvar("amx_fps_show","0")
    cvar_Show_sfc = register_cvar("amx_fps_sfc","0")
    cvar_Show_Bots = register_cvar("amx_fps_bots","0")
    
    
    g_maxplayers = get_maxplayers()
}

public Show(id){
    
    if(get_pcvar_num(cvar_Show) || is_user_admin(id)){
        
        ShowMenu(id, MenuPos = 0)
        
        }else{
        
        ColorChat(id,RED,"[ShowFps] Solo los administradores pueden usar esto.")
        
    }
    return PLUGIN_HANDLED
}

public ShowMenu(id, position) {
    if (position < 0) { return 0; }
    
    new i, k
    new MenuBody[255]
    new CurrentKey = 0
    new Start = position * 7
    new Num
    new UserName[32]
    
    get_players(MenuPlayers, Num)
    if (Start >= Num) { Start = position = MenuPos = 0; }
    new Len = format(MenuBody, 255, "\yFPS jugadores \R%d/%d^n\w^n", position+1, (Num / 7 + ((Num % 7) ? 1 : 0 )) )
    new End = Start + 7
    new Keys = (1<<9)
    if (End > Num) { End = Num; }
    
    for(i=Start;i<End;i++) {
        k = MenuPlayers[i]
        get_user_name(k, UserName, 31)
        Keys |= (1<<CurrentKey++)
        new fps = get_user_fps(k)
        
        if(is_user_bot(k)){
            
            if(get_pcvar_num(cvar_Show_Bots))
                Len += format(MenuBody[Len], (255-Len), "\d%i. %s | Fps:%s%d^n", CurrentKey, UserName,(fps > 104)? "\r" : "\d",fps)
            
            }else{
            Len += format(MenuBody[Len], (255-Len), "\w%i. %s | Fps:%s%d^n", CurrentKey, UserName,(fps > 104)? "\r" : "\w",fps)
        }
    }
    if (End != Num) {
        format(MenuBody[Len], (255-Len), "^n\w9. Siguiente^n%s", position ? "\w0. Atras" : "\w0. Salir")
        Keys |= (1<<8)
    }
    else {
        format(MenuBody[Len], (255-Len), "^n%s", position ? "\w0. Atras" : "\w0. Salir")
    }
    show_menu(id, Keys, MenuBody, -1, "ShowFPS")
    return 0
}

public Pressed(id, key) {
    switch (key) {
        case 8: ShowMenu(id, ++MenuPos)
            case 9: ShowMenu(id, --MenuPos)
            
        default: {
            
            new PlayerID = MenuPlayers[MenuPos * 7 + key]
            new UserName[32]
            get_user_name(PlayerID, UserName, 31)
            
            ShowMenu(id,MenuPos)
        }
    }
    return PLUGIN_HANDLED
}
public show_in_console(id) { 
    
    if(get_pcvar_num(cvar_Show_sfc) || is_user_admin(id)){
        
        new name[32] 
        new ping,loss 
        
        console_print(id,"NOMBRE        | 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) 
            
            console_print(id,"%s |   %ifps | %iping | %iloss",name,get_user_fps(i),ping,loss) 
        }
        }else{
        console_print(id,"[ShowFps] Solo los administradores pueden usar esto.") 
    }
    return PLUGIN_HANDLED
}

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 < 10; i++ ) 
        j += g_fps[id][i]
    
    return j - 5
}
The RaiD. is offline
Reply



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 03:41.


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