Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

Fps Shower Edit


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Anyone can make these say messages:


- If player's fps is lower than 60 "^x04%s^x03 has^x04 %d^x03 FPS and a bad PC!"
- If player's fps is lower than 40 "^x04%s^x03 has^x04 %d^x03 FPS (someone buy this guy a new pc)"



Please no misunderstanding, it's just for fun.



PHP Code:

/*

* rFPSometer:


* CVars:
*         rfps        1/0 // Enable/Disable rFPSometer.        Default: 1/on.
*         rfpsall        1/0 // Print rFPSometer MSG to all players?    Default: 1/on.
*         rfpsvisual    1/0 // Show/Hide /fps chat message?        Default: 1/on.

* Usage:
*         Type " /fps <nick/#userid> " in say.
*         Type " /rfps " 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 Counting by newbie.


* By: raggy
* Email: [email protected]
* HomePage: http://www.rayish.com
* IRC: #rayish @ QuakeNet

*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN_NAME        "rFPSometer"
#define PLUGIN_VERSION        "1.1.1"
#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_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
register_cvar(PLUGIN_NAMEPLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY);
    
    
g_irFPS        register_cvar("rfps",        "1");
    
g_irFPSAll    register_cvar("rfpsall",    "1");
    
g_irFPSVisual    register_cvar("rfpsvisual",    "1");
    
    
register_forward(FM_PlayerPreThink"fwdPlayerPreThink");
    
    
register_clcmd("say",            "sayHandle");
    
register_clcmd("say /rfps",        "cmdAboutrFPS");
    
register_clcmd("say_team /rfps",    "cmdAboutrFPS");
}

public 
fwdPlayerPreThink(id)
{
    if ( !
get_pcvar_num(g_irFPS) )
        return 
FMRES_IGNORED;
    
    static 
Float:fGameTimeFloat: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(szArgscharsmax(szArgs));
    
remove_quotes(szArgs);
    
trim(szArgs);
    
    if ( !
szArgs[0] )
        return 
PLUGIN_HANDLED;
    
    if ( 
szArgs[0] != '/' )
        return 
PLUGIN_CONTINUE;
    
    
    
//Command
    
new szTarget[32];
    
    
parse(szArgs,\
    
szArgscharsmax(szArgs),\
    
szTargetcharsmax(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(idid"Please^x04 wait %.0f seconds^x03 between commands!"fCommandDelay);
        return 
PLUGIN_HANDLED;
    }
    
//Delay
    
    
    //Display
    
trim(szTarget);
    
    if ( !
szTarget[0] )
        
fCommandUsed[id] = displayFPS(ididfCommandDelay);
    else {
        new 
targetId cmd_target(idszTarget2);
        
        if ( 
targetId )
            
fCommandUsed[id] = displayFPS(idtargetIdfCommandDelay);
        else {
            
printMessage(idid"There is no OR multiple players with that name ->^x04 %s"szTarget);
            return 
PLUGIN_HANDLED;
        }
    }
    
//Display
    
    
    
return get_pcvar_num(g_irFPSVisual) ? PLUGIN_CONTINUE PLUGIN_HANDLED;
}

Float:displayFPS(idtargetIdFloat:fCommandDelay)  
{
    new 
szName[32];
    
get_user_name(targetIdszNamecharsmax(szName));
    
    new 
szMsg[192];
    
formatex(szMsgcharsmax(szMsg), "^x04%s^x03 has^x04 %d^x03 FPS"szNameg_iUserFPS[targetId]);
    
    
printMessage(idget_pcvar_num(g_irFPSAll) ? idszMsg);
    
    return 
get_gametime() + fCommandDelay;
}

public 
cmdAboutrFPS(id)
{
    
printMessage(idid"^x04%s^x03 Version^x04 %s^x03 By^x04 %s^x03 -> Status^x04 %s^x03 Command is^x04 %s"PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHORget_pcvar_num(g_irFPS) ? "enabled" "disabled"get_pcvar_num(g_irFPSVisual) ? "not blocked" "blocked");
    
    return 
get_pcvar_num(g_irFPSVisual) ? PLUGIN_CONTINUE PLUGIN_HANDLED;
}

printMessage(idtargetId, const sMsg[], any:...)
{
    new 
szMessage[192];
    
    
vformat(szMessagecharsmax(szMessage), sMsg4);
    
format(szMessagecharsmax(szMessage), "%c[rFPS] %s"COLORszMessage);
    
    static 
iSayText;
    
    if ( !
iSayText )
        
iSayText get_user_msgid("SayText");
    
    
message_begin(targetId MSG_ONE_UNRELIABLE MSG_BROADCASTiSayText, {000}, targetId);
    
write_byte(id);
    
write_string(szMessage);
    
message_end();


Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

×
×
  • Dodaj nową pozycję...