AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fps Limiter and restore script (https://forums.alliedmods.net/showthread.php?t=17407)

-X3N- | DEFAULT 08-31-2005 04:38

Fps Limiter and restore script
 
I need some help completing this script. It's purpose is to store the fps_max of connecting clients so that after the plugin is stopped, the original value can be returned to the player. Please help me understand why the value of the "fps_max" is not being stored correctly here.

Code:

#include <amxmodx>

new fps[33]

public plugin_init(){
        register_plugin("FpsLimit","1.0","-Default-")
        register_concmd("amx_fpslimit", "on", ADMIN_LEVEL_A, "amx_fpslimit <on|off> or <1|0>")
        return PLUGIN_CONTINUE
}

public client_connect(id){
        get_user_info(id, "fps_max", fps[id], 31)
}


public on(id){
        if (id && !((get_user_flags(id) & ADMIN_LEVEL_A)))
                {
                client_print(id, print_console, "[AMXX] You do not have access to this command")
                return PLUGIN_CONTINUE
        }
        new arg[8]
        read_argv(1, arg, 7)
       
        if((equali(arg, "off"))||(equali(arg, "0")))
        {
                set_task(1.0,"resetfps")
                client_print(id, print_console, "[AMXX] DISABLED FPS Limit mode")
                client_print(0, print_chat, "[AMXX] DISABLED FPS Limit mode")               
               
        }
        else
        {
                //set_task(1.0,"setfps",_,_,_,"b")
                set_task(1.0,"setfps")
                client_print(id, print_console, "[AMXX] ENABLED FPS Limit mode")
                client_print(0, print_chat, "[AMXX] ENABLED FPS Limit mode")
        }
        return PLUGIN_HANDLED       
       
}

public setfps(id) {
        //if(check == 1){
        new players[32], num, i, player
        get_players(players,num)
        for(i=0;i<num;i++) {
                player = players[i]
                client_cmd(player,"fps_max 101")
                client_cmd(player,"fps_modem 0")
        }
        //}
        return PLUGIN_CONTINUE
}

public resetfps(id){
        new Players[32]
        new num, i, player
        get_players(Players, num, "c")
        for (i=0; i<num; i++){
                player = Players[i]
                //client_cmd(player,"fps_max %s",fps[player])
                client_print(0, print_chat, "Player %i @ %sfps ",player,fps[player])
                //client_cmd(players[i],"fps_max %i",str_to_num(fps[players[i]]))
        }
        return PLUGIN_CONTINUE       
}


**update** it seems that it is impossible to get the value of "fps_max" i have tried so many things, does anybody know how to get this value?

XxAvalanchexX 08-31-2005 15:15

You may be able to fetch it with the upcoming query_client_cvar function.

-X3N- | DEFAULT 08-31-2005 15:18

Oooo, sounds kinda sexy... when can i expect all this sexiness?

XxAvalanchexX 08-31-2005 15:22

Quote:

Originally Posted by BAILOPAN
It'll go into 1.56 then.


pdoubleopdawg 08-31-2005 19:02

Kind of offtopic, but for that new function. Is it for ALL cvars? Or just some.

darkcloud9sgl 08-31-2005 19:59

i wouldnt recommand makeing a thing for the fps just to leave it alone

Mustaffa35 02-17-2012 10:50

Re: Fps Limiter and restore script
 
a supermıs

Devil259 02-17-2012 11:20

Re: Fps Limiter and restore script
 
fps_max 101 in amxx.cfg (for example)

Exolent[jNr] 02-17-2012 11:50

Re: Fps Limiter and restore script
 
Quote:

Originally Posted by Devil259 (Post 1652245)
fps_max 101 in amxx.cfg (for example)

That won't affect players at all (except the LAN owner if on a LAN server).

Devil259 02-17-2012 14:04

Re: Fps Limiter and restore script
 
So, why a lot of servers set it in server.cfg ?


All times are GMT -4. The time now is 14:26.

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