AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   name/kick (https://forums.alliedmods.net/showthread.php?t=50402)

Pamaliska 01-25-2007 14:03

name/kick
 
What is wrong with this code, it is only kicking people with names like "[Cheater] Nick", but I want it to kick players with "[Cheater]Nick"; when they connect and in-game.


Code:

please see the code below

SSJ2GOKU 01-25-2007 18:43

Re: name/kick
 
the part containing the switch is never executed, because you close way too much methods

"} } }" the ones after the "return"

post the whole code pls because now it looks like you only showed a tiny bit and it ain't even parts that follow each other due to the "}"

Pamaliska 01-25-2007 19:21

Re: name/kick
 
*Re-opened*
Any suggstions, because I am clueless. It kicks players with [Cheater]Nick, but it also kicks players with such names as [clan tag]^Nick, or Nick@; why is it happening, the code shoud not check for special signs, but it does and kicks them.

Code:

  register_plugin(PLUGIN, VERSION, AUTHOR)
}
public kick(id)
{
        server_cmd("kick #%d ^"MY MESSAGE^"", get_user_userid(id))
}
public client_infochanged(id)
    {
        new name[32]
        get_user_name(id, name, 31)
        if(containi(name, "Cheater") != -1)
{
            kick(id)
            return
}
        new i, c
        while((c = name[i++]))
        {
                switch(c)
                {
                        case 33, 35, 36, 37, 38, 40, 41, 42, 64, 94, 123, 125:
                        {
                                kick(id)
                                return
                        }
                }
        }
}

P.S. that is the complete piece of code.

SSJ2GOKU 01-26-2007 15:23

Re: name/kick
 
ill take a look for it

so you want to kick players with the name [Cheater]xxxxxxxxxxxxxxxxx
xxxx = their nickname

and not the players with the name [Cheater]^xxxxxxxxxxxx

right?

Pamaliska 01-27-2007 05:46

Re: name/kick
 
That is correct. Right now it even kicks players with such nicks as Johny@ or [Masters]^Stewart. I want to kick player only if their nick looks like this one: [Cheater]xxxxxxxx, not like [Cheater] xxxxxxx, or a nick with any special character. I am not even checking for any special characters.

Cheers.

s p l i t 01-28-2007 16:13

Re: name/kick
 
Code:
new name[32] get_user_name(id, name, 31) if(name[0]='[' && name[1]='C' && name[2]='h' && name[3]='e' && name[4]='a' && name[5]='t' && name[6]='e' && name[7]='r' && name[8]=']' ){    //... }

Pamaliska 01-28-2007 16:19

Re: name/kick
 
I'll try it right now.

warning 211:possibly unintended assignment
warning 211:possibly unintended assignment
error 022: must be lvalue (non-constant)
error 022: must be lvalue (non-constant)
error 022: must be lvalue (non-constant)
fatal error 107: too many error messages on one line

Emp` 01-28-2007 16:34

Re: name/kick
 
Code:
new name[32] get_user_name(id, name, 31) if(name[0]=='[' && name[1]=='C' && name[2]=='h' && name[3]=='e' && name[4]=='a' && name[5]=='t' && name[6]=='e' && name[7]=='r' && name[8]==']' ){    //... }

:wink: split

Pamaliska 01-28-2007 18:13

Re: name/kick
 
Quote:

Originally Posted by Emp` (Post 432846)
Code:
new name[32] get_user_name(id, name, 31) if(name[0]=='[' && name[1]=='C' && name[2]=='h' && name[3]=='e' && name[4]=='a' && name[5]=='t' && name[6]=='e' && name[7]=='r' && name[8]==']' ){    //... }

:wink: split

error 054: unmatched closing brace
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 021: symbol already defined: "kick"
error 054: unmatched closing brace
warning 203: symbol is never used: "c"
warning 203: symbol is never used: "i"

s p l i t 01-28-2007 19:05

Re: name/kick
 
aha, thanks emp

pamaliska, it should work fine. Post your whole code.


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

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