Hi all, today I will show you a code for those players who kick in your name contains numbers or characters that you want.
Fisrt make the code kick to invalid nick, this function find define characters or number:
public IsInvalidChar(c[])
{
if (strfind(c, "*", true) != -1 || strfind(c, "?", true) != -1 ||
strfind(c, ":", true) != -1 || strfind(c, "<", true) != -1 ||
strfind(c, ">", true) != -1 || strfind(c, "|", true) != -1 ||
strfind(c, "/", true) != -1 || strfind(c, "@", true) != -1 ||
strfind(c, "~", true) != -1 || strfind(c, "{", true) != -1 ||
strfind(c, "}", true) != -1) return 1;
if (IsNumeric(c)) return 1;
else return 0;
return 1;
}
Now, make the code wich function is find in player name a number:
stock IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++) {
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
Follow the function "IsInvalidNick", make a function where kick player if contains number o defiene characters:
public NickPlayerChar(playerid)
{
if(IsInvalidChar(PlayerName(playerid))) {
new str[256];
format(str,256,">> Server Auto-Kick: %s, Razon:[ Nick Invalido ].", PlayerName(playerid));
SendClientMessageToAll(0xFF00FF96,str);
Kick(playerid);
}
}
To finish, usage the function "NickPlayerChar" and put in "OnplayerConnect", this's if the player when he is entering the server:
public OnPlayerConnect(playerid)
{
NickPlayerChar(playerid);
return 1;
}
Now define function consulte player name from id:
public PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid,name,24);
return name;
}
- OPTION 2 -
If you can not put this function on the server, you can choose to download my filterscript InvalidNicks.
DOWNLOAD:[FS]Invalid Nicks to Megaupload (http://www.megaupload.com/?d=73TNV8J7) && [FS]Invalid Nicks to Mediafire (http://www.mediafire.com/?gz69b5cl35io8z5)
I hope you like this feature for future uses they want to give.
Credits: YO ( Madara ).
Greetings ;)
thanks ..well u gave to me first :P i won :DDDD
A LA VERGA!!! ;D
XD diria tu abuela
Quote from: tato on March 26, 2011, 10:32:49 PM
XD diria tu abuela
REGALA TODO DALE......TOTAL NOS CAGAMOS NOSOTROS
You Are a Pro scripter Best Of Luck In studing english! ;D
Quote from: yazeen on March 27, 2011, 05:20:31 AM
You Are a Pro scripter Best Of Luck In studing english! ;D
8) 8)
Thanks man
;D
very good
(http://i68.servimg.com/u/f68/16/28/53/63/images10.jpg)
hummm
lo hise tal kual y me salen estos errores ... (algo tengo mal jejeje)
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(313) : error 017: undefined symbol "NickPlayerChar"
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(2879) : error 021: symbol already defined: "IsNumeric"
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(4315) : error 025: function heading differs from prototype
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(4315) : error 021: symbol already defined: "IsNumeric"
Pawn compiler 3.0.3367 Copyright (c) 1997-2005, ITB CompuPhase
4 Errors.
Quote from: [CHG].Vercetty. on April 02, 2011, 12:20:14 AM
hummm
lo hise tal kual y me salen estos errores ... (algo tengo mal jejeje)
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(313) : error 017: undefined symbol "NickPlayerChar"
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(2879) : error 021: symbol already defined: "IsNumeric"
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(4315) : error 025: function heading differs from prototype
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(4315) : error 021: symbol already defined: "IsNumeric"
Pawn compiler 3.0.3367 Copyright (c) 1997-2005, ITB CompuPhase
4 Errors.
mm you need to define thos nickplayer.....
Quote from: [CHG].Vercetty. on April 02, 2011, 12:20:14 AM
hummm
lo hise tal kual y me salen estos errores ... (algo tengo mal jejeje)
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(313) : error 017: undefined symbol "NickPlayerChar"
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(2879) : error 021: symbol already defined: "IsNumeric"
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(4315) : error 025: function heading differs from prototype
F:\Servers\Vice City\DMGM Scripts Version 3.5\gamemodes\DMGM3.5.pwn(4315) : error 021: symbol already defined: "IsNumeric"
Pawn compiler 3.0.3367 Copyright (c) 1997-2005, ITB CompuPhase
4 Errors.
Please Speak English
It's not working, it works well in script but it doesn't kick invalid nicks when you join..
When you fix it, you get " error : undefined symbol "IsNumeric" " even i have isnumeric defined -.-..
Quote from: BaSSMaN on April 08, 2011, 10:28:11 AM
It's not working, it works well in script but it doesn't kick invalid nicks when you join..
When you fix it, you get " error : undefined symbol "IsNumeric" " even i have isnumeric defined -.-..
Hmm i dont think you have added Try to add these on bottom of the script
isnumeric(const string[])
{// mike's function
for (new i = 0, j = strlen(string); i < j; i++) { if (string[i] > '9' || string[i] < '0') return 0; }
return 1;
}
You Might Have Forgotten this line
stock IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string[i] > '9' || string[i] < '0') return 0; return 1; }
Hope it helped ;D
This already exists, but it still doesn't kick..