AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Checking "developer" (https://forums.alliedmods.net/showthread.php?t=94374)

anakin_cstrike 06-10-2009 13:32

Checking "developer"
 
Code:
#include <amxmodx> #define PLUGIN "No Developer" #define VERSION "1.0" #define AUTHOR "aNNakin" #define minutes   0 public plugin_init ( )    register_plugin ( PLUGIN, VERSION, AUTHOR ); public client_putinserver ( id )    if ( ! is_user_bot ( id ) )       query_client_cvar ( id, "developer", "cvar_result_func" );       public client_command ( id )    query_client_cvar ( id, "developer", "cvar_result_func" );     public cvar_result_func ( id, const cvar[], const value[] ) {    new i_Value = str_to_num ( value );    if ( i_Value == 1 )    {       new s_Ip[ 22 ];       get_user_ip ( id, s_Ip, 21, 1 );             server_cmd ( "kick #%d ^"Developer^";wait;addip ^"%s^" ^"%s^";wait;writeip", get_user_userid ( id ), minutes, s_Ip );    } }

It doesn't work, wtf..
PS: don't say why i didn't check the arg. @ client_command (i know i should have)

joaquimandrade 06-10-2009 13:40

Re: Checking "developer"
 
Where it doesn't work?

I guess you are thinking that this:

PHP Code:

public client_command id )
    
query_client_cvar id"developer""cvar_result_func" ); 

is enough to detect a cvar change but it isn't.

I tested your code and it works as it should.

Arkshine 06-10-2009 13:41

Re: Checking "developer"
 
It works for me.

ConnorMcLeod 06-10-2009 14:17

Re: Checking "developer"
 
Also, you would have better to check the returned string, not convert it to float or integer. Check if the string contain other chars than '0' and more than one '.'

End, will work better if you delay by 0.1 from putinserver:

PHP Code:

/*    Formatright © 2009, ConnorMcLeod

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

#include <amxmodx>

#define VERSION "0.0.1"

public plugin_init ( )
{
    
register_plugin("Developer Checker"VERSION"ConnorMcLeod")
}

public 
client_putinserver(id)
{
    if( !
is_user_bot(id) )
    {
        
set_task(0.1"Init_Checks"id)
    }
}

public 
Init_Checks(id)
{
    
query_client_cvar(id"developer""Developer_Result")
}
   
public 
Developer_Result(id, const szCvar[], const szValue[])
{
    if( 
is_user_connected(id) )
    {
        static 
iLeniPointCountci

        iLen 
strlen(szValue)
        
iPointCount 0

        
for(i=0i<iLeni++)
        {
            
szValue[i]
            if( 
!= 48 )
            {
                if( 
== 46 )
                {
                    if( ++
iPointCount )
                    {
                        
kick_user(id)
                    }
                }
                else
                {
                    
kick_user(id)
                }
            }
        }
        
query_client_cvar(id"developer""Developer_Result")
    }
}

kick_user(id)
{
    static const 
szKickMsg[] = "You can't play here with cvar developer different from 0"

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



znovit 06-11-2009 09:20

Re: Checking "developer"
 
This will work :)
PHP Code:

#include <amxmodx>
 
#define POPUP_DELAY 1.0
 
new ChangedSettings[][] =
{
        
"fps_max 101",
        
"developer 0"
};
 
new 
Title[128] = "To play here you must accept these settings:";
new 
Yes[] = "Yes (Your settings will be changed)";
new 
No[] = "No (You will be kicked)";
new 
KickReason[] = "You were kicked because you got illegal settings.";
 
public 
plugin_init()
{
        
register_plugin("Settings Pop-Up""1.1""hleV");
 
        for (new 
Num 0Num sizeof(ChangedSettings); Num++)
                
format(Title127"%s^n%s"TitleChangedSettings[Num]);
}
 
public 
client_putinserver(Cl)
        
set_task(POPUP_DELAY"ShowMenu"Cl);
 
public 
ShowMenu(Cl)
{
        new 
Menu menu_create(Title"MenuChoice");
 
        
menu_additem(MenuYes);
        
menu_additem(MenuNo);
 
        
menu_setprop(MenuMPROP_PERPAGE0);
        
menu_setprop(MenuMPROP_EXITMEXIT_NEVER);
 
        
menu_display(ClMenu0);
}
 
public 
MenuChoice(ClMenuItem)
{
        switch (++
Item)
        {
                case 
1:
                        for (new 
Num 0Num sizeof(ChangedSettings); Num++)
                                
client_cmd(ClChangedSettings[Num]);
                case 
2:
                        
server_cmd("kick #%d ^"%s^""get_user_userid(Cl), KickReason);
        }
 
        
menu_destroy(Menu);



ConnorMcLeod 06-11-2009 11:29

Re: Checking "developer"
 
Quote:

Originally Posted by znovit (Post 846289)
This will work :)

No, player can just accept and change their setting right after.

anakin_cstrike 06-11-2009 11:50

Re: Checking "developer"
 
I want to check the value not to set it.
EDIT: I've made that for a friend of mine and he told me that it didn't worked, no tested by me though.

satanovsyn 08-02-2009 07:38

Re: Checking "developer"
 
Yes can anybody paste here code, where I can check how client has set cvars?

For example:

developer
fps_max
max_smokepuffs
...


All times are GMT -4. The time now is 13:49.

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