Raised This Month: $51 Target: $400
 12% 

Kz Cvar Checker - Fps radius


Post New Thread Reply   
 
Thread Tools Display Modes
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
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 03-21-2009 , 07:17   Re: Kz Cvar Checker - Fps radius
Reply With Quote #2

fps_max 99? )))
TheRadiance is offline
Send a message via ICQ to TheRadiance
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-21-2009 , 07:17   Re: Kz Cvar Checker - Fps radius
Reply With Quote #3

This code doesn't work fine, i've posted somewhere a different way to check fps_max cvar (check string instead of convert it to float), search for it.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-21-2009 , 07:25   Re: Kz Cvar Checker - Fps radius
Reply With Quote #4

cant find any other plugin -_-
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-21-2009 , 07:31   Re: Kz Cvar Checker - Fps radius
Reply With Quote #5

It's not a released plugin but a post with the code (may be a thread started by minimiler)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-21-2009 , 07:36   Re: Kz Cvar Checker - Fps radius
Reply With Quote #6

mhm i got this code what in 1st post from minimiller's theard o_O
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-21-2009 , 07:53   Re: Kz Cvar Checker - Fps radius
Reply With Quote #7

Ah yes, sorry, was for developer cvar.

So, just change the check != 101 to !(100 <= value <= 101)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-21-2009 , 08:08   Re: Kz Cvar Checker - Fps radius
Reply With Quote #8

what about dots ?
__________________
xPaw is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 03-21-2009 , 08:20   Re: Kz Cvar Checker - Fps radius
Reply With Quote #9

%.0f -> %.1f
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-21-2009 , 08:42   Re: Kz Cvar Checker - Fps radius
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
Ah yes, sorry, was for developer cvar.

So, just change the check != 101.0 to !(100.0 <= value <= 101.0)
__________________
- 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 01:33.


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