|
Retired AMX Mod X Moderator
|

03-21-2009
, 07:05
Kz Cvar Checker - Fps radius
|
#1
|
Hello, i'm using this code below, it works fine, but if i join with fps_max 100, it will kick me and set fps_max 101. with this stupid dot, so i will not able to join, could someone fix this dot and allow 100-101 fps to join?
PHP Code:
/* Copyright © 2008, ConnorMcLeod
Check Kz Players Cvars is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Check Rates; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#define PLUGIN "Check Kz Players Cvars"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.1.3"
#define _LOG
#define SVC_DISCONNECT 2
#define NULL_FLOAT 0.000000
#define MAX_FPSMAX 101.0
#define MAX_SPEED 400.0
new const g_szCvars[][] = {"developer", "fps_max" , "fps_modem", "cl_sidespeed", "cl_forwardspeed", "cl_backspeed"}
new const Float:g_flCvarsValues[] = {NULL_FLOAT , MAX_FPSMAX, NULL_FLOAT, MAX_SPEED , MAX_SPEED , MAX_SPEED }
new g_iCvarNum
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_dictionary("kzcvars.txt")
g_iCvarNum = sizeof(g_szCvars)
}
public client_putinserver(id)
{
set_task(0.1, "FirstCheck", id)
}
public FirstCheck(id)
{
for(new i; i<g_iCvarNum; i++)
{
CheckClientCvar(id, g_szCvars[i])
}
}
public Recheck(parm[])
{
new id = parm[0]
if( is_user_connected(id) )
{
CheckClientCvar(id, g_szCvars[parm[1]], 1)
}
}
CheckClientCvar(id, const szCvar[], iSecondCheck=0)
{
static recheck[1]
recheck[0] = iSecondCheck
query_client_cvar(id, szCvar, "ClientCvarResult", 1, recheck)
}
public ClientCvarResult(id, const szCvar[], const szValue[], const recheck[])
{
#if defined _LOG
static const szLogFile[] = "KzPlayersCvars.log"
#endif
if( equal(szValue, "Bad CVAR request") )
{
#if defined _LOG
log_to_file(szLogFile, "%s is not a (catchable) client cvar", szCvar)
#endif
return
}
for(new i; i<g_iCvarNum; i++)
{
if( equal(szCvar, g_szCvars[i]) )
{
new Float:flMaxVal = g_flCvarsValues[i]
if( str_to_float(szValue) != flMaxVal )
{
if( recheck[0] )
{
#if defined _LOG
new szName[32], szAuthid[20]
get_user_name(id, szName, 31)
get_user_authid(id, szAuthid, 19)
log_to_file(szLogFile, "<%s><%s><%s><%s>", szName, szAuthid, szCvar, szValue)
#endif
new szReason[128]
formatex(szReason, 127, "%L", id, "KZCVAR_KICK_REASON", szCvar, szValue, flMaxVal, szCvar)
kick_user(id, szReason)
}
else
{
client_cmd(id, "%s %.0f;alias %s", szCvar, flMaxVal, szCvar)
new parms[2]
parms[0] = id
parms[1] = i
set_task(0.1, "Recheck", id+(32*i), parms, 2)
}
}
else if( !recheck[0] )
{
client_cmd(id, ";alias %s", szCvar)
}
break
}
}
}
kick_user(id, const szKickMsg[])
{
emessage_begin(MSG_ONE, SVC_DISCONNECT, _, id) // oranguntanz
ewrite_string(szKickMsg)
emessage_end()
}
__________________
|
|