AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to disconnect someone if they have a specified setinfo? (https://forums.alliedmods.net/showthread.php?t=135096)

Desikac 08-12-2010 16:00

How to disconnect someone if they have a specified setinfo?
 
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 :(

YamiKaitou 08-12-2010 16:07

Re: How to disconnect someone if they have a specified setinfo?
 
When they join, get the setinfo value and then if it equals the value you want, disconnect them

Desikac 08-12-2010 16:47

Re: How to disconnect someone if they have a specified setinfo?
 
But how?

tm. 08-12-2010 17:22

Re: How to disconnect someone if they have a specified setinfo?
 
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")



fysiks 08-12-2010 23:10

Re: How to disconnect someone if they have a specified setinfo?
 
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.

Desikac 08-13-2010 08:32

Re: How to disconnect someone if they have a specified setinfo?
 
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 :(

tm. 08-13-2010 13:01

Re: How to disconnect someone if they have a specified setinfo?
 
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)
                }
            }
        }
    }



Desikac 08-13-2010 13:37

Re: How to disconnect someone if they have a specified setinfo?
 
Still only works with _pw. Have no idea why.

ConnorMcLeod 08-13-2010 14:05

Re: How to disconnect someone if they have a specified setinfo?
 
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.

Desikac 08-13-2010 15:04

Re: How to disconnect someone if they have a specified setinfo?
 
No. setinfo _ttt 15 was in my config.cfg and it didn't kick me


All times are GMT -4. The time now is 21:59.

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