- /* 
- *  
- * FPS: 
- *  
- *  
- * CVars: 
- *         cfps             1/0 // Enable/Disable FPS.                Default: 1/on. 
- *         cfpsall             1/0 // Print FPS MSG to all players?    Default: 1/on. 
- *         cfpsvisual         1/0 // Show/Hide /fps chat message?    Default: 1/on. 
- *  
- * Usage: 
- *         Type " /fps <nick/#userid> " in say. 
- *         Type " /cfps " in say/say_team for about plugin. 
- *  
- * Notes: 
- *         To change delay between user /fps command, edit DELAY_COMMAND and recompile. 
- *        This is engine FPS. 
- *         Original FPS Code by newbie. 
- */ 
-   
- #include <amxmodx> 
- #include <amxmisc> 
- #include <fakemeta> 
-   
- #define PLUGIN_NAME        "FPS.Meter" 
- #define PLUGIN_VERSION        "1.0" 
- #define PLUGIN_AUTHOR        "Raggy" 
-   
- #pragma semicolon        1 
-   
- #define DELAY_COUNT        1.0    //Delay between frame counts, adjust this according to server ticrate. MUST BE FLOAT 
-   
- #define DELAY_COMMAND        5.0    //Delay between user /fps command. MUST BE FLOAT 
- #define COLOR            0x03    //0x01 normal, 0x04 green, 0x03 other. MUST BE CHAR 
-   
- #define MAX_PLAYERS        32 + 1 
-   
- new g_iUserFPS[MAX_PLAYERS]; 
-   
- new g_irFPS; 
- new g_irFPSAll; 
- new g_irFPSVisual; 
-   
- public plugin_init() 
- { 
-     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); 
-     register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY); 
-      
-     g_irFPS        = register_cvar("cfps",        "1"); 
-     g_irFPSAll    = register_cvar("cfpsall",    "1"); 
-     g_irFPSVisual    = register_cvar("cfpsvisual",    "1"); 
-      
-     register_forward(FM_PlayerPreThink, "fwdPlayerPreThink"); 
-      
-     register_clcmd("say",            "sayHandle"); 
-     register_clcmd("say /fps",        "cmdAboutrFPS"); 
-     register_clcmd("say_team /fps",    "cmdAboutrFPS"); 
- } 
-   
- public fwdPlayerPreThink(id) 
- { 
-     if ( !get_pcvar_num(g_irFPS) ) 
-         return FMRES_IGNORED; 
-      
-     static Float:fGameTime, Float:fCountNext[MAX_PLAYERS], iCountFrames[MAX_PLAYERS]; 
-      
-     if ( fCountNext[id] >= (fGameTime = get_gametime()) ) 
-     { 
-         iCountFrames[id]++; 
-          
-         return FMRES_IGNORED; 
-     } 
-      
-     g_iUserFPS[id]        = iCountFrames[id]; 
-     iCountFrames[id]    = 0; 
-      
-     fCountNext[id]        = fGameTime + DELAY_COUNT; 
-      
-     return FMRES_IGNORED; 
- } 
-   
- public sayHandle(id) 
- { 
-     if ( !get_pcvar_num(g_irFPS) ) 
-         return PLUGIN_CONTINUE; 
-      
-     new szArgs[64]; 
-     read_args(szArgs, charsmax(szArgs)); 
-     remove_quotes(szArgs); 
-     trim(szArgs); 
-      
-     if ( !szArgs[0] ) 
-         return PLUGIN_HANDLED; 
-      
-     if ( szArgs[0] != '/' ) 
-         return PLUGIN_CONTINUE; 
-      
-      
-     //Command 
-     new szTarget[32]; 
-      
-     parse(szArgs,\ 
-     szArgs, charsmax(szArgs),\ 
-     szTarget, charsmax(szTarget)); 
-      
-     if ( !equali(szArgs, "/fps", 4) ) 
-         return PLUGIN_CONTINUE; 
-     //Command 
-      
-      
-     //Delay 
-     new Float:fCommandDelay = DELAY_COMMAND; 
-      
-     static Float:fCommandUsed[MAX_PLAYERS]; 
-      
-     if ( fCommandUsed[id] > get_gametime() ) 
-     { 
-         printMessage(id, id, "^x01Kérlek várj^x04 %.0f^x03 másodpercet^x01 a parancsok között!", fCommandDelay); 
-         return PLUGIN_HANDLED; 
-     } 
-     //Delay 
-      
-      
-     //Display 
-     trim(szTarget); 
-      
-     if ( !szTarget[0] ) 
-         fCommandUsed[id] = displayFPS(id, id, fCommandDelay); 
-     else { 
-         new targetId = cmd_target(id, szTarget, 2); 
-          
-         if ( targetId ) 
-             fCommandUsed[id] = displayFPS(id, targetId, fCommandDelay); 
-         else { 
-             printMessage(id, id, "Nem található vagy túl sok játékos található ezzel a névvel: ^x04 %s", szTarget); 
-             return PLUGIN_HANDLED; 
-         } 
-     } 
-     //Display 
-      
-      
-     return get_pcvar_num(g_irFPSVisual) ? PLUGIN_CONTINUE : PLUGIN_HANDLED; 
- } 
-   
- Float:displayFPS(id, targetId, Float:fCommandDelay)   
- { 
-     new szName[32]; 
-     get_user_name(targetId, szName, charsmax(szName)); 
-      
-     new szMsg[192]; 
-     formatex(szMsg, charsmax(szMsg), "^x04%s^x01-nak^x04 %d^x03 FPS^x01-e van.", szName, g_iUserFPS[targetId]); 
-      
-     printMessage(id, get_pcvar_num(g_irFPSAll) ? 0 : id, szMsg); 
-      
-     return get_gametime() + fCommandDelay; 
- } 
-   
- printMessage(id, targetId, const sMsg[], any:...) 
- { 
-     new szMessage[192]; 
-      
-     vformat(szMessage, charsmax(szMessage), sMsg, 4); 
-     format(szMessage, charsmax(szMessage), "%c[FPS] %s", COLOR, szMessage); 
-      
-     static iSayText; 
-      
-     if ( !iSayText ) 
-         iSayText = get_user_msgid("SayText"); 
-      
-     message_begin(targetId ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, {0, 0, 0}, targetId); 
-     write_byte(id); 
-     write_string(szMessage); 
-     message_end(); 
- }