Raised This Month: $ Target: $400
 0% 

Checking "developer"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 06-10-2009 , 13:32   Checking "developer"
Reply With Quote #1

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)
__________________

anakin_cstrike is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-10-2009 , 13:40   Re: Checking "developer"
Reply With Quote #2

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.
__________________
joaquimandrade is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-10-2009 , 13:41   Re: Checking "developer"
Reply With Quote #3

It works for me.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-10-2009 , 14:17   Re: Checking "developer"
Reply With Quote #4

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()

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-10-2009 at 15:25.
ConnorMcLeod is offline
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-11-2009 , 09:20   Re: Checking "developer"
Reply With Quote #5

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);

__________________
znovit is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-11-2009 , 11:29   Re: Checking "developer"
Reply With Quote #6

Quote:
Originally Posted by znovit View Post
This will work
No, player can just accept and change their setting right after.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-11-2009 at 11:32.
ConnorMcLeod is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 06-11-2009 , 11:50   Re: Checking "developer"
Reply With Quote #7

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.
__________________


Last edited by anakin_cstrike; 06-11-2009 at 16:01.
anakin_cstrike is offline
satanovsyn
Member
Join Date: May 2007
Old 08-02-2009 , 07:38   Re: Checking "developer"
Reply With Quote #8

Yes can anybody paste here code, where I can check how client has set cvars?

For example:

developer
fps_max
max_smokepuffs
...
satanovsyn 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 13:48.


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