• Welcome to Vice City Multiplayer.
 

Kick to Invalid Nick by Madara

Started by Madara, March 26, 2011, 08:52:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madara

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 && [FS]Invalid Nicks to Mediafire

I hope you like this feature for future uses they want to give.

Credits: YO ( Madara ).

Greetings  ;)

tato

thanks ..well u gave to me first :P i won :DDDD





<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

Madara


tato






<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

Gamer

Quote from: tato on March 26, 2011, 09:32:49 PM
XD diria tu abuela


REGALA TODO DALE......TOTAL NOS CAGAMOS NOSOTROS

yazeen

You Are a Pro scripter Best Of Luck In studing english! ;D

tato






<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

DivX


[CHG].Vercetty.

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.

tato

Quote from: [CHG].Vercetty. on April 01, 2011, 11:20:14 PM
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.....





<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

yazeen

Quote from: [CHG].Vercetty. on April 01, 2011, 11:20:14 PM
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

BaSSMaN

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 -.-..

yazeen

Quote from: BaSSMaN on April 08, 2011, 09: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


BaSSMaN

This already exists, but it still doesn't kick..