Raised This Month: $ Target: $400
 0% 

rate enforce


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Revop
Junior Member
Join Date: Jul 2006
Old 07-12-2006 , 18:39   rate enforce
Reply With Quote #1

I'm trying to create a ping enforcer specifically for one server. I made the command from an old amx_hack plugin I found. This is to set the rates that's best for the server so people get the least amount of lag. Now, I don't know how to make the plugin work when people join. As in I want the plugin to enforce the rates on connect. Thanks

Code: (I don;t know how to do the code thing) I'm pretty new to this
Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "amx_rateenforcer"
#define VERSION "1.0"
#define AUTHOR ""


static const CMD_NAME[] = "amx_rateenforcer";

public plugin_init()
{
register_plugin("cmd template" , "0.1" , "default");
register_concmd(CMD_NAME , "exec_player" , ADMIN_RCON , ": <nick,#userid> - rate enforce");
}

public exec_player(id , lvl , cid)
{
if(!cmd_access(id , lvl , cid , 2))
return PLUGIN_HANDLED;

new arg[33];
read_argv(1 , arg , 32);

new pid = cmd_target(id , arg , 9);

if(!pid)
return PLUGIN_HANDLED;





client_cmd(pid , "rate 20000");
client_cmd(pid , "cl_updaterate 66");
client_cmd(pid , "cl_cmdrate 66");


new name[33];
get_user_name(id , name , 32);

console_print(id , "[AMXX] %s rate has been enforced" , name);


return PLUGIN_HANDLED;
}
Revop is offline
Throstur
Senior Member
Join Date: Nov 2004
Location: Iceland
Old 07-13-2006 , 05:48   Re: rate enforce
Reply With Quote #2

here's your code
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Rate Enforcer"                  // I dont know why you're doing #define VERSION "1.0"                       // it this way, I would have #define AUTHOR "Throstur"                   // done it a more efficient way public plugin_init() {     register_plugin(PLUGIN , VERSION , AUTHOR)      // this is what you did //  register_plugin("Rate Enforcer","1.0","Throstur")   // this is what I would have done     register_concmd("amx_enforcerates" , "fnEnforce" , ADMIN_RCON , ": <nick,#userid> - rate enforce")  // You dont need this command     register_clcmd("exec before-enforce.cfg" , "fnHinder") } public client_putinserver(id)           // tells the plugin to enforce the rates soon after the player has connected {     if(access(id,ADMIN_LEVEL_C))        // admin flag "o"         return PLUGIN_HANDLED         set_task(7.5,"fnBackuprates",id)    // backup original rates so that you dont piss off the player     set_task(10.0,"fnEnforcer",id)     return PLUGIN_HANDLED } public client_disconnect(id)            // this might be too late :P who cares {     if(access(id,ADMIN_LEVEL_C))         return PLUGIN_HANDLED         client_cmd(id , "exec before-enforce.cfg")     console_print(id , "Your settings have been returned back to normal.")     return PLUGIN_HANDLED } public fnEnforce(id , lvl , cid)        // again, this WHOLE function, is useless! It does the job but you dont need it {     if(!cmd_access(id , lvl , cid , 2))         return PLUGIN_HANDLED     new arg[33]     read_argv(1 , arg , 32)     new pid = cmd_target(id , arg , 9)     if(!pid)         return PLUGIN_HANDLED     client_cmd(pid , "rate 20000")     client_cmd(pid , "cl_updaterate 66")     client_cmd(pid , "cl_cmdrate 66")     new name[33]     get_user_name(id , name , 32)     console_print(id , "[AMXX] %s has had their rates adjusted." , name)     return PLUGIN_HANDLED } public fnBackuprates(id)        // make rate backups and alert the client {     client_cmd(id , "writecfg before-enforce")     client_print(id , print_chat , "[AMXX] ATTENTION! Your rates have been backed up and changed.")     client_print(id , print_chat , "[AMXX] You may change them back after the game by typing 'exec before-enforce.cfg' in console.") } public fnEnforcer(id)           // enforce the rates {     client_cmd(id , "rate 20000")     client_cmd(id , "cl_updaterate 66")     client_cmd(id , "cl_cmdrate 66") }

I am taking credit as the stuff you did is useless to the plugin.

By the way Only admins with the "o" flag ("abcdefghijklmnopqrstu") will NOT have their rates enforced.
__________________

Last edited by Throstur; 07-13-2006 at 05:53.
Throstur is offline
Send a message via AIM to Throstur Send a message via MSN to Throstur
Revop
Junior Member
Join Date: Jul 2006
Old 07-13-2006 , 14:19   Re: rate enforce
Reply With Quote #3

Thank you, Yeah I did not want credit for this as It was not my code to begin with. Oh, and thank you for explaining everything, it helped a lot to learn more about this code.

Last edited by Revop; 07-13-2006 at 14:27.
Revop is offline
Xtreme111
New Member
Join Date: Oct 2011
Old 10-17-2011 , 14:34   Re: rate enforce
Reply With Quote #4

I know this plugin is old , but can anyone tell me if works ?
Xtreme111 is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 10-17-2011 , 14:41   Re: rate enforce
Reply With Quote #5

Quote:
Originally Posted by Xtreme111 View Post
I know this plugin is old , but can anyone tell me if works ?
Try it?
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
enjoi.
Veteran Member
Join Date: Mar 2011
Old 10-17-2011 , 18:37   Re: rate enforce
Reply With Quote #6

dont tell me you bumped a 5 year thread
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 10-17-2011 , 18:47   Re: rate enforce
Reply With Quote #7

Quote:
Originally Posted by Xtreme111 View Post
I know this plugin is old...
Looks like it.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
Throstur
Senior Member
Join Date: Nov 2004
Location: Iceland
Old 10-17-2011 , 19:55   Re: rate enforce
Reply With Quote #8

who cares, it's written in a language very similar to C, why don't you just learn it and write it yourself if you can't find one that works. Jeez, bumping this old shit, I don't even know if I wrote this or not, in any case it was before I was any good at coding.
__________________
Throstur is offline
Send a message via AIM to Throstur Send a message via MSN to Throstur
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-18-2011 , 00:43   Re: rate enforce
Reply With Quote #9

Quote:
Originally Posted by Xtreme111 View Post
I know this plugin is old , but can anyone tell me if works ?
Don't use this stupid code.
Put in server.cfg sv_minrate XXXX and sv_minupdaterate XXXX so you can force players cvars rate and cl_updaterate to minimum values.
cl_cmdrate will only affect the player using the bad value and not other players.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:46.


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