Raised This Month: $ Target: $400
 0% 

How to block cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-01-2009 , 13:45   Re: How to block cvars
Reply With Quote #1

Just make a plugin that does:
Code:
public plugin_init() {     register_concmd("amx_cvar", "CmdCvar", ADMIN_CVAR); } public CmdCvar(client, level, cid) {     if( !cmd_access(client, level, cid, 2) ) return PLUGIN_HANDLED_MAIN;         new cvar[32];     read_argv(1, cvar, sizeof(cvar) - 1);         if( equali(cvar, "your_blocked_cvar") )     {         // cvar is blocked         return PLUGIN_HANDLED;     }         return PLUGIN_HANDLED_MAIN; }

And place it at the top of the plugins.ini
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
s0s0
Junior Member
Join Date: Oct 2012
Location: VEN
Old 02-23-2013 , 23:51   Re: How to block cvars
Reply With Quote #2

Quote:
Originally Posted by Exolent[jNr] View Post
Just make a plugin that does:
Code:
public plugin_init() {     register_concmd("amx_cvar", "CmdCvar", ADMIN_CVAR); } public CmdCvar(client, level, cid) {     if( !cmd_access(client, level, cid, 2) ) return PLUGIN_HANDLED_MAIN;         new cvar[32];     read_argv(1, cvar, sizeof(cvar) - 1);         if( equali(cvar, "your_blocked_cvar") )     {         // cvar is blocked         return PLUGIN_HANDLED;     }         return PLUGIN_HANDLED_MAIN; }

And place it at the top of the plugins.ini
Over 1 cvar, no change allowed. The code would be correct?

PHP Code:
public plugin_init()
{
    
register_concmd("amx_cvar""CmdCvar"ADMIN_CVAR);
}

public 
CmdCvar(clientlevelcid)
{
    if( !
cmd_access(clientlevelcid2) ) return PLUGIN_HANDLED_MAIN;
    
    new 
cvar[32];
    
read_argv(1cvarsizeof(cvar) - 1);
    
    if( 
equali(cvar"sv_password","mp_friendlyfire","sv_restart","sv_voiceenable","sv_gravity") )
    {
        
// cvar is blocked
        
return PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED_MAIN;

__________________
s0s0 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-24-2013 , 00:16   Re: How to block cvars
Reply With Quote #3

No. You need to see how equali is used correctly. It can only compare two strings to each other. So, you have to do it for every one and join them with logical OR.
__________________

Last edited by fysiks; 02-24-2013 at 00:17.
fysiks 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:52.


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