Ban Check Function doesn't works !
#1

Hi !

I've scripted a ban check when a player conect to my server but the script doesn't works..

This is the script:

Код:
//
		//
		//
		new arrCoords[3][252];
		new strFromFile2[256];
		new File: BanCheckNom = fopen("bannom.cfg", io_read);
		if (BanCheckNom != File:0)
		{
		new idx;
		new playercheck [25];
		new string [252];
		new CheckPlayer;
		new CheckAdmin;
		new CheckRaison;
		while (idx < 1000)
		{
			fread(BanCheckNom, strFromFile2);
			split(strFromFile2, arrCoords, ',');
			CheckPlayer = strlen(arrCoords[0]);
			CheckAdmin = strlen(arrCoords[1]);
			CheckRaison = strlen(arrCoords[2]);
			GetPlayerName(playerid, playercheck, sizeof(playercheck));
			if(strcmp(playercheck, arrCoords[0], true) == 0)
			{
				format(string, sizeof(string), "____________________________________________________BAN_____________________________________________________________");
				SendClientMessage(playerid, COLOR_GREY, string);
				format(string, sizeof(string), "                                                                                  BANNI DU SERVEUR");
				SendClientMessage(playerid, COLOR_LIGHTRED, string);
				format(string, sizeof(string), "l'Admin %s vous a banni du serveur. Votre compte est bloquй. Vous devez demander un dйbanissement a l'adresse suivante:", CheckAdmin);
				SendClientMessage(playerid, COLOR_GREY, string);
				format(string, sizeof(string), "Adresse pour les demandes de dйbanissement: jeroml@hotmail.fr, vous devrez fournir un screen de ce messages et des explications.");
				SendClientMessage(playerid, COLOR_GREY, string);
				format(string, sizeof(string), "INFO: Vous avez йtй identifiй dans les fichiers de banissement en tant que : %s, si ce n'est pas vous, contactez l'Admin.", CheckPlayer);
				SendClientMessage(playerid, COLOR_GREY, string);
				format(string, sizeof(string), "Vous avez йtй banni du serveur pour la raison suivante: %s.", CheckRaison);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
				format(string, sizeof(string), "N'oubliez pas de prendre un screen de ce message а l'aide de la touche F8 de votre clavier. Tout le message doit apparaitre.");
				SendClientMessage(playerid, COLOR_GREEN, string);
				format(string, sizeof(string), "Les screens de SA-MP s'enregistrent dans le dossier C: ... Mes Documents .. GTA San Andreas User Files .. screens");
				SendClientMessage(playerid, COLOR_GREEN, string);
				format(string, sizeof(string), "___________________________________________________________________________________________________________________");
				SendClientMessage(playerid, COLOR_GREY, string);
    			SetTimerEx("KickPublic", 500, 0, "d", playerid);
    			fclose(BanCheckNom);
				return 1;
			}
				idx++;
		}
		fclose(BanCheckNom);
		}
		//
		//
		//
If you want more information about that, just ask me here. That is the result in game:

Quote:

[23:42:42] __________________________________________________ __BAN_____________________________________________ ________________

[23:42:42] BANNI DU SERVEUR

[23:42:42] Adresse pour les demandes de dйbanissement: jeroml@hotmail.fr, vous devrez fournir un screen de ce messages et des explications.

[23:42:42] N'oubliez pas de prendre un screen de ce message а l'aide de la touche F8 de votre clavier. Tout le message doit apparaitre.

[23:42:42] Les screens de SA-MP s'enregistrent dans le dossier C: ... Mes Documents .. GTA San Andreas User Files .. screens

[23:42:42] __________________________________________________ __________________________________________________ _______________

[23:42:42] Server closed the connection.

Thanks you for reading, bye

PS: I'm french, so I'm sorry about eventual misspellings. Thx for your comprehension.
Reply
#2

Up
Reply
#3

Do as I say:
- Firstly, try to find why is it not working. Are you sure you stored banned person in the file by opening the file and searching for banned person. If it is there it's not problem with writing- banning.
- Secondly, after
"fread(BanCheckNom, strFromFile2);"
put this line:
printf("%s",strFromFile2);
and see if it is read good.
- Thirdly, before
if(strcmp(playercheck, arrCoords[0], true) == 0)
put
printf(" (%s)-(%d) (%s)-(%d)",playercheck,strlen(playercheck),arrCoords[0],strlen(arrCoords[0]));
and see if the comparation is good.

One of those has to be the problem.
Remember, it's important to know how to debug the program.
Reply
#4

My /ban works. That is the result of the experience:

In the bannom file:

Quote:

Jason_Dinnozor, Jason_Dinnozor, test du message de ban

In the log when i Log in at "Character_Test" in game

Quote:

[01:26:17] __________________________________________________ __BAN_____________________________________________ ________________

[01:26:17] BANNI DU SERVEUR

[01:26:17] l'Admin vous a banni du serveur. Votre compte est bloquй. Vous devez demander un dйbanissement a l'adresse suivante:

[01:26:17] Adresse pour les demandes de dйbanissement: jeroml@hotmail.fr, vous devrez fournir un screen de ce messages et des explications.

[01:26:17] INFO: Vous avez йtй identifiй dans les fichiers de banissement en tant que : , si ce n'est pas vous, contactez l'Admin.

[01:26:17] Vous avez йtй banni du serveur pour la raison suivante: .

[01:26:17] N'oubliez pas de prendre un screen de ce message а l'aide de la touche F8 de votre clavier. Tout le message doit apparaitre.

[01:26:17] Les screens de SA-MP s'enregistrent dans le dossier C: ... Mes Documents .. GTA San Andreas User Files .. screens

[01:26:17] __________________________________________________ __________________________________________________ _______________

[01:26:18] Server closed the connection.
and in the logs

Quote:

[01:25:58] [join] Character_Test has joined the server (0:127.0.0.1)
[01:26:17]
[01:26:17] Character_Test - 14 - Jason_Dinnozor - 14
[01:26:17] Jason_Dinnozor, Jason_Dinnozor, test du message de ban
[01:26:17] Character_Test - 14 - - 0
[01:26:18] [part] Character_Test has left the server (0:2)

And now I log in at Jason_Dinnozor:

IG

Quote:

[01:30:53] __________________________________________________ __BAN_____________________________________________ ________________

[01:30:53] BANNI DU SERVEUR

[01:30:53] Adresse pour les demandes de dйbanissement: jeroml@hotmail.fr, vous devrez fournir un screen de ce messages et des explications.

[01:30:54] N'oubliez pas de prendre un screen de ce message а l'aide de la touche F8 de votre clavier. Tout le message doit apparaitre.

[01:30:54] Les screens de SA-MP s'enregistrent dans le dossier C: ... Mes Documents .. GTA San Andreas User Files .. screens

[01:30:54] __________________________________________________ __________________________________________________ _______________

[01:30:54] Server closed the connection.
In Logs

Quote:

[01:30:45] [join] Jason_Dinnozor has joined the server (0:127.0.0.1)
[01:30:53]
[01:30:53] Jason_Dinnozor - 14 - Jason_Dinnozor - 14
[01:30:54] [part] Jason_Dinnozor has left the server (0:2)

Reply
#5

Ok, fixed, thx you so mutch, but it have again one problem.

How to set the "while" to have the number of banned persons or how to fix the bug in the condition who is correct when no issue corresponding to the check test..

Do you see what I mean ? :S

Thx for your nice help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)