Jump to content
Sign in to follow this  
Flolyon

Problème checkname

Recommended Posts

Bonjour je vous explique 

 

Samp version 0.3.7 aucun problème 

 

Mais lors de la passage de la 0.3Dl 

 

Il est possible de se connecter sur mon serveur de type Roleplay  avec un simple nom 

 

Exemple : Mike 

 

Et mon serveur crash donc forcément des plaisantin s'amuse a me planter le serveur 

 

 

 

J'aimerais savoir pour faire une obligation de speudo avec le _

 

Ou autre mais que sa pacht la fail

 

Le code :

}
    new nameStr[MAX_PLAYER_NAME];
    GetPlayerName(playerid,nameStr,sizeof(nameStr));
    if(!check_name(nameStr,0))
    {
        SendClientMessage(playerid, COLOR_STATS, "[Info] Nom invalide. Veuillez changer votre nom avec le format Prenom_Nom.");
        SendClientMessage(playerid, COLOR_USAGE, "[Info] Utiliser \"/q\" pour quitter.");
        Kick(playerid);
        return 1;

 

 


//////////////////////

 

public check_name(newName[],checkSql)
{
    new ValideName=true;
    if(strlen(newName) < 6 || strlen(newName) > MAX_PLAYER_NAME-1)
         {ValideName=false;}
    else if(check_sqlChar(newName))
         {ValideName=false;}
    else if(strfind(newName,"²",true) != -1 || strfind(newName,",",true) != -1 || strfind(newName,";",true) != -1)
         {ValideName=false;}
       else if(strfind(newName,"!",true) != -1 || strfind(newName,"?",true) != -1 || strfind(newName,".",true) != -1)
        {ValideName=false;}
       else if(strfind(newName,"§",true) != -1 || strfind(newName,"+",true) != -1 || strfind(newName,"=",true) != -1)
        {ValideName=false;}
       else if(strfind(newName,")",true) != -1 || strfind(newName,"°",true) != -1 || strfind(newName,"-",true) != -1)
        {ValideName=false;}
      else if(strfind(newName,"(",true) != -1 || strfind(newName,"/",true) != -1 || strfind(newName,"&",true) != -1)
           {ValideName=false;}
       else if(strfind(newName,"@",true) != -1 || strfind(newName,"~",true) != -1 || strfind(newName,"ç",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"}",true) != -1 || strfind(newName,"ô",true) != -1 || strfind(newName,"^",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"€",true) != -1 || strfind(newName,"$",true) != -1 || strfind(newName,"*",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"%",true) != -1 || strfind(newName,"¤",true) != -1 || strfind(newName,"9",true) != -1)
         {ValideName=false;}
    else if(strfind(newName,"0",true) != -1 || strfind(newName,"1",true) != -1 || strfind(newName,"2",true) != -1)
         {ValideName=false;}
       else if(strfind(newName,"3",true) != -1 || strfind(newName,"4",true) != -1 || strfind(newName,"5",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"6",true) != -1 || strfind(newName,"7",true) != -1 || strfind(newName,"8",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"ù",true) != -1 || strfind(newName,"à",true) != -1 || strfind(newName,"é",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"è",true) != -1 || strfind(newName,"ê",true) != -1 || strfind(newName,"â",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"û",true) != -1 || strfind(newName,"î",true) != -1 || strfind(newName,"ã",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"ä",true) != -1 || strfind(newName,"ë",true) != -1 || strfind(newName,"ï",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"ö",true) != -1 || strfind(newName,"ü",true) != -1 || strfind(newName,"ÿ",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"ñ",true) != -1 || strfind(newName,"õ",true) != -1 || strfind(newName,"tamere",true) != -1)
        {ValideName=false;}
    else if(strfind(newName," ",true) != -1)
        {ValideName=false;}
    else if(strfind(newName,"_",true) == -1)
         {ValideName=false;}
    else if(checkSql)
    {
        if(MySQLCheckAccount(newName)!=0)

Merci a vous 

 

Edited by Flolyon

Share this post


Link to post
Share on other sites

Salut,

 

Je t'ai fais un code:

 

Il est possible que j'ai oublié certains caractères, il est assez tard, milles excuses pour la fatigue. 

 

stock CheckNameRP(playerid)
{
	new name[MAX_PLAYER_NAME+1];
	GetPlayerName(playerid, name, sizeof(name));
	if(strfind(name, "_", true) == -1) return 0;
	else if(strfind(name, "-", true) != -1) return 0;
	else if(strfind(name, "!", true) != -1) return 0;
	else if(strfind(name, ",", true) != -1) return 0;
	else if(strfind(name, "?", true) != -1) return 0;
	else if(strfind(name, ";", true) != -1) return 0;
	else if(strfind(name, ".", true) != -1) return 0;
	else if(strfind(name, "^", true) != -1) return 0;
	else if(strfind(name, "/", true) != -1) return 0;
	else if(strfind(name, "§", true) != -1) return 0;
	else if(strfind(name, ":", true) != -1) return 0;
	else if(strfind(name, "*", true) != -1) return 0;
	else if(strfind(name, "µ", true) != -1) return 0;
	else if(strfind(name, "%", true) != -1) return 0;
	else if(strfind(name, "$", true) != -1) return 0;
	else if(strfind(name, "£", true) != -1) return 0;
	else if(strfind(name, "¤", true) != -1) return 0;
	else if(strfind(name, "¨", true) != -1) return 0;
	else if(strfind(name, "°", true) != -1) return 0;
	else if(strfind(name, "=", true) != -1) return 0;
	else if(strfind(name, "+", true) != -1) return 0;
	else if(strfind(name, " ", true) != -1) return 0;
	else if(strfind(name, "@", true) != -1) return 0;
	else if(strfind(name, "€", true) != -1) return 0;
	else if(strfind(name, "&", true) != -1) return 0;
	else if(strfind(name, "é", true) != -1) return 0;
	else if(strfind(name, "~", true) != -1) return 0;
	else if(strfind(name, "#", true) != -1) return 0;
	else if(strfind(name, "{", true) != -1) return 0;
	else if(strfind(name, "[", true) != -1) return 0;
	else if(strfind(name, "(", true) != -1) return 0;
	else if(strfind(name, "|", true) != -1) return 0;
	else if(strfind(name, "`", true) != -1) return 0;
	else if(strfind(name, "è", true) != -1) return 0;
	else if(strfind(name, "ç", true) != -1) return 0;
	else if(strfind(name, "à", true) != -1) return 0;
	else if(strfind(name, "]", true) != -1) return 0;
	else if(strfind(name, ")", true) != -1) return 0;
	else if(strfind(name, "}", true) != -1) return 0;
	else if(strfind(name, "²", true) != -1) return 0;
	else if(strfind(name, "<", true) != -1) return 0;
	else if(strfind(name, ">", true) != -1) return 0;
	else if(strfind(name, "0", true) != -1) return 0;
	else if(strfind(name, "1", true) != -1) return 0;
	else if(strfind(name, "2", true) != -1) return 0;
	else if(strfind(name, "3", true) != -1) return 0;
	else if(strfind(name, "4", true) != -1) return 0;
	else if(strfind(name, "5", true) != -1) return 0;
	else if(strfind(name, "6", true) != -1) return 0;
	else if(strfind(name, "7", true) != -1) return 0;
	else if(strfind(name, "8", true) != -1) return 0;
	else if(strfind(name, "9", true) != -1) return 0;
	return 1;
}

public OnPlayerConnect(playerid)
{
	if(!CheckNameRP(playerid))
	{
		SendClientMessage(playerid, -1, "Votre Prénom_Nom n'est pas roleplay.");
		SetTimerEx("kick", 100, false, "i", playerid);
	}
	return 1;
}

forward kick(playerid);
public kick(playerid)
{
	Kick(playerid);
	return 1;
}

 

PS: Tu as placé ton sujet dans la mauvaise catégorie...

Edited by Heaven

Share this post


Link to post
Share on other sites

Merci beaucoup ! je vais test sa 

mais il est pas possible de modifier mon code simplement  !?

Edited by Flolyon

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Contact

Email : contact@sa-mp-fr.com

Communauté San Andreas Multiplayer France

 

La plateforme San Andreas Multiplayer France (sa-mp-fr.com) est un site communautaire indépendant mettant en avant la communauté française du mod San Andreas Multiplayer (SA:MP).

 

sa-mp-fr.com et son contenu ne sont pas affiliés à Rockstar Games, Rockstar North ou Take-Two Interactive Software Inc.

Grand Theft Auto et Grand Theft Auto: San Andreas sont des marques déposées de Take-Two Interactive Software Inc.

×
×
  • Create New...