paiskint

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
User avatar
laimiukas3
Moderatorius
Posts: 4569
Joined: 2012 Aug 03 01:12
Skype: laimiukas3
Location: Vilnius
Contact:

paiskint

Post by laimiukas3 »

sweiki gal galit paiskint kas cia per amxx nlb suprantu ir ar jis naudingas :)

Code: Select all

#include <amxmodx>#include <fakemeta> #define PLUGIN "FPS Optimizer"#define VERSION "1.0 Bata"#define AUTHOR "Sho0ter" #define ACCESS_LEVEL ADMIN_RCON #define MAX_FPS 1250#define MIN_FPS 1000#define OPT_FPS 1000#define FLUX_FPS 5 new Float:gametimenew Float:framesper new show[33]new hudnew systnew currentratenew fpsnew maxplayers  public plugin_init() {    register_plugin(PLUGIN, VERSION, AUTHOR)    register_clcmd("say /showfps", "cmd_show")    register_forward(FM_StartFrame, "start_frame")    syst = get_cvar_pointer("sys_ticrate")    currentrate = OPT_FPS    hud = CreateHudSyncObj()    maxplayers = get_maxplayers()    return PLUGIN_CONTINUE} public cmd_show(id){    if(!(get_user_flags(id) & ACCESS_LEVEL))    {        return PLUGIN_HANDLED    }    if(!show[id])    {        show[id] = 1    }    else    {        show[id] = 0    }    return PLUGIN_HANDLED} public client_disconnect(id){    show[id] = 0    return PLUGIN_CONTINUE} public start_frame(){    gametime = get_gametime()    if(framesper >= gametime)    {        fps += 1    }    else    {        framesper += 1.0        for(new id = 1; id <= maxplayers; id++)        {            if(!is_user_connected(id) || !show[id])            {                continue            }            switch(fps)            {                case 500..1000:                {                    set_hudmessage(0, 255, 0, 0.05, -1.0, 0, 1.0, 1.1, 0.1, 0.1, -1);                }                case 250..499:                {                    set_hudmessage(255, 255, 0, 0.05, -1.0, 0, 1.0, 1.1, 0.1, 0.1, -1);                }                case 100..249:                {                    set_hudmessage(255, 0, 0, 0.05, -1.0, 0, 1.0, 1.1, 0.1, 0.1, -1);                }                default:                {                    set_hudmessage(255, 0, 0, 0.05, -1.0, 1, 1.0, 1.1, 0.1, 0.1, -1);                }            }            ShowSyncHudMsg(id, hud, "Server FPS: %d frames/sec.^nCurrent ticrate: %d", fps, currentrate)        }        if(fps < OPT_FPS && currentrate < MAX_FPS)        {            currentrate += FLUX_FPS            set_pcvar_num(syst, currentrate)        }        else if(fps >= OPT_FPS && currentrate > MIN_FPS)        {            currentrate -= FLUX_FPS            set_pcvar_num(syst, currentrate)        }        fps = 1    }} 
Image
Image
Image

Tetusis

Re: paiskint

Post by Tetusis »

keicia nustatymus pagal zaideju skaiciu, bevertis dalykas, niekada tiksliai neapskaiciuosi, nes yra kiti faktoriai kurie itakoja serverio veikla...

User avatar
hleV
AMX Mod X ekspertai
Posts: 875
Joined: 2011 Apr 02 11:23
Skype: hlev.lt
Location: Šiauliai

Re: paiskint

Post by hleV »

Code: Select all

#include <amxmodx>#include <engine> public server_frame(){    static Float:prevGameTime;    new Float:fps = 1.0 / (-prevGameTime + (prevGameTime = get_gametime()));        if (fps >= 500)        set_hudmessage(0, 255, 0, 0.05, -1.0, 0, 1.0, 1.1, 0.1, 0.1, 1);    else if (fps >= 250)        set_hudmessage(255, 255, 0, 0.05, -1.0, 0, 1.0, 1.1, 0.1, 0.1, 1);    else        set_hudmessage(255, 0, 0, 0.05, -1.0, 1, 1.0, 1.1, 0.1, 0.1, 1);        show_hudmessage(0, "Server FPS: %d frames/sec.", fps);}
Win.
Last edited by hleV on 2012 Dec 22 00:42, edited 1 time in total.
Image ← RIP best userbar
DISKUSIJA: KIETAS PLUGIN'O UŽSAKOVAS
Privačios pagalbos neteikiu!

User avatar
laimiukas3
Moderatorius
Posts: 4569
Joined: 2012 Aug 03 01:12
Skype: laimiukas3
Location: Vilnius
Contact:

Re: paiskint

Post by laimiukas3 »

Aciu uz info :)
Image
Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests