Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => ShowRoom (pawn) => Topic started by: Madara on March 26, 2011, 09:52:57 PM

Title: Kick to Invalid Nick by Madara
Post by: Madara on March 26, 2011, 09:52:57 PM
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  ;)
Title: Re: Kick to Invalid Nick by Madara
Post by: tato on March 26, 2011, 10:00:52 PM
thanks ..well u gave to me first :P i won :DDDD
Title: Re: Kick to Invalid Nick by Madara
Post by: Madara on March 26, 2011, 10:02:07 PM
A LA VERGA!!!  ;D
Title: Re: Kick to Invalid Nick by Madara
Post by: tato on March 26, 2011, 10:32:49 PM
XD diria tu abuela
Title: Re: Kick to Invalid Nick by Madara
Post by: Gamer on March 27, 2011, 04:31:37 AM
Quote from: tato on March 26, 2011, 10:32:49 PM
XD diria tu abuela


REGALA TODO DALE......TOTAL NOS CAGAMOS NOSOTROS
Title: Re: Kick to Invalid Nick by Madara
Post by: yazeen on March 27, 2011, 05:20:31 AM
You Are a Pro scripter Best Of Luck In studing english! ;D
Title: Re: Kick to Invalid Nick by Madara
Post by: tato on March 27, 2011, 06:16:48 PM
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)
Title: Re: Kick to Invalid Nick by Madara
Post by: DivX on March 27, 2011, 06:49:02 PM
Thanks man

;D


very good


(http://i68.servimg.com/u/f68/16/28/53/63/images10.jpg)


Title: Re: Kick to Invalid Nick by Madara
Post by: [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.
Title: Re: Kick to Invalid Nick by Madara
Post by: tato on April 02, 2011, 02:11:02 AM
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.....
Title: Re: Kick to Invalid Nick by Madara
Post by: yazeen on April 08, 2011, 07:03:11 AM
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
Title: Re: Kick to Invalid Nick by Madara
Post by: 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 -.-..
Title: Re: Kick to Invalid Nick by Madara
Post by: yazeen on April 08, 2011, 05:23:04 PM
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

Title: Re: Kick to Invalid Nick by Madara
Post by: BaSSMaN on April 16, 2011, 10:39:32 PM
This already exists, but it still doesn't kick..