Raised This Month: $ Target: $400
 0% 

Kz Cvar Checker - Fps radius


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-21-2009 , 07:05   Kz Cvar Checker - Fps radius
Reply With Quote #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(PLUGINVERSIONAUTHOR)
    
register_dictionary("kzcvars.txt")
    
g_iCvarNum sizeof(g_szCvars)
}

public 
client_putinserver(id)
{
    
set_task(0.1"FirstCheck"id)
}

public 
FirstCheck(id)
{
    for(new 
ii<g_iCvarNumi++)
    {
        
CheckClientCvar(idg_szCvars[i])
    }
}

public 
Recheck(parm[])
{
    new 
id parm[0]
    if( 
is_user_connected(id) )
    {
        
CheckClientCvar(idg_szCvars[parm[1]], 1)
    }
}

CheckClientCvar(id, const szCvar[], iSecondCheck=0)
{
    static 
recheck[1]
    
recheck[0] = iSecondCheck
    query_client_cvar
(idszCvar"ClientCvarResult"1recheck)
}

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 
ii<g_iCvarNumi++)
    {
        if( 
equal(szCvarg_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(idszName31)
                        
get_user_authid(idszAuthid19)
                        
log_to_file(szLogFile"<%s><%s><%s><%s>"szNameszAuthidszCvarszValue)
                    
#endif
                    
new szReason[128]
                    
formatex(szReason127"%L"id"KZCVAR_KICK_REASON"szCvarszValueflMaxValszCvar)
                    
kick_user(idszReason)
                }
                else
                {
                    
client_cmd(id"%s %.0f;alias %s"szCvarflMaxValszCvar)
                    new 
parms[2]
                    
parms[0] = id
                    parms
[1] = i
                    set_task
(0.1"Recheck"id+(32*i), parms2)
                }
            }
            else if( !
recheck[0] )
            {
                
client_cmd(id";alias %s"szCvar)
            }
            break
        }
    }
}

kick_user(id, const szKickMsg[])
{
    
emessage_begin(MSG_ONESVC_DISCONNECT_id// oranguntanz
    
ewrite_string(szKickMsg)
    
emessage_end()

__________________
xPaw is offline
 



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 23:49.


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