SA-MP Forums Archive
Everybody can use this command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Everybody can use this command (/showthread.php?tid=243498)



Everybody can use this command - Julian12345 - 23.03.2011

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?


AW: Everybody can use this command - Pablo Borsellino - 23.03.2011

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



AW: Everybody can use this command - Julian12345 - 23.03.2011

Hmm, still the same problem.

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


Re: Everybody can use this command - Biesmen - 23.03.2011

How did you define 'user'?


Re: Everybody can use this command - Jeffry - 23.03.2011

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


Re: Everybody can use this command - Biesmen - 23.03.2011

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.


Re: Everybody can use this command - Jeffry - 23.03.2011

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



AW: Re: Everybody can use this command - Julian12345 - 23.03.2011

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.


AW: Everybody can use this command - Julian12345 - 23.03.2011

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?


Re: Everybody can use this command - Gamer_Z - 23.03.2011

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


AW: Everybody can use this command - Julian12345 - 23.03.2011

Ok, works, thank you!