Raised This Month: $ Target: $400
 0% 

checking players cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
owned
Member
Join Date: Jul 2007
Old 07-19-2008 , 03:18   checking players cvars
Reply With Quote #1

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?
__________________
MARREC/OWNED = me.
owned is offline
Nepopus
Member
Join Date: Jun 2008
Location: Russia/Moscow
Old 07-20-2008 , 12:49   Re: checking players cvars
Reply With Quote #2

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
__________________
hi maaaaaan
my server here soon

Last edited by Nepopus; 07-20-2008 at 13:19.
Nepopus is offline
Send a message via ICQ to Nepopus Send a message via Skype™ to Nepopus
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 05:33.


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