Raised This Month: $ Target: $400
 0% 

How to disconnect someone if they have a specified setinfo?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 08-12-2010 , 16:00   How to disconnect someone if they have a specified setinfo?
Reply With Quote #1

How do I make the server disconnect someone who has a specified setinfo (for example setinfo _ttt 15 or setinfo _pw 2250)?
So if someone with setinfo _pw 2250 joins, they get disconnected?

I tried something but it doesn't work
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-12-2010 , 16:07   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #2

When they join, get the setinfo value and then if it equals the value you want, disconnect them
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 08-12-2010 , 16:47   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #3

But how?
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
tm.
Member
Join Date: Apr 2010
Old 08-12-2010 , 17:22   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #4

PHP Code:
public client_authorized(id)
{
    static const 
Info[] = "_pw"
    
static Value[32]
    
    
get_user_info(idInfoValuecharsmax(Value))
    
    if(
strlen(Value) && equal(Value"2250"))
        
client_cmd(id"disconnect")

tm. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-12-2010 , 23:10   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #5

Why do people avoid the actual kick command?

PHP Code:
server_cmd("kick #%d"get_user_userid(id)) 
You can also add a message to it.
__________________
fysiks is offline
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 08-13-2010 , 08:32   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #6

Ok this works but only for _pw. If I put anything else (example _gd) it doesn't work.
And how do I make the server ban and not kick? Tried banid but it doesn't work
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
tm.
Member
Join Date: Apr 2010
Old 08-13-2010 , 13:01   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #7

Not really sure, but this should work:
PHP Code:
// add here any setinfo string you want to check
new const g_Info[][] =
{
    
"_ttt",
    
"_pw",
    
"_other"
}
// add here the values for which the player gets banned
new const g_BannedValues[][] =
{
    
"15",
    
"2250",
    
"100"
}

..........................

public 
client_authorized(id)
{
    static 
Value[32]

    for(new 
isizeof(g_Info); i++)
    {
        
get_user_info(idg_Info[i], Valuecharsmax(Value))

        if(
strlen(Value))
        {
            for(new 
jsizeof(g_BannedValues); j++)
            {
                if(
equal(Valueg_BannedValues[j]))
                {
                    static 
authid[20]
                    
get_user_authid(idauthidcharsmax(authid))

                    
server_cmd("kick #%i ^"Reason^"; wait; banid 0 ^"%s^"; wait; writeid"get_user_userid(id), authid)
                }
            }
        }
    }

tm. is offline
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 08-13-2010 , 13:37   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #8

Still only works with _pw. Have no idea why.
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-13-2010 , 14:05   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #9

Because you need to set the info somewhere ?
Because players config.cfg are read only so the setinfo is not save, but _pw was there and was existing before ?
Try to think a bit.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 08-13-2010 , 15:04   Re: How to disconnect someone if they have a specified setinfo?
Reply With Quote #10

No. setinfo _ttt 15 was in my config.cfg and it didn't kick me
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
Reply


Thread Tools
Display Modes

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 21:59.


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