paiskint
Posted: 2012 Dec 21 04:09
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 }}