AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cl_ speeds (https://forums.alliedmods.net/showthread.php?t=83911)

DarkGod 01-17-2009 12:00

cl_ speeds
 
PHP Code:

#include <amxmodx>

#define PLUGIN "Fix Speed"
#define AUTHOR "DarkGod"
#define VERSION "1.3.3.7"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_connect(id)
{
    
client_cmd(id"cl_forwardspeed 400;alias cl_forwardspeed")
    
client_cmd(id"cl_backspeed 400;alias cl_backspeed")
    
client_cmd(id"cl_sidepeed 400;alias cl_sidespeed")



I'm currently using this so that people won't be able to run crazy fast (I'm using PokeMod so if you got a lvl 99 aerodactyl you can run really fast if you turn up values) however when someone connects they get cl_forwardspeed 400 and locked, cl_backspeed 400 and locked but sidespeed goes to 999 and is locked.

Is there any other method to do this or any fix to this?

Thanks,
DarkGod

ConnorMcLeod 01-17-2009 12:18

Re: cl_ speeds
 
Yes, but you would have to kick them if you detect they had blocked those cvars.
Search a post somewhere i've made a way to check developer cvar.

DarkGod 01-17-2009 12:27

Re: cl_ speeds
 
Found it:
PHP Code:

/*    Copyright © 2009, ConnorMcLeod 

    Developer Check 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 Developer Check; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 

#include <amxmodx> 

#define PLUGIN "Developer Check" 
#define AUTHOR "ConnorMcLeod" 
#define VERSION "0.0.1" 

#define SVC_DISCONNECT    2 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR


public 
client_putinserverid 

    
set_task(0.1"FirstCheck"id


public 
FirstCheck(id

    
CheckClientDeveloper(id


public 
SecondCheck(id

    if( 
is_user_connected(id) ) 
    { 
        
CheckClientDeveloper(id1
    } 


CheckClientDeveloper(idiSecondCheck=0

    static 
szSecondCheck[1
    
szSecondCheck[0] = iSecondCheck 
    query_client_cvar
(id"developer""Developer_Result"1szSecondCheck


public 
Developer_Result(const id, const szCvar[], const szValue[], const Parms[]) 

    static 
iiLen 
    iLen 
strlen(szValue
    for(
i=0i<iLeni++) 
    { 
        if( 
49 <= szValue[i] <= 57 
        { 
            if( 
Parms[0] ) 
            { 
                
kick_user(id,  
"You can't play here with cvar developer different from 0^nPlease remove line ^"alias developer^" from your .cfg"
            } 
            else 
            { 
                static 
szReCheck[1
                
szReCheck[0] = 
                client_cmd
(id"developer 0;alias developer"
                
// 10sec should be enough to avoid lag 
                
set_task(10.0"SecondCheck"id
            } 
            return 
        } 
    } 

    
client_cmd(id"developer 0;alias developer"


kick_user(id, const szKickMsg[]) 

    
emessage_begin(MSG_ONESVC_DISCONNECT_id// oranguntanz 
    
ewrite_string(szKickMsg
    
emessage_end() 


What do I have to alter to make it check cl_ speeds and kick if they are set over 400?

ConnorMcLeod 01-17-2009 12:32

Re: cl_ speeds
 
You can just use my other plugin : http://xtreme-jumps.eu/e107_plugins/...opic.php?99486

butthead 01-18-2009 08:41

Re: cl_ speeds
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Cvar checker"
#define VERSION "1.0"
#define AUTHOR "ButtH3ad"

#pragma semicolon 1

new g_Cheatlog[256];

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
get_time("cheat_log_%d%m%y.log",g_Cheatlog,255);

    
register_forwardFM_StartFrame"forward_startframe");
}

public 
forward_startframe() {
     
    static 
players[32], numidstart_frames;

    
get_players(playersnum"ah");
     
    for (new 
0numi++) {

        
id players[i];
     
        
start_frames++;
          
        if(
start_frames 100) {
               
            if(!
is_user_alive(id))
                return 
FMRES_HANDLED;
              
            
query_client_cvar(id"cl_sidespeed""ClientCvarResult");
            
query_client_cvar(id"cl_forwardspeed""ClientCvarResult");
            
query_client_cvar(id"cl_backspeed""ClientCvarResult");
            
query_client_cvar(id"developer""ClientCvarResult");

            
start_frames 1;
        }
    }
    return 
FMRES_IGNORED;
}

public 
ClientCvarResult(id, const cvar[], const value[]) {

    if((
equal(cvar"cl_sidespeed") && str_to_num(value) != 400)\
    || (
equal(cvar"cl_forwardspeed") && str_to_num(value) != 400)\
    || (
equal(cvar"cl_backspeed") && str_to_num(value) != 400)\
    || (
equal(cvar"developer") && str_to_num(value) != 0)) {
    
        static 
Kick_Cheater[33], UserName[33], Auth[33];
        
        
get_user_name(idUserName32);
        
get_user_authid(idAuth32);
        
        
log_to_file(g_Cheatlog"Check %s change >>>> Nick: %s / steam id: %s /// change to value: %s"cvarUserName[id], Auth[id], value);
        
        
client_cmd(id,"cl_sidespeed 400");
        
client_cmd(id,"cl_forwardspeed 400");
        
client_cmd(id,"cl_backspeed 400");
        
client_cmd(id,"developer 0");
            
        
Kick_Cheater[id]++ ;
        
        if(
Kick_Cheater[id] > 2) {
            
            
log_to_file(g_Cheatlog"Cheater kicked >>>> Nick: %s | %s"UserName[id], Auth[id]);
            
            
server_cmd("amx_kick #%d ^"Play with legal settings!^""get_user_userid(id));
            
            
set_hudmessage(255000.290.1506.012.0);
            
show_hudmessage(0"Player %s is CHEATER, changing default settings cvars : %s to value %s"UserName[id], cvarvalue);
            
            
Kick_Cheater[id] = 0;
        }        
    }
    
    return 
PLUGIN_CONTINUE;




All times are GMT -4. The time now is 01:37.

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