AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   deleteme (https://forums.alliedmods.net/showthread.php?t=48109)

naeo 12-04-2006 16:36

deleteme
 
deleteme

dutchmeat 12-05-2006 09:06

Re: Rate manager help..register_clcmd error?
 
Does it say 'Blaaah'?

jim_yang 12-05-2006 09:12

Re: Rate manager help..register_clcmd error?
 
mini suggestion: use this function
clamp ( value, min=cellmin, max=cellmax )
Returns value if it is in the range min-max, min if value is lower than min, max if higher than max.

dutchmeat 12-05-2006 09:24

Re: Rate manager help..register_clcmd error?
 
Code:
new myvalue = 330 new max = 400 new min = 100 if (myvalue <= min && myvalue => max) console_print(id,"yep");

jim_yang 12-05-2006 09:38

Re: Rate manager help..register_clcmd error?
 
maybe it's client-side cmd, not sent to the server, so you can't catch it.

dutchmeat 12-05-2006 09:51

Re: Rate manager help..register_clcmd error?
 
ehm yes, that's right, rate, and actually all network commands are all clientside.
You'll have to make your own command then.

The Specialist 12-05-2006 14:25

Re: Rate manager help..register_clcmd error?
 
please dont double post :down:

dutchmeat 12-05-2006 16:19

Re: Rate manager help..register_clcmd error?
 
use postthink:

Code:
/* Coded by nAE0^ @ 04/12/06 */ /* Based on AMX_RM for CS 1.5/AMX */ #include <amxmodx> #include <amxmisc> #include <engine> // Using global min/max defines for performance ;-) #define MAX_PLAYERS 17 #define DEAD_RATIO 0.4 #define CHECK_FREQ 10.0 #define MAX_UPR 101 #define MAX_RATE 25000 #define MIN_UPR 80 #define MIN_RATE 20000 #define DEAD_RATE 10000 #define DEAD_UPR 40 #define DEAD_INTERP 0.025 #define DEAD_FORCE_STRING "cl_updaterate %e; ex_interp %f; rate %d", DEAD_UPR, DEAD_INTERP, DEAD_RATE new old_upr[MAX_PLAYERS], old_rate[MAX_PLAYERS], Float:old_interp[MAX_PLAYERS] public client_spawned(id) {     new execstring[100]     // NULL TERMINATE JUST IN CASE!     execstring[format(execstring, 99, "cl_updaterate %d; rate %d; ex_interp %f", old_upr[id], old_rate[id], old_interp[id])] = 0     client_cmd(id, execstring)     return PLUGIN_CONTINUE } public client_killed(id) {     new id = read_data(2)     client_cmd(id, DEAD_FORCE_STRING)     return PLUGIN_CONTINUE } public client_connect(id) {     if(is_user_hltv(id))         return PLUGIN_CONTINUE     new tmp_upr[30], tmp_rate[30], tmp_interp[30]     get_user_info(id, "cl_updaterate", tmp_upr, 29)     get_user_info(id, "rate", tmp_rate, 29)     get_user_info(id, "ex_interp", tmp_interp, 29)     old_upr[id]    = clamp(str_to_num(tmp_upr), MIN_UPR, MAX_UPR)     old_rate[id]   = clamp(str_to_num(tmp_rate), MIN_RATE, MAX_RATE)     old_interp[id] = str_to_float(tmp_interp)     console_print(id, "rate:%d, cl_updaterate:%d, ex_interp:%f", old_rate[id], old_upr[id], old_interp[id])     return PLUGIN_CONTINUE } public check_changes(id) {     new cur_rate[30], cur_upr[30], cur_interp[30], num_rate,num_upr,Float:num_interp     if((id!=0)&&(!is_user_hltv(id)))     {             get_user_info(id, "cl_updaterate", cur_upr,    29)             get_user_info(id, "cl_rate",       cur_rate,   29)             get_user_info(id, "ex_interp",     cur_interp, 29)             num_rate   = str_to_num   (cur_rate)             num_upr    = str_to_num   (cur_upr)             num_interp = str_to_float (cur_interp)   if(is_user_alive(id))   {          if(old_rate[id]   != num_rate)          {              old_rate[id]   = clamp(num_rate, MIN_RATE, MAX_RATE)          }         if(old_upr[id]    != num_upr)         {                     old_upr[id]    = clamp(num_upr,  MIN_UPR,  MAX_UPR )         }         if(old_interp[id] != num_interp)         {                     old_interp[id] = num_interp         }         }else{                         if(old_rate[id]   != DEAD_RATE  )         {          old_rate[id]   = clamp(num_rate, MIN_RATE, MAX_RATE)         }         if(old_upr[id]    != DEAD_UPR   )         {          old_upr[id]    = clamp(num_upr,  MIN_UPR,  MAX_UPR )         }         if(old_interp[id] != DEAD_INTERP)         {          old_interp[id] = num_interp         }      }     } } public client_PostThink(id) // check it every frame { check_changes(id); } public plugin_init() {     register_plugin("Ratemanager", "1.1", "nAE0")     register_event("ResetHUD", "client_spawned", "be","1=1")     register_event("DeathMsg","client_killed","a")     set_cvar_num("sv_maxupdaterate", MAX_UPR)     set_cvar_num("sv_minupdaterate", MIN_UPR)     set_cvar_num("sv_maxrate", MAX_RATE)     set_cvar_num("sv_minrate", MIN_RATE)     return PLUGIN_CONTINUE }

naeo 12-05-2006 16:19

Re: Rate manager help..register_clcmd error?
 
@ The Specialist
Uhm. It's not OK to have two posts after one another?

It's different content (as in not double).. But if it's a rule around here i'll try to remember that.

@ Dutchmeat
Wont checking every frame use ALOT of resources? (i mean.. the server is running at 500-1500FPS) maybe it's another kind of frame?

I checked the amxx funcwiki but there really wasnt much info about it.. Any explanation on what it does?
Thanks for the idea anyway :]

dutchmeat 12-05-2006 16:35

Re: Rate manager help..register_clcmd error?
 
You'll have to make one check, to prevent the others, if the first check failed.
like this:

Code:
  if(old_rate[id] != num_rate || old_upr[id] != num_upr || old_interp[id] != num_interp)  continue;


All times are GMT -4. The time now is 07:00.

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