Raised This Month: $ Target: $400
 0% 

Need help with new AMXX Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 05-10-2012 , 18:37   Need help with new AMXX Menu
Reply With Quote #1

How I can add FPS after player name?

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <colorchat>

#define PLUGIN "FPS"
#define VERSION "0.0.1"
#define AUTHOR "Twix"

new szName[32][33]
new 
Float:GameTime[33]
new 
FramesPer[33]
new 
Fps[33]
new 
CurFps[33]
new 
bool:HasFPS[33]

public 
plugin_init(){
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /fps""cmdFPS")
    
register_clcmd("say /allfps""cmdFPSMenu")
    
register_forward(FM_PlayerPreThink"fwdPlayerPreThink")
}

public 
client_authorized(id){
    
get_user_name(id szName[id] , charsmax(szName[] ))
}

public 
client_disconnect(id){
    
HasFPS[id] = false
}

public 
cmdFPSMenu(id){
    
    new 
menu menu_create("\rPlayers FPS""cmdFPSMenu_handler")
    new 
players[32], fps_in_menu[64], pnumtempidszName[32], szTempid[10]
    
get_players(playerspnum)
    
formatex(fps_in_menu63"\d[\r%d\d]"Fps[id]) // ?
    
    
for( new ii<pnumi++ )
    {
        
    
tempid players[i]
    
get_user_name(tempidszNamecharsmax(szName))
    
menu_additem(menuszNameszTempid0)

    }
    
    
menu_display(idmenu0)
}

public 
cmdFPSMenu_handler(idmenuitem){
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu)
    }

    return 
PLUGIN_CONTINUE
}

public 
cmdFPS(id)
{
    if(!
HasFPS[id])
    {
        
HasFPS[id] = true
        ColorChat
(idGREY"^4[FPS] ^3FPS displaying enabled. To disable, type /fps")
    }
    else
    {
        
HasFPS[id] = false
        ColorChat
(idGREY"^4[FPS] ^3FPS displaying disabled. To enable, type /fps")
    }
}

public 
fwdPlayerPreThink(id)
{
    if(
is_user_alive(id))
    {
        
GameTime[id] = get_gametime()
        
        if(
FramesPer[id] >= GameTime[id]) Fps[id] += 1
        
else
        {
            
FramesPer[id] += 1
            
            
if (HasFPS[id])
            {
                
set_hudmessage(25500, -1.00.901.01.00.10.11337)
                
show_hudmessage(id"FPS: %d"Fps[id])
            }
            
CurFps[id] = Fps[id]
            
            
Fps[id] = 0
        
}
    }

bazhenov93 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-10-2012 , 19:11   Re: Need help with new AMXX Menu
Reply With Quote #2

FYI, it is not possible to accurately calculate a player's FPS using server-side AMXX.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-11-2012 , 10:01   Re: Need help with new AMXX Menu
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
accurately
Meaning that you can try to calculate it, but doesn't mean that it will be the real FPS of the player.

That plugin is using the same method from this tutorial:
https://forums.alliedmods.net/showthread.php?t=66890

Read the thread, or even better, read Hawk's post specifically:
https://forums.alliedmods.net/showpo...96&postcount=7

Quote:
Originally Posted by Hawk552 View Post
It's extremely inaccurate. In fact, it's actually based more on the server's FPS than the client's and it's only accurate when both the client and server are very fast.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 05-11-2012 , 07:39   Re: Need help with new AMXX Menu
Reply With Quote #4

Really? look this
Attached Files
File Type: sma Get Plugin or Get Source (players_fps.sma - 495 views - 4.1 KB)

Last edited by bazhenov93; 05-11-2012 at 08:51. Reason: Added plugin.
bazhenov93 is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 05-11-2012 , 10:14   Re: Need help with new AMXX Menu
Reply With Quote #5

Hm, sad
bazhenov93 is offline
Old 05-11-2012, 12:48
fysiks
This message has been deleted by fysiks. Reason: nvm
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 00:22.


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