Need some help please
#1

I'm trying to make this kick a player when they connect with an InvalidName

This is what i have:

pawn Код:
new InvalidNames[] =
{
  "Britney_Spears",
  "Mr_Bean",
  "Fuck_Admins"
};
pawn Код:
public OnPlayerConnect(playerid)
{
   new plname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, plname, sizeof(plname));
   for(new a = 0; a < sizeof(InvalidNames); a++)
   {
      if(strfind(plname, a, true) == -1)
      {
         new string[256];
         format(string, sizeof(string), "No. You are not '%s'", plname);
         SendClientMessage(playerid, COLOR_LIGHTRED, string);
         Kick(playerid);
         return 1;
      }
   }
}
But I get this error and warning:

pawn Код:
(2586) : error 035: argument type mismatch (argument 2)
(42345) : warning 203: symbol is never used: "InvalidNames"
line 2586 is
pawn Код:
if(strfind(plname, a, true) == -1)
and line 42345 isn't even in my script, the last line in my script is 42344
Reply
#2

Anyone?
Reply
#3

If you doublepost, no-one will help you. Even me
Reply
#4

Quote:
Originally Posted by Jakku
If you doublepost, no-one will help you. Even me
Because you don't know what the snippet means?
Reply
#5

I'm not sure but I think:

Код:
if(strfind(plname, a, true) == -1)
Should be

Код:
if(strcmp(plname, InvalidNames[a], true))
Reply
#6

the warning is because you never InvalidNames for a specific purpose, you just get the size of them. thats why it's on the line after your last line.

also people who post telling people to not double post because their post is slowly going to the back of the scripting discussion forum, are actually spamming. these people have a reason for double posting, so stfu.

also, you do realise that:
pawn Код:
if(strfind(plname, a, true) == -1)
will check to see if it doesnt find it.

i'm not too good with grouped arrays, but I'd attemp it like this:
pawn Код:
if(strfind(plname,InvalidNames[],true)==0)
//then all the kicking and annoucing it
Reply
#7

But why are you using strfind?? That means players can't even have names like: "Hi I'm Mr_Bean AKA Rowan"...

Whereas strcmp would allow it.

Quote:

i'm not too good with grouped arrays, but I'd attemp it like this:
PAWN Code:

if(strfind(plname,InvalidNames[],true)==0)
//then all the kicking and annoucing it

Код:
InvalidNames[]
That wouldn't work...you need InvalidNames[a].


Reply
#8

Quote:
Originally Posted by lol2112
you need InvalidNames[a].
Thanks that worked
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)