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")
}