AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   checking players cvars (https://forums.alliedmods.net/showthread.php?t=74450)

owned 07-19-2008 03:18

checking players cvars
 
I'm trying to check to see if a players forward, side and back speeds are default, 400, to enable true legal settings on a kz server.

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "KZ Speed Checks"
#define VERSION "1.0"
#define AUTHOR "owned [MLG]"

#define DEFAULT_SPEED "400"

new speed 1;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
set_task(3.0,"check_speeds",PLUGIN_CONTINUE,"",0,"b");
}

public 
check_speeds(id){
    new 
name[32];
    
get_user_name(id,name,31);
    
    if(
speed == 4){
        
query_client_cvar(id,"cl_forwardspeed","speed_check");
        
speed 1;
    }else {
        if(
speed == 1){
            
query_client_cvar(id,"cl_forwardspeed","speed_check");
            
speed += 1;
        }
        
        if(
speed == 2){
            
query_client_cvar(id,"cl_sidespeed","speed_check");
            
speed += 1;
        }
        
        if(
speed == 3){
            
query_client_cvar(id,"cl_backspeed","speed_check");
            
speed += 1;
        }
    }
}

public 
speed_check(id, const cvar, const value[]){
    if(
value[0] != 400){
        new 
name[32];
        
get_user_name(id,name,31);
        
        
client_print(0,print_chat,"[MLG] %s has been kicked for having a non default %s"namecvar);
        
        
server_cmd("banid 1 #%d"id);
        
client_cmd(id"echo ^"[MLGSorry but you do not have legal speeds^"; disconnect")
    }


any ideas?

Nepopus 07-20-2008 12:49

Re: checking players cvars
 
PHP Code:

#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "KZ Speed Checks" 
#define VERSION "1.0" 
#define AUTHOR "owned [MLG]" 

public plugin_init() { 
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task(30.0"check_speeds"0""0"b")
    return 
PLUGIN_CONTINUE


public 
check_speeds() {
    
    new 
players[32
    new 
playersnum 
    
new id 
    get_players
(playersplayersnum"c"
    for(new 
0playersnumi++) { 
        
        
id players[i
        
query_client_cvar(id"cl_forwardspeed""speed_check")
        
query_client_cvar(id"cl_sidespeed""speed_check")
        
query_client_cvar(id"cl_backspeed""speed_check")
    }
    return 
PLUGIN_CONTINUE 


public 
speed_check(idcvar[], value[]) { 
    
    if(!
equal(value"400")) {
        
        new 
name[32]
        
get_user_name(idname31)
        
client_print(0print_chat"[MLG] %s has been kicked for having a non default %s"namecvar)
        
server_cmd("banid 1 #%d"id)
        
client_cmd(id"echo ^"[MLGSorry but you do not have legal speeds^"; disconnect"
        return 
PLUGIN_HANDLED 
    

    return 
PLUGIN_CONTINUE 


i dont have much exp, but i think it must be something like that
final version :D


All times are GMT -4. The time now is 05:33.

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