Need some help please -
Gappy - 28.05.2009
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
Re: Need some help please -
Gappy - 28.05.2009
Anyone?
Re: Need some help please -
Jakku - 28.05.2009
If you doublepost, no-one will help you. Even me
Re: Need some help please -
[eLg]Timmy - 28.05.2009
Quote:
Originally Posted by Jakku
If you doublepost, no-one will help you. Even me
|
Because you don't know what the snippet means?
Re: Need some help please -
lol2112 - 28.05.2009
I'm not sure but I think:
Код:
if(strfind(plname, a, true) == -1)
Should be
Код:
if(strcmp(plname, InvalidNames[a], true))
Re: Need some help please -
Badger(new) - 28.05.2009
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
Re: Need some help please -
lol2112 - 28.05.2009
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
|
That wouldn't work...you need InvalidNames[a].
Re: Need some help please -
Gappy - 29.05.2009
Quote:
Originally Posted by lol2112
you need InvalidNames[a].
|
Thanks that worked