SA-MP Forums Archive
Unaccpetable names - 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: Unaccpetable names (/showthread.php?tid=215881)



Unaccpetable names - Fool - 24.01.2011

Yeah, I was Wondering if i can Look for names and Kick The Players Names.

Here:

pawn Код:
new ForbiddenNames[][5] =
{
 "1", "2", "3", "4", "5"
};
Then On Player Connection....
pawn Код:
for(new i = 0; i < sizeof(ForbiddenNames); i ++ )
{
if(!strcmp(name, i, true))
{
SendClientMessage(playerid, 0xFF0000FF, "SERVER: Unacceptable Name");
SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have Been Banned.");
Ban(playerid);

}
Am i Missing Something?
Bracket?


Re: Unaccpetable names - blackwave - 24.01.2011

ya, just one thing:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < sizeof(ForbiddenNames); i ++ )
{
if(!strcmp(name, i, true))
{
SendClientMessage(playerid, 0xFF0000FF, "SERVER: Unacceptable Name");
SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have Been Banned.");
Ban(playerid);

}



AW: Unaccpetable names - Nero_3D - 24.01.2011

I declared the array as constant (constant variables are handled faster than normal variables)
pawn Код:
stock const ForbiddenNames[][] =
{
 "1", "2", "3", "4", "5"
};
You forgot the second closing bracket and the forbidden names in strcmp
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
for(new i; i != sizeof(ForbiddenNames); i ++ )
{
    if(!strcmp(name, ForbiddenNames[i], true))
    {
        SendClientMessage(playerid, 0xFF0000FF, "SERVER: Unacceptable Name");
        SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have Been Banned.");
        Ban(playerid);
        break;
    }
}



Nero_3D - Fool - 24.01.2011

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
I declared the array as constant (constant variables are handled faster than normal variables)
pawn Код:
stock const ForbiddenNames[][] =
{
 "1", "2", "3", "4", "5"
};
You forgot the second closing bracket and the forbidden names in strcmp
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
for(new i; i != sizeof(ForbiddenNames); i ++ )
{
    if(!strcmp(name, ForbiddenNames[i], true))
    {
        SendClientMessage(playerid, 0xFF0000FF, "SERVER: Unacceptable Name");
        SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have Been Banned.");
        Ban(playerid);
        break;
    }
}
Thanks, Nero.


Re: Unaccpetable names - Fool - 24.01.2011

EDIT Not working:
line: 4276

pawn Код:
for(new i; i != sizeof(ForbiddenNames); i ++ )
Errors:
pawn Код:
CR.pwn(4276) : error 017: undefined symbol "ForbiddenNames"
CR.pwn(4276) : error 036: empty statement
CR.pwn(4276) : error 017: undefined symbol "i"
CR.pwn(4276) : fatal error 107: too many error messages on one line



Re: Unaccpetable names - Mean - 24.01.2011

You deleted:
pawn Код:
stock const ForbiddenNames[][] =
{
    "1", "2", "3", "4", "5"
};
?
Put it back if you did!


Re: Unaccpetable names - Fool - 24.01.2011

Quote:
Originally Posted by Mean
Посмотреть сообщение
You deleted:
pawn Код:
stock const ForbiddenNames[][] =
{
    "1", "2", "3", "4", "5"
};
?
Put it back if you did!
the wrong thing i did, was to add it at the end of the script, never mind i got it to work.