Everybody can use this command
#1

Hello.

I have an IRC Admin system. Every command is protected with the following code, so only "NICK" can use this command.

pawn Код:
if(strfind(user,"NICK",true,0)!= -1)
Now I have a problem, when an IRC user changes his name to "NICK1" etc, he can also use this command.

So, if a player has "NICK" in his username, he can use this command, somebody know how to do it that only I can use this?
Reply
#2

if(!strfind(user,"NICK",true,0)!= -1)
You forgott the ! But use:
if(!strfind(user,"NICK"))
Reply
#3

Hmm, still the same problem.

I tested it with the username "NICK|TEST" and he could use the commands.
Reply
#4

How did you define 'user'?
Reply
#5

pawn Код:
if(!strcmp(user,"NICK"))
{
    //Your admin command....
}
Greetz!
Reply
#6

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
pawn Код:
if(!strcmp(user,"NICK"))
{
    //Your admin command....
}
Greetz!
He wants strfind.
This will only work for players with the name Nick, but he means a name containing nick. Example: TheNickIsHere. He wants that to be 'disabled', or somehting.
Reply
#7

Quote:
Originally Posted by Julian12345
Посмотреть сообщение
Hmm, still the same problem.

I tested it with the username "NICK|TEST" and he could use the commands.
Quote:
Originally Posted by Biesmen
Посмотреть сообщение
but he means a name containing nick. Example: TheNickIsHere.
I have understood it like this, that only NICK can use it, and nobody else.
Let's wait for him, to explain it better, if this is wrong. ^^
Reply
#8

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
I have understood it like this, that only NICK can use it, and nobody else.
Let's wait for him, to explain it better, if this is wrong. ^^
You're right Jeffry, I will try yours in a few minutes.
Reply
#9

Ok, it works Jeffry, but I have another question:

I wanted to put in 2 other user, so I tried this:

pawn Код:
if(!strcmp(user,"NICK1" || !strcmp(user,"NICK2" || !strcmp(user,"NICK3"))
and I get an error:

pawn Код:
error 001: expected token: "-string end-", but found "-identifier-"
Maybe the code is wrong?
Reply
#10

if(!strcmp(user,"NICK1") || !strcmp(user,"NICK2") || !strcmp(user,"NICK3"))
Reply
#11

Ok, works, thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)